diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2013-10-02 09:36:22 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2013-10-02 09:36:22 +0000 |
commit | cfc3f1e29f13976cc2117c2fc3ba069941ae466b (patch) | |
tree | 41e5048ba1ac9c8d7328c72fb5839f26920b19ab /usr.sbin/snmpd/mps.c | |
parent | e3b45ead72b6bb0a5f35f36f1dd40d2cadcb5870 (diff) |
Fix GETBULK mode that got broken with r1.14.
ok sthen@
Diffstat (limited to 'usr.sbin/snmpd/mps.c')
-rw-r--r-- | usr.sbin/snmpd/mps.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/usr.sbin/snmpd/mps.c b/usr.sbin/snmpd/mps.c index e913b000c5b..a883eab054c 100644 --- a/usr.sbin/snmpd/mps.c +++ b/usr.sbin/snmpd/mps.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mps.c,v 1.17 2012/10/01 11:36:55 reyk Exp $ */ +/* $OpenBSD: mps.c,v 1.18 2013/10/02 09:36:21 reyk Exp $ */ /* * Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org> @@ -210,16 +210,11 @@ mps_getnextreq(struct ber_element *root, struct ber_oid *o) break; } } else if (o->bo_n == value->o_oidlen && value->o_get != NULL) { - /* No instance identifier specified. Append .0. */ - if (o->bo_n + 1 > BER_MAX_OID_LEN) - return (NULL); - ber = ber_add_noid(ber, o, o->bo_n + 1); - if ((ret = value->o_get(value, o, &ber)) != 0) - return (NULL); - return (ber); + next = value; + goto appendzero; } -getnext: + getnext: for (next = value; next != NULL;) { next = smi_next(next); if (next == NULL) @@ -246,8 +241,11 @@ getnext: } } else { bcopy(&next->o_id, o, sizeof(*o)); - ber = ber_add_noid(ber, &next->o_id, - next->o_oidlen + 1); + appendzero: + /* No instance identifier specified. Append .0. */ + if (o->bo_n + 1 > BER_MAX_OID_LEN) + return (NULL); + ber = ber_add_noid(ber, o, ++o->bo_n); if ((ret = next->o_get(next, o, &ber)) != 0) return (NULL); } |