Deleted Added
full compact
config.c (133594) config.c (150920)
1/*
2 * Copyright (c) 2001-2003
3 * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
4 * All rights reserved.
5 *
6 * Author: Harti Brandt <harti@freebsd.org>
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 12 unchanged lines hidden (view full) ---

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
1/*
2 * Copyright (c) 2001-2003
3 * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
4 * All rights reserved.
5 *
6 * Author: Harti Brandt <harti@freebsd.org>
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 12 unchanged lines hidden (view full) ---

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $Begemot: bsnmp/snmpd/config.c,v 1.22 2004/08/12 17:09:49 brandt Exp $
29 * $Begemot: bsnmp/snmpd/config.c,v 1.24 2005/10/04 11:21:37 brandt_h Exp $
30 *
31 * Parse configuration file.
32 */
33#include <sys/types.h>
34#include <sys/socket.h>
35#include <sys/un.h>
36#include <stdio.h>
37#include <stdlib.h>

--- 777 unchanged lines hidden (view full) ---

815 break;
816 if (node == &tree[tree_size])
817 node = NULL;
818
819 oid->len = 0;
820 while (token == '.') {
821 if (gettoken() == TOK_NUM) {
822 if (numval > ASN_MAXID)
30 *
31 * Parse configuration file.
32 */
33#include <sys/types.h>
34#include <sys/socket.h>
35#include <sys/un.h>
36#include <stdio.h>
37#include <stdlib.h>

--- 777 unchanged lines hidden (view full) ---

815 break;
816 if (node == &tree[tree_size])
817 node = NULL;
818
819 oid->len = 0;
820 while (token == '.') {
821 if (gettoken() == TOK_NUM) {
822 if (numval > ASN_MAXID)
823 report("subid too large %#"PRIx64, numval);
823 report("subid too large %#"QUADXFMT, numval);
824 if (oid->len == ASN_MAXOIDLEN)
825 report("index too long");
826 oid->subs[oid->len++] = numval;
827
828 } else if (token == TOK_STR) {
829 if (strvallen + oid->len + 1 > ASN_MAXOIDLEN)
830 report("oid too long");
831 oid->subs[oid->len++] = strvallen;

--- 26 unchanged lines hidden (view full) ---

858}
859
860static void
861parse_syntax_integer(struct snmp_value *value)
862{
863 if (token != TOK_NUM)
864 report("bad INTEGER syntax");
865 if (numval > 0x7fffffff)
824 if (oid->len == ASN_MAXOIDLEN)
825 report("index too long");
826 oid->subs[oid->len++] = numval;
827
828 } else if (token == TOK_STR) {
829 if (strvallen + oid->len + 1 > ASN_MAXOIDLEN)
830 report("oid too long");
831 oid->subs[oid->len++] = strvallen;

--- 26 unchanged lines hidden (view full) ---

858}
859
860static void
861parse_syntax_integer(struct snmp_value *value)
862{
863 if (token != TOK_NUM)
864 report("bad INTEGER syntax");
865 if (numval > 0x7fffffff)
866 report("INTEGER too large %"PRIu64, numval);
866 report("INTEGER too large %"QUADFMT, numval);
867
868 value->v.integer = numval;
869 gettoken();
870}
871
872static void
873parse_syntax_counter64(struct snmp_value *value)
874{

--- 251 unchanged lines hidden (view full) ---

1126 }
1127 strcpy(m->name, varname);
1128 m->perm = 0;
1129 LIST_INSERT_HEAD(&macros, m, link);
1130
1131 m->value = string;
1132 m->length = length;
1133 } else {
867
868 value->v.integer = numval;
869 gettoken();
870}
871
872static void
873parse_syntax_counter64(struct snmp_value *value)
874{

--- 251 unchanged lines hidden (view full) ---

1126 }
1127 strcpy(m->name, varname);
1128 m->perm = 0;
1129 LIST_INSERT_HEAD(&macros, m, link);
1130
1131 m->value = string;
1132 m->length = length;
1133 } else {
1134 if (t != TOK_ASSIGN) {
1134 if (t == TOK_ASSIGN) {
1135 free(m->value);
1136 m->value = string;
1137 m->length = length;
1138 }
1139 }
1140
1141 token = TOK_EOL;
1142

--- 212 unchanged lines hidden (view full) ---

1355 strcpy(m->name, name);
1356 if ((m->value = malloc(strlen(value) + 1)) == NULL) {
1357 free(m->name);
1358 free(m);
1359 return (-1);
1360 }
1361 strcpy(m->value, value);
1362 m->length = strlen(value);
1135 free(m->value);
1136 m->value = string;
1137 m->length = length;
1138 }
1139 }
1140
1141 token = TOK_EOL;
1142

--- 212 unchanged lines hidden (view full) ---

1355 strcpy(m->name, name);
1356 if ((m->value = malloc(strlen(value) + 1)) == NULL) {
1357 free(m->name);
1358 free(m);
1359 return (-1);
1360 }
1361 strcpy(m->value, value);
1362 m->length = strlen(value);
1363 m->perm = 1;
1364 LIST_INSERT_HEAD(&macros, m, link);
1363 return (0);
1364}
1365 return (0);
1366}