net-snmp 3.6.3 → 3.6.4

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/CONTRIBUTING.md CHANGED
@@ -11,7 +11,9 @@ the developers managing and developing this open source project.
11
11
 
12
12
  The issue tracker is the preferred channel for [bug reports](#bugs),
13
13
  [features requests](#features) and [submitting pull
14
- requests](#pull-requests).
14
+ requests](#pull-requests). Please prefer the issue tracker over
15
+ emailing individual project contributors as your first engagement
16
+ with the project.
15
17
 
16
18
  ## What to always do
17
19
 
package/README.md CHANGED
@@ -540,6 +540,7 @@ var options = {
540
540
  trapPort: 162,
541
541
  version: snmp.Version1,
542
542
  backwardsGetNexts: true,
543
+ reportOidMismatchErrors: false,
543
544
  idBitsSize: 32
544
545
  };
545
546
 
@@ -567,7 +568,9 @@ is an object, and can contain the following items:
567
568
  * `version` - Either `snmp.Version1` or `snmp.Version2c`, defaults to
568
569
  `snmp.Version1`
569
570
  * `backwardsGetNexts` - boolean to allow GetNext operations to retrieve lexicographically
570
- preceeding OIDs
571
+ preceding OIDs, defaults to `true`
572
+ * `reportOidMismatchErrors` - boolean to allow error reporting of OID mismatches between
573
+ requests and responses, defaults to `false`
571
574
  * `idBitsSize` - Either `16` or `32`, defaults to `32`. Used to reduce the size
572
575
  of the generated id for compatibility with some older devices.
573
576
 
@@ -592,6 +595,8 @@ var options = {
592
595
  trapPort: 162,
593
596
  version: snmp.Version3,
594
597
  engineID: "8000B98380XXXXXXXXXXXXXXXXXXXXXXXX", // where the X's are random hex digits
598
+ backwardsGetNexts: true,
599
+ reportOidMismatchErrors: false,
595
600
  idBitsSize: 32,
596
601
  context: ""
597
602
  };
@@ -3183,7 +3188,11 @@ Example programs are included under the module's `example` directory.
3183
3188
 
3184
3189
  ## Version 3.6.3 - 26/04/2022
3185
3190
 
3186
- * Fix logic for v3 time syncronization requirement
3191
+ * Fix logic for v3 time synchronization requirement
3192
+
3193
+ ## Version 3.6.4 - 14/05/2022
3194
+
3195
+ * Ignore mismatched returned OIDs by default
3187
3196
 
3188
3197
  # License
3189
3198
 
package/index.js CHANGED
@@ -1828,6 +1828,10 @@ var Session = function (target, authenticator, options) {
1828
1828
  ? options.backwardsGetNexts
1829
1829
  : true;
1830
1830
 
1831
+ this.reportOidMismatchErrors = (typeof options.reportOidMismatchErrors !== 'undefined')
1832
+ ? options.reportOidMismatchErrors
1833
+ : false;
1834
+
1831
1835
  DEBUG = options.debug;
1832
1836
 
1833
1837
  this.engine = new Engine (options.engineID);
@@ -1870,6 +1874,8 @@ function _generateId (bitSize) {
1870
1874
  }
1871
1875
 
1872
1876
  Session.prototype.get = function (oids, responseCb) {
1877
+ var reportOidMismatchErrors = this.reportOidMismatchErrors;
1878
+
1873
1879
  function feedCb (req, message) {
1874
1880
  var pdu = message.pdu;
1875
1881
  var varbinds = [];
@@ -1879,10 +1885,10 @@ Session.prototype.get = function (oids, responseCb) {
1879
1885
  + "match response OIDs", ResponseInvalidCode.EReqResOidNoMatch));
1880
1886
  } else {
1881
1887
  for (var i = 0; i < req.message.pdu.varbinds.length; i++) {
1882
- if (req.message.pdu.varbinds[i].oid != pdu.varbinds[i].oid) {
1888
+ if ( reportOidMismatchErrors && req.message.pdu.varbinds[i].oid != pdu.varbinds[i].oid ) {
1883
1889
  req.responseCb (new ResponseInvalidError ("OID '"
1884
1890
  + req.message.pdu.varbinds[i].oid
1885
- + "' in request at positiion '" + i + "' does not "
1891
+ + "' in request at position '" + i + "' does not "
1886
1892
  + "match OID '" + pdu.varbinds[i].oid + "' in response "
1887
1893
  + "at position '" + i + "'", ResponseInvalidCode.EReqResOidNoMatch));
1888
1894
  return;
@@ -1984,7 +1990,7 @@ Session.prototype.getBulk = function () {
1984
1990
  pdu.varbinds[respIndex].oid)) {
1985
1991
  req.responseCb (new ResponseInvalidError ("OID '"
1986
1992
  + req.message.pdu.varbinds[reqIndex].oid
1987
- + "' in request at positiion '" + (reqIndex)
1993
+ + "' in request at position '" + (reqIndex)
1988
1994
  + "' does not precede OID '"
1989
1995
  + pdu.varbinds[respIndex].oid
1990
1996
  + "' in response at position '" + (respIndex) + "'",
@@ -2294,6 +2300,8 @@ Session.prototype.send = function (req, noWait) {
2294
2300
  };
2295
2301
 
2296
2302
  Session.prototype.set = function (varbinds, responseCb) {
2303
+ var reportOidMismatchErrors = this.reportOidMismatchErrors;
2304
+
2297
2305
  function feedCb (req, message) {
2298
2306
  var pdu = message.pdu;
2299
2307
  var varbinds = [];
@@ -2303,10 +2311,10 @@ Session.prototype.set = function (varbinds, responseCb) {
2303
2311
  + "match response OIDs", ResponseInvalidCode.EReqResOidNoMatch));
2304
2312
  } else {
2305
2313
  for (var i = 0; i < req.message.pdu.varbinds.length; i++) {
2306
- if (req.message.pdu.varbinds[i].oid != pdu.varbinds[i].oid) {
2314
+ if ( reportOidMismatchErrors && req.message.pdu.varbinds[i].oid != pdu.varbinds[i].oid ) {
2307
2315
  req.responseCb (new ResponseInvalidError ("OID '"
2308
2316
  + req.message.pdu.varbinds[i].oid
2309
- + "' in request at positiion '" + i + "' does not "
2317
+ + "' in request at position '" + i + "' does not "
2310
2318
  + "match OID '" + pdu.varbinds[i].oid + "' in response "
2311
2319
  + "at position '" + i + "'", ResponseInvalidCode.EReqResOidNoMatch));
2312
2320
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "net-snmp",
3
- "version": "3.6.3",
3
+ "version": "3.6.4",
4
4
  "description": "JavaScript implementation of the Simple Network Management Protocol (SNMP)",
5
5
  "main": "index.js",
6
6
  "directories": {