When doing a get{next,bulk} below an instance we must move the OID to
authormartijn <martijn@openbsd.org>
Sun, 29 Oct 2023 11:20:06 +0000 (11:20 +0000)
committermartijn <martijn@openbsd.org>
Sun, 29 Oct 2023 11:20:06 +0000 (11:20 +0000)
the next sibling. Not simply copying over the value of the next to use
region, since that might be the parent and we would walk backwards in
the tree.

OK tb@

usr.sbin/snmpd/application.c

index dc60f8b..c36f059 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: application.c,v 1.26 2023/10/29 11:12:57 martijn Exp $        */
+/*     $OpenBSD: application.c,v 1.27 2023/10/29 11:20:06 martijn Exp $        */
 
 /*
  * Copyright (c) 2021 Martijn van Duren <martijn@openbsd.org>
@@ -1368,19 +1368,17 @@ appl_varbind_backend(struct appl_varbind_internal *ivb)
                                        return -1;
                                return 0;
                        }
-                       if ((region = appl_region_next(ureq->aru_ctx,
-                           &(vb->av_oid), region)) == NULL)
-                               goto eomv;
                        vb->av_oid = region->ar_oid;
+                       ober_oid_nextsibling(&(vb->av_oid));
                        vb->av_include = 1;
+                       return appl_varbind_backend(ivb);
                }
        } else if (cmp == 0) {
                if (region->ar_instance && next && !vb->av_include) {
-                       if ((region = appl_region_next(ureq->aru_ctx,
-                           &(vb->av_oid), region)) == NULL)
-                               goto eomv;
                        vb->av_oid = region->ar_oid;
+                       ober_oid_nextsibling(&(vb->av_oid));
                        vb->av_include = 1;
+                       return appl_varbind_backend(ivb);
                }
        }
        ivb->avi_region = region;