net-snmp 3.7.1 → 3.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/launch.json +18 -0
- package/README.md +5 -1
- package/index.js +43 -54
- package/package.json +1 -1
package/.vscode/launch.json
CHANGED
@@ -40,6 +40,24 @@
|
|
40
40
|
"1.3.6.1.2.1.1.1.0"
|
41
41
|
]
|
42
42
|
},
|
43
|
+
{
|
44
|
+
"type": "node",
|
45
|
+
"request": "launch",
|
46
|
+
"name": "SNMP community get bulk",
|
47
|
+
"skipFiles": [
|
48
|
+
"<node_internals>/**"
|
49
|
+
],
|
50
|
+
"program": "${workspaceFolder}/example/snmp-get-bulk.js",
|
51
|
+
"args": [
|
52
|
+
"-v", "2c",
|
53
|
+
"-c", "public",
|
54
|
+
"-o", "1",
|
55
|
+
"-r", "20",
|
56
|
+
"127.0.0.1",
|
57
|
+
"1.3.6.1.2.1.1.9",
|
58
|
+
"1.3.6.1.2.1.2"
|
59
|
+
]
|
60
|
+
},
|
43
61
|
{
|
44
62
|
"type": "node",
|
45
63
|
"request": "launch",
|
package/README.md
CHANGED
@@ -315,7 +315,7 @@ Actions
|
|
315
315
|
- `4 - ECouldNotDecrypt`
|
316
316
|
- `5 - EAuthFailure`
|
317
317
|
- `6 - EReqResOidNoMatch`
|
318
|
-
- `7 -
|
318
|
+
- `7 - (no longer used)
|
319
319
|
- `8 - EOutOfOrder`
|
320
320
|
- `9 - EVersionNoMatch`
|
321
321
|
- `10 - ECommunityNoMatch`
|
@@ -3207,6 +3207,10 @@ Example programs are included under the module's `example` directory.
|
|
3207
3207
|
|
3208
3208
|
* Fix DES decrypt corruption issue
|
3209
3209
|
|
3210
|
+
## Version 3.7.2 - 05/06/2022
|
3211
|
+
|
3212
|
+
* Improve getBulk response handling
|
3213
|
+
|
3210
3214
|
# License
|
3211
3215
|
|
3212
3216
|
Copyright (c) 2020 Mark Abrahams <mark@abrahams.co.nz>
|
package/index.js
CHANGED
@@ -265,7 +265,7 @@ var ResponseInvalidCode = {
|
|
265
265
|
4: "ECouldNotDecrypt",
|
266
266
|
5: "EAuthFailure",
|
267
267
|
6: "EReqResOidNoMatch",
|
268
|
-
7: "ENonRepeaterCountMismatch",
|
268
|
+
// 7: "ENonRepeaterCountMismatch", // no longer used
|
269
269
|
8: "EOutOfOrder",
|
270
270
|
9: "EVersionNoMatch",
|
271
271
|
10: "ECommunityNoMatch",
|
@@ -1868,6 +1868,7 @@ Session.prototype.get = function (oids, responseCb) {
|
|
1868
1868
|
|
1869
1869
|
Session.prototype.getBulk = function () {
|
1870
1870
|
var oids, nonRepeaters, maxRepetitions, responseCb;
|
1871
|
+
var reportOidMismatchErrors = this.reportOidMismatchErrors;
|
1871
1872
|
var backwardsGetNexts = this.backwardsGetNexts;
|
1872
1873
|
|
1873
1874
|
if (arguments.length >= 4) {
|
@@ -1889,71 +1890,59 @@ Session.prototype.getBulk = function () {
|
|
1889
1890
|
|
1890
1891
|
function feedCb (req, message) {
|
1891
1892
|
var pdu = message.pdu;
|
1893
|
+
var reqVarbinds = req.message.pdu.varbinds;
|
1892
1894
|
var varbinds = [];
|
1893
1895
|
var i = 0;
|
1894
1896
|
|
1895
|
-
|
1896
|
-
|
1897
|
-
|
1898
|
-
|
1899
|
-
|
1900
|
-
|
1901
|
-
|
1902
|
-
|
1903
|
-
|
1904
|
-
|
1905
|
-
|
1906
|
-
|
1907
|
-
|
1908
|
-
|
1909
|
-
+ req.message.pdu.varbinds[i].oid + "' in request at "
|
1910
|
-
+ "positiion '" + i + "' does not precede "
|
1911
|
-
+ "OID '" + pdu.varbinds[i].oid + "' in response "
|
1897
|
+
for ( ; i < reqVarbinds.length && i < pdu.varbinds.length; i++) {
|
1898
|
+
if (isVarbindError (pdu.varbinds[i])) {
|
1899
|
+
if ( reportOidMismatchErrors && reqVarbinds[i].oid != pdu.varbinds[i].oid ) {
|
1900
|
+
req.responseCb (new ResponseInvalidError ("OID '" + reqVarbinds[i].oid
|
1901
|
+
+ "' in request at position '" + i + "' does not "
|
1902
|
+
+ "match OID '" + pdu.varbinds[i].oid + "' in response "
|
1903
|
+
+ "at position '" + i + "'", ResponseInvalidCode.EReqResOidNoMatch));
|
1904
|
+
return;
|
1905
|
+
}
|
1906
|
+
} else {
|
1907
|
+
if ( ! backwardsGetNexts && ! oidFollowsOid (reqVarbinds[i].oid, pdu.varbinds[i].oid)) {
|
1908
|
+
req.responseCb (new ResponseInvalidError ("OID '" + reqVarbinds[i].oid
|
1909
|
+
+ "' in request at positiion '" + i + "' does not "
|
1910
|
+
+ "precede OID '" + pdu.varbinds[i].oid + "' in response "
|
1912
1911
|
+ "at position '" + i + "'", ResponseInvalidCode.EOutOfOrder));
|
1913
1912
|
return;
|
1914
|
-
} else {
|
1915
|
-
varbinds.push (pdu.varbinds[i]);
|
1916
1913
|
}
|
1917
1914
|
}
|
1915
|
+
if (i < nonRepeaters)
|
1916
|
+
varbinds.push (pdu.varbinds[i]);
|
1917
|
+
else
|
1918
|
+
varbinds.push ([pdu.varbinds[i]]);
|
1918
1919
|
}
|
1919
1920
|
|
1920
|
-
var repeaters =
|
1921
|
+
var repeaters = reqVarbinds.length - nonRepeaters;
|
1921
1922
|
|
1922
|
-
|
1923
|
-
|
1924
|
-
|
1925
|
-
|
1926
|
-
|
1927
|
-
|
1928
|
-
|
1929
|
-
|
1930
|
-
|
1931
|
-
|
1932
|
-
|
1933
|
-
|
1934
|
-
|
1935
|
-
|
1936
|
-
|
1937
|
-
|
1938
|
-
|
1939
|
-
|
1940
|
-
|
1941
|
-
|
1942
|
-
req.responseCb (new ResponseInvalidError ("OID '"
|
1943
|
-
+ req.message.pdu.varbinds[reqIndex].oid
|
1944
|
-
+ "' in request at position '" + (reqIndex)
|
1945
|
-
+ "' does not precede OID '"
|
1946
|
-
+ pdu.varbinds[respIndex].oid
|
1947
|
-
+ "' in response at position '" + (respIndex) + "'",
|
1948
|
-
ResponseInvalidCode.EOutOfOrder));
|
1949
|
-
return;
|
1950
|
-
} else {
|
1951
|
-
if (! varbinds[reqIndex])
|
1952
|
-
varbinds[reqIndex] = [];
|
1953
|
-
varbinds[reqIndex].push (pdu.varbinds[respIndex]);
|
1954
|
-
}
|
1923
|
+
for ( ; i < pdu.varbinds.length; i++) {
|
1924
|
+
var reqIndex = (i - nonRepeaters) % repeaters + nonRepeaters;
|
1925
|
+
var prevIndex = i - repeaters;
|
1926
|
+
var prevOid = pdu.varbinds[prevIndex].oid;
|
1927
|
+
|
1928
|
+
if (isVarbindError (pdu.varbinds[i])) {
|
1929
|
+
if ( reportOidMismatchErrors && prevOid != pdu.varbinds[i].oid ) {
|
1930
|
+
req.responseCb (new ResponseInvalidError ("OID '" + prevOid
|
1931
|
+
+ "' in response at position '" + prevIndex + "' does not "
|
1932
|
+
+ "match OID '" + pdu.varbinds[i].oid + "' in response "
|
1933
|
+
+ "at position '" + i + "'", ResponseInvalidCode.EReqResOidNoMatch));
|
1934
|
+
return;
|
1935
|
+
}
|
1936
|
+
} else {
|
1937
|
+
if ( ! backwardsGetNexts && ! oidFollowsOid (prevOid, pdu.varbinds[i].oid)) {
|
1938
|
+
req.responseCb (new ResponseInvalidError ("OID '" + prevOid
|
1939
|
+
+ "' in response at positiion '" + prevIndex + "' does not "
|
1940
|
+
+ "precede OID '" + pdu.varbinds[i].oid + "' in response "
|
1941
|
+
+ "at position '" + i + "'", ResponseInvalidCode.EOutOfOrder));
|
1942
|
+
return;
|
1955
1943
|
}
|
1956
1944
|
}
|
1945
|
+
varbinds[reqIndex].push (pdu.varbinds[i]);
|
1957
1946
|
}
|
1958
1947
|
|
1959
1948
|
req.responseCb (null, varbinds);
|