net-snmp 3.5.2 → 3.5.6

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 +20 -5
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -3142,6 +3142,22 @@ Example programs are included under the module's `example` directory.
3142
3142
 
3143
3143
  * Fix MIB table index handling of Buffer type
3144
3144
 
3145
+ ## Version 3.5.3 - 22/08/2021
3146
+
3147
+ * Fix error with empty varbind array in walk
3148
+
3149
+ ## Version 3.5.4 - 24/08/2021
3150
+
3151
+ * Align accessible-for-notify row cell behaviour with not-accessible behaviour
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
+
3145
3161
  # License
3146
3162
 
3147
3163
  Copyright (c) 2020 Mark Abrahams <mark@abrahams.co.nz>
package/index.js CHANGED
@@ -1923,6 +1923,7 @@ Session.prototype.getBulk = function () {
1923
1923
  + "response '" + pdu.varbinds.length + "' is less than "
1924
1924
  + "non-repeaters '" + nonRepeaters + "' in request",
1925
1925
  ResponseInvalidCode.ENonRepeaterCountMismatch));
1926
+ return;
1926
1927
  } else {
1927
1928
  for ( ; i < nonRepeaters; i++) {
1928
1929
  if (isVarbindError (pdu.varbinds[i])) {
@@ -2641,7 +2642,12 @@ function walkCb (req, error, varbinds) {
2641
2642
  }
2642
2643
  }
2643
2644
 
2644
- if (this.version == Version2c || this.version == Version3 ) {
2645
+ if ( ! varbinds.length ) {
2646
+ req.doneCb(null);
2647
+ return;
2648
+ }
2649
+
2650
+ if (this.version == Version2c || this.version == Version3) {
2645
2651
  for (var i = varbinds[0].length; i > 0; i--) {
2646
2652
  if (varbinds[0][i - 1].type == ObjectType.EndOfMibView) {
2647
2653
  varbinds[0].pop ();
@@ -3486,7 +3492,7 @@ MibNode.prototype.findChildImmediatelyBefore = function (index) {
3486
3492
  }
3487
3493
  }
3488
3494
  }
3489
- return this.children[sortedChildrenKeys[sortedChildrenKeys.length]];
3495
+ return this.children[sortedChildrenKeys[sortedChildrenKeys.length - 1]];
3490
3496
  };
3491
3497
 
3492
3498
  MibNode.prototype.isDescendant = function (address) {
@@ -3818,7 +3824,16 @@ Mib.prototype.getTreeNode = function (oid) {
3818
3824
  var last = address.pop ();
3819
3825
  var parent = this.lookupAddress (address);
3820
3826
  if ( parent ) {
3821
- return (parent.findChildImmediatelyBefore (last) || parent);
3827
+ node = parent.findChildImmediatelyBefore (last);
3828
+ if ( !node )
3829
+ return parent;
3830
+ while ( true ) {
3831
+ // Find the last descendant
3832
+ var childrenAddresses = Object.keys (node.children).sort ( (a, b) => a - b);
3833
+ if ( childrenAddresses.length == 0 )
3834
+ return node;
3835
+ node = node.children[childrenAddresses[childrenAddresses.length - 1]];
3836
+ }
3822
3837
  }
3823
3838
  }
3824
3839
  return this.root;
@@ -4198,8 +4213,8 @@ Mib.prototype.addTableRow = function (table, row) {
4198
4213
  for ( var i = 0; i < provider.tableColumns.length ; i++ ) {
4199
4214
  var column = provider.tableColumns[i];
4200
4215
  var isColumnIndex = provider.tableIndex.some ( indexPart => indexPart.columnNumber == column.number );
4201
- // prevent not-accessible index entries from being added as columns in the row
4202
- if ( ! isColumnIndex || column.maxAccess !== MaxAccess['not-accessible'] ) {
4216
+ // prevent not-accessible and accessible-for-notify index entries from being added as columns in the row
4217
+ if ( ! isColumnIndex || ! (column.maxAccess === MaxAccess['not-accessible'] || column.maxAccess === MaxAccess['accessible-for-notify']) ) {
4203
4218
  instanceAddress = providerNode.address.concat (column.number).concat (instance);
4204
4219
  this.addNodesForAddress (instanceAddress);
4205
4220
  instanceNode = this.lookup (instanceAddress);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "net-snmp",
3
- "version": "3.5.2",
3
+ "version": "3.5.6",
4
4
  "description": "JavaScript implementation of the Simple Network Management Protocol (SNMP)",
5
5
  "main": "index.js",
6
6
  "directories": {