net-snmp 3.5.4 → 3.5.8

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.
Files changed (3) hide show
  1. package/README.md +16 -0
  2. package/index.js +21 -9
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -3150,6 +3150,22 @@ Example programs are included under the module's `example` directory.
3150
3150
 
3151
3151
  * Align accessible-for-notify row cell behaviour with not-accessible behaviour
3152
3152
 
3153
+ ## Version 3.5.5 - 29/09/2021
3154
+
3155
+ * Add missing return in getbulk feedCb callback non-repeaters error condition
3156
+
3157
+ ## Version 3.5.6 - 20/10/2021
3158
+
3159
+ * Fix GetNext OID calculation for off-tree OIDs
3160
+
3161
+ ## Version 3.5.7 - 20/11/2021
3162
+
3163
+ * Fix handing of null varbinds in walk
3164
+
3165
+ ## Version 3.5.8 - 24/11/2021
3166
+
3167
+ * Fix processing of negative integers larger than 32 bits
3168
+
3153
3169
  # License
3154
3170
 
3155
3171
  Copyright (c) 2020 Mark Abrahams <mark@abrahams.co.nz>
package/index.js CHANGED
@@ -427,14 +427,16 @@ function readUint (buffer, isSigned) {
427
427
  value *= 256;
428
428
  value += buffer.readByte ();
429
429
 
430
- if (isSigned && i <= 0) {
431
- if ((value & 0x80) == 0x80)
432
- signedBitSet = true;
433
- }
430
+ if (isSigned && i <= 0) {
431
+ if ((value & 0x80) == 0x80) {
432
+ signedBitSet = true;
433
+ }
434
+ }
434
435
  }
435
436
 
436
- if (signedBitSet)
437
- value -= (1 << (i * 8));
437
+ if (signedBitSet) {
438
+ value -= 2 ** (i * 8);
439
+ }
438
440
 
439
441
  return value;
440
442
  }
@@ -1923,6 +1925,7 @@ Session.prototype.getBulk = function () {
1923
1925
  + "response '" + pdu.varbinds.length + "' is less than "
1924
1926
  + "non-repeaters '" + nonRepeaters + "' in request",
1925
1927
  ResponseInvalidCode.ENonRepeaterCountMismatch));
1928
+ return;
1926
1929
  } else {
1927
1930
  for ( ; i < nonRepeaters; i++) {
1928
1931
  if (isVarbindError (pdu.varbinds[i])) {
@@ -2641,7 +2644,7 @@ function walkCb (req, error, varbinds) {
2641
2644
  }
2642
2645
  }
2643
2646
 
2644
- if ( ! varbinds.length ) {
2647
+ if ( ! varbinds || ! varbinds.length ) {
2645
2648
  req.doneCb(null);
2646
2649
  return;
2647
2650
  }
@@ -3491,7 +3494,7 @@ MibNode.prototype.findChildImmediatelyBefore = function (index) {
3491
3494
  }
3492
3495
  }
3493
3496
  }
3494
- return this.children[sortedChildrenKeys[sortedChildrenKeys.length]];
3497
+ return this.children[sortedChildrenKeys[sortedChildrenKeys.length - 1]];
3495
3498
  };
3496
3499
 
3497
3500
  MibNode.prototype.isDescendant = function (address) {
@@ -3823,7 +3826,16 @@ Mib.prototype.getTreeNode = function (oid) {
3823
3826
  var last = address.pop ();
3824
3827
  var parent = this.lookupAddress (address);
3825
3828
  if ( parent ) {
3826
- return (parent.findChildImmediatelyBefore (last) || parent);
3829
+ node = parent.findChildImmediatelyBefore (last);
3830
+ if ( !node )
3831
+ return parent;
3832
+ while ( true ) {
3833
+ // Find the last descendant
3834
+ var childrenAddresses = Object.keys (node.children).sort ( (a, b) => a - b);
3835
+ if ( childrenAddresses.length == 0 )
3836
+ return node;
3837
+ node = node.children[childrenAddresses[childrenAddresses.length - 1]];
3838
+ }
3827
3839
  }
3828
3840
  }
3829
3841
  return this.root;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "net-snmp",
3
- "version": "3.5.4",
3
+ "version": "3.5.8",
4
4
  "description": "JavaScript implementation of the Simple Network Management Protocol (SNMP)",
5
5
  "main": "index.js",
6
6
  "directories": {