Ticket #351: patch-16bitIDs

File patch-16bitIDs, 2.2 KB (added by sean@…, 22 years ago)

official patch for 16-bit IDs

Line 
1--- snmplib/snmp_api.c  11 Jan 2003 01:10:00 -0000      5.30
2+++ snmplib/snmp_api.c  14 Jan 2003 14:14:41 -0000      5.31
3@@ -402,7 +402,10 @@
4         retVal = 2;
5     Reqid = retVal;
6     snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_REQUESTID);
7-    return retVal;
8+    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
9+        return (retVal & 0x7fff);      /* mask to 15 bits */
10+    else
11+        return retVal;
12 }
13 
14 long
15@@ -415,7 +418,10 @@
16         retVal = 2;
17     Msgid = retVal;
18     snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_MESSAGEID);
19-    return retVal;
20+    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
21+        return (retVal & 0x7fff);      /* mask to 15 bits */
22+    else
23+        return retVal;
24 }
25 
26 long
27@@ -428,7 +434,10 @@
28         retVal = 2;
29     Sessid = retVal;
30     snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSIONID);
31-    return retVal;
32+    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
33+        return (retVal & 0x7fff);      /* mask to 15 bits */
34+    else
35+        return retVal;
36 }
37 
38 long
39@@ -441,7 +450,10 @@
40         retVal = 2;
41     Transid = retVal;
42     snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_TRANSID);
43-    return retVal;
44+    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
45+        return (retVal & 0x7fff);      /* mask to 15 bits */
46+    else
47+        return retVal;
48 }
49 
50 void
51@@ -692,6 +704,8 @@
52                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PERSISTENT_DIR);
53     netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "noDisplayHint",
54                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NO_DISPLAY_HINT);
55+    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "16bitIDs",
56+                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS);
57 }
58 
59 void
60diff -u -r5.8 -r5.9
61--- include/net-snmp/library/default_store.h    12 Dec 2002 19:18:06 -0000      5.8
62+++ include/net-snmp/library/default_store.h    14 Jan 2003 14:14:40 -0000      5.9
63@@ -59,6 +59,7 @@
64 #define NETSNMP_DS_LIB_QUICKE_PRINT        28   
65 #define NETSNMP_DS_LIB_DONT_PRINT_UNITS    29 /* don't print UNITS suffix */
66 #define NETSNMP_DS_LIB_NO_DISPLAY_HINT     30 /* don't apply DISPLAY-HINTs */
67+#define NETSNMP_DS_LIB_16BIT_IDS           31   /* restrict requestIDs, etc to 16-bit values */
68 
69     /*
70      * library integers