Blame SOURCES/net-snmp-5.9.1-python-usenumeric.patch

962144
From 8c1dad23301692799749d75a3c039b8ae7c07f8e Mon Sep 17 00:00:00 2001
962144
From: Bart Van Assche <bvanassche@acm.org>
962144
Date: Wed, 9 Jun 2021 14:19:46 -0700
962144
Subject: [PATCH] Python: Fix snmpwalk with UseNumeric=1
962144
962144
Fixes: c744be5ffed6 ("Python: Introduce build_python_varbind()")
962144
Fixes: https://github.com/net-snmp/net-snmp/issues/303
962144
---
962144
 python/netsnmp/client_intf.c | 9 ++++-----
962144
 1 file changed, 4 insertions(+), 5 deletions(-)
962144
962144
diff --git a/python/netsnmp/client_intf.c b/python/netsnmp/client_intf.c
962144
index e5e7372303..94da39fe34 100644
962144
--- a/python/netsnmp/client_intf.c
962144
+++ b/python/netsnmp/client_intf.c
962144
@@ -1316,7 +1316,7 @@ netsnmp_delete_session(PyObject *self, PyObject *args)
962144
 
962144
 static int build_python_varbind(PyObject *varbind, netsnmp_variable_list *vars,
962144
                                 int varlist_ind, int sprintval_flag, int *len,
962144
-                                char **str_buf)
962144
+                                char **str_buf, int getlabel_flag)
962144
 {
962144
     struct tree *tp;
962144
     int type;
962144
@@ -1326,7 +1326,6 @@ static int build_python_varbind(PyObject *varbind, netsnmp_variable_list *vars,
962144
     int buf_over = 0;
962144
     const char *tag;
962144
     const char *iid;
962144
-    int getlabel_flag = NO_FLAGS;
962144
 
962144
     if (!PyObject_HasAttrString(varbind, "tag"))
962144
         return TYPE_OTHER;
962144
@@ -1523,7 +1522,7 @@ netsnmp_get_or_getnext(PyObject *self, PyObject *args, int pdu_type,
962144
 
962144
       varbind = PySequence_GetItem(varlist, varlist_ind);
962144
       type = build_python_varbind(varbind, vars, varlist_ind, sprintval_flag,
962144
-                                  &len, &str_buf);
962144
+                                  &len, &str_buf, getlabel_flag);
962144
       if (type != TYPE_OTHER) {
962144
           /* save in return tuple as well */
962144
           if ((type == SNMP_ENDOFMIBVIEW) ||
962144
@@ -1832,7 +1831,7 @@ netsnmp_walk(PyObject *self, PyObject *args)
962144
 
962144
               varbind = py_netsnmp_construct_varbind();
962144
               if (varbind && build_python_varbind(varbind, vars, varlist_ind,
962144
-                                       sprintval_flag, &len, &str_buf) !=
962144
+                                       sprintval_flag, &len, &str_buf, getlabel_flag) !=
962144
                   TYPE_OTHER) {
962144
                   const int hex = is_hex(str_buf, len);
962144
 
962144
@@ -2055,7 +2054,7 @@ netsnmp_getbulk(PyObject *self, PyObject *args)
962144
 
962144
 	  varbind = py_netsnmp_construct_varbind();
962144
           if (varbind && build_python_varbind(varbind, vars, varbind_ind,
962144
-                              sprintval_flag, &len, &str_buf) != TYPE_OTHER) {
962144
+                              sprintval_flag, &len, &str_buf, getlabel_flag) != TYPE_OTHER) {
962144
             const int hex = is_hex(str_buf, len);
962144
 
962144
             /* push varbind onto varbinds */
962144