|
|
71d9c0 |
1064338 - various net-snmp-python return code errors
|
|
|
71d9c0 |
|
|
|
71d9c0 |
commit 71a31dabc05e4e86ba14deff427a6911c167e713
|
|
|
71d9c0 |
Author: Wes Hardaker <hardaker@users.sourceforge.net>
|
|
|
71d9c0 |
Date: Fri Jul 30 13:00:49 2010 +0000
|
|
|
71d9c0 |
|
|
|
71d9c0 |
CHANGES: python: patch 3035578: from sws: keep error codes up to date
|
|
|
71d9c0 |
|
|
|
71d9c0 |
git-svn-id: file:///home/hardaker/lib/sf-bkups/net-snmp-convert-svnrepo/trunk@19268 06827809-a52a-0410-b366-d66718629ded
|
|
|
71d9c0 |
|
|
|
71d9c0 |
|
|
|
71d9c0 |
commit 7e1cae42bd79a0cdfb70521558a0dedc5aa0c42d
|
|
|
71d9c0 |
Author: Dave Shield <dts12@users.sourceforge.net>
|
|
|
71d9c0 |
Date: Thu Apr 14 21:31:09 2011 +0000
|
|
|
71d9c0 |
|
|
|
71d9c0 |
CHANGES: python: PATCHES: 3185085: Fix segfault on 64-bit systems
|
|
|
71d9c0 |
git-svn-id: file:///home/hardaker/lib/sf-bkups/net-snmp-convert-svnrepo/trunk@20180 06827809-a52a-0410-b366-d66718629ded
|
|
|
71d9c0 |
|
|
|
71d9c0 |
commit 9a2bfc8f95d6e926dcbf16ff44b53b27e38c8437
|
|
|
71d9c0 |
Author: Jan Safranek <jsafranek@users.sourceforge.net>
|
|
|
71d9c0 |
Date: Mon Jul 1 13:54:38 2013 +0200
|
|
|
71d9c0 |
|
|
|
71d9c0 |
CHANGES: python: Fixed returning of empty strings.
|
|
|
71d9c0 |
Varbind type (SNMP_NOSUCHOBJECT etc.) should be used to detect errors instead of length of the variable - it can be empty string.
|
|
|
71d9c0 |
|
|
|
71d9c0 |
commit 408cc9732c346111fc1fda23e136d60883cdb7e4
|
|
|
71d9c0 |
Author: Jan Safranek <jsafranek@users.sourceforge.net>
|
|
|
71d9c0 |
Date: Mon Jul 1 14:25:41 2013 +0200
|
|
|
71d9c0 |
|
|
|
71d9c0 |
CHANGES: python: correctly report error when parsing malformed OID.
|
|
|
71d9c0 |
|
|
|
71d9c0 |
diff -up net-snmp-5.7.2/python/netsnmp/client_intf.c.test net-snmp-5.7.2/python/netsnmp/client_intf.c
|
|
|
71d9c0 |
--- net-snmp-5.7.2/python/netsnmp/client_intf.c.test 2014-02-13 09:34:37.456480927 +0100
|
|
|
71d9c0 |
+++ net-snmp-5.7.2/python/netsnmp/client_intf.c 2014-02-13 09:51:22.475642391 +0100
|
|
|
71d9c0 |
@@ -658,7 +658,10 @@ int best_guess;
|
|
|
71d9c0 |
newname_len = MAX_OID_LEN;
|
|
|
71d9c0 |
if (read_objid(tag, newname, &newname_len)) { /* long name */
|
|
|
71d9c0 |
rtp = tp = get_tree(newname, newname_len, get_tree_head());
|
|
|
71d9c0 |
- }
|
|
|
71d9c0 |
+ } else {
|
|
|
71d9c0 |
+ /* failed to parse the OID */
|
|
|
71d9c0 |
+ newname_len = 0;
|
|
|
71d9c0 |
+ }
|
|
|
71d9c0 |
}
|
|
|
71d9c0 |
else {
|
|
|
71d9c0 |
rtp = tp = get_tree(newname, newname_len, get_tree_head());
|
|
|
71d9c0 |
@@ -885,6 +887,15 @@ int *err_ind;
|
|
|
71d9c0 |
goto done;
|
|
|
71d9c0 |
}
|
|
|
71d9c0 |
|
|
|
71d9c0 |
+ tmp_err_str = calloc(1, STR_BUF_SIZE);
|
|
|
71d9c0 |
+ if (tmp_err_str == NULL) {
|
|
|
71d9c0 |
+ *err_num = errno;
|
|
|
71d9c0 |
+ *err_ind = SNMPERR_MALLOC;
|
|
|
71d9c0 |
+ status = SNMPERR_MALLOC;
|
|
|
71d9c0 |
+ strncpy(err_str, snmp_api_errstring(*err_ind), STR_BUF_SIZE - 1);
|
|
|
71d9c0 |
+ goto done;
|
|
|
71d9c0 |
+ }
|
|
|
71d9c0 |
+
|
|
|
71d9c0 |
retry:
|
|
|
71d9c0 |
|
|
|
71d9c0 |
Py_BEGIN_ALLOW_THREADS
|
|
|
71d9c0 |
@@ -1589,10 +1600,16 @@ netsnmp_get(PyObject *self, PyObject *ar
|
|
|
71d9c0 |
py_netsnmp_attr_set_string(varbind, "val", (char *) str_buf, len);
|
|
|
71d9c0 |
|
|
|
71d9c0 |
/* save in return tuple as well */
|
|
|
71d9c0 |
- PyTuple_SetItem(val_tuple, varlist_ind,
|
|
|
71d9c0 |
- (len ? Py_BuildValue("s#", str_buf, len) :
|
|
|
71d9c0 |
- Py_BuildValue("")));
|
|
|
71d9c0 |
-
|
|
|
71d9c0 |
+ if ((type == SNMP_ENDOFMIBVIEW) ||
|
|
|
71d9c0 |
+ (type == SNMP_NOSUCHOBJECT) ||
|
|
|
71d9c0 |
+ (type == SNMP_NOSUCHINSTANCE)) {
|
|
|
71d9c0 |
+ /* Translate error to None */
|
|
|
71d9c0 |
+ PyTuple_SetItem(val_tuple, varlist_ind,
|
|
|
71d9c0 |
+ Py_BuildValue(""));
|
|
|
71d9c0 |
+ } else {
|
|
|
71d9c0 |
+ PyTuple_SetItem(val_tuple, varlist_ind,
|
|
|
71d9c0 |
+ Py_BuildValue("s#", str_buf, len));
|
|
|
71d9c0 |
+ }
|
|
|
71d9c0 |
Py_DECREF(varbind);
|
|
|
71d9c0 |
} else {
|
|
|
71d9c0 |
printf("netsnmp_get: bad varbind (%d)\n", varlist_ind);
|
|
|
71d9c0 |
@@ -1801,10 +1818,16 @@ netsnmp_getnext(PyObject *self, PyObject
|
|
|
71d9c0 |
py_netsnmp_attr_set_string(varbind, "val", (char *) str_buf, len);
|
|
|
71d9c0 |
|
|
|
71d9c0 |
/* save in return tuple as well */
|
|
|
71d9c0 |
- PyTuple_SetItem(val_tuple, varlist_ind,
|
|
|
71d9c0 |
- (len ? Py_BuildValue("s#", str_buf, len) :
|
|
|
71d9c0 |
- Py_BuildValue("")));
|
|
|
71d9c0 |
-
|
|
|
71d9c0 |
+ if ((type == SNMP_ENDOFMIBVIEW) ||
|
|
|
71d9c0 |
+ (type == SNMP_NOSUCHOBJECT) ||
|
|
|
71d9c0 |
+ (type == SNMP_NOSUCHINSTANCE)) {
|
|
|
71d9c0 |
+ /* Translate error to None */
|
|
|
71d9c0 |
+ PyTuple_SetItem(val_tuple, varlist_ind,
|
|
|
71d9c0 |
+ Py_BuildValue(""));
|
|
|
71d9c0 |
+ } else {
|
|
|
71d9c0 |
+ PyTuple_SetItem(val_tuple, varlist_ind,
|
|
|
71d9c0 |
+ Py_BuildValue("s#", str_buf, len));
|
|
|
71d9c0 |
+ }
|
|
|
71d9c0 |
Py_DECREF(varbind);
|
|
|
71d9c0 |
} else {
|
|
|
71d9c0 |
printf("netsnmp_getnext: bad varbind (%d)\n", varlist_ind);
|