diff options
author | dim <dim@FreeBSD.org> | 2010-12-09 22:01:15 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2010-12-09 22:01:15 +0000 |
commit | a3786f65f1e2fa3a4e925fdb4b2b5544b9021bf9 (patch) | |
tree | 5f0a24f71baa3176c75a20a51a9e20a22c75426c /contrib/bsnmp/snmpd/config.c | |
parent | ad01c620333d05c430d583ee40647e396be1ab91 (diff) | |
parent | 12dd9eb8e940c48f9fc30dbc137071b4fe5caead (diff) | |
download | FreeBSD-src-a3786f65f1e2fa3a4e925fdb4b2b5544b9021bf9.zip FreeBSD-src-a3786f65f1e2fa3a4e925fdb4b2b5544b9021bf9.tar.gz |
Sync: merge r216133 through r216338 from ^/head.
Diffstat (limited to 'contrib/bsnmp/snmpd/config.c')
-rw-r--r-- | contrib/bsnmp/snmpd/config.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/contrib/bsnmp/snmpd/config.c b/contrib/bsnmp/snmpd/config.c index 48044ec..c4f1188 100644 --- a/contrib/bsnmp/snmpd/config.c +++ b/contrib/bsnmp/snmpd/config.c @@ -31,6 +31,7 @@ * Parse configuration file. */ #include <sys/types.h> +#include <sys/queue.h> #include <sys/socket.h> #include <sys/un.h> #include <stdio.h> @@ -810,6 +811,7 @@ parse_oid(const char *varname, struct asn_oid *oid) struct snmp_node *node; u_int i; u_char ip[4]; + struct asn_oid str_oid; for (node = tree; node < &tree[tree_size]; node++) if (strcmp(varname, node->name) == 0) @@ -824,7 +826,19 @@ parse_oid(const char *varname, struct asn_oid *oid) report("subid too large %#"QUADXFMT, numval); if (oid->len == ASN_MAXOIDLEN) report("index too long"); - oid->subs[oid->len++] = numval; + if (gettoken() != ':') + oid->subs[oid->len++] = numval; + else { + str_oid.len = 0; + str_oid.subs[str_oid.len++] = numval; + while (gettoken() == TOK_NUM) { + str_oid.subs[str_oid.len++] = numval; + if (gettoken() != ':') + break; + } + oid->subs[oid->len++] = str_oid.len; + asn_append_oid(oid, &str_oid); + } } else if (token == TOK_STR) { if (strvallen + oid->len + 1 > ASN_MAXOIDLEN) @@ -832,6 +846,7 @@ parse_oid(const char *varname, struct asn_oid *oid) oid->subs[oid->len++] = strvallen; for (i = 0; i < strvallen; i++) oid->subs[oid->len++] = strval[i]; + gettoken(); } else if (token == TOK_HOST) { gethost(strval, ip); @@ -839,10 +854,9 @@ parse_oid(const char *varname, struct asn_oid *oid) report("index too long"); for (i = 0; i < 4; i++) oid->subs[oid->len++] = ip[i]; - + gettoken(); } else report("bad token in index"); - gettoken(); } return (node); @@ -1006,7 +1020,7 @@ parse_assign(const char *varname) node = parse_oid(varname, &vindex); if (token != '=') - report("'=' expected"); + report("'=' expected, got '%c'", token); gettoken(); if (ignore) { |