net-snmp 3.18.2 → 3.19.0
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/README.md +4 -0
- package/index.js +2 -2
- package/package.json +1 -1
- package/test/object-types.test.js +16 -0
package/README.md
CHANGED
@@ -3461,6 +3461,10 @@ Example programs are included under the module's `example` directory.
|
|
3461
3461
|
|
3462
3462
|
* Add conversion of scalar defVal enumeration name to number on assignment
|
3463
3463
|
|
3464
|
+
## Version 3.19.0 - 06/02/2025
|
3465
|
+
|
3466
|
+
* Remove deprecated isArray call and fix agent string constraints check
|
3467
|
+
|
3464
3468
|
# License
|
3465
3469
|
|
3466
3470
|
Copyright (c) 2020 Mark Abrahams <mark@abrahams.co.nz>
|
package/index.js
CHANGED
@@ -682,7 +682,7 @@ ObjectTypeUtil.isValid = function (type, value, constraints) {
|
|
682
682
|
if ( typeof value != "string" && ! (value instanceof Buffer) ) {
|
683
683
|
return false;
|
684
684
|
}
|
685
|
-
if ( constraints && ObjectTypeUtil.doesStringMeetConstraints (value, constraints) ) {
|
685
|
+
if ( constraints && ! ObjectTypeUtil.doesStringMeetConstraints (value, constraints) ) {
|
686
686
|
return false;
|
687
687
|
}
|
688
688
|
return true;
|
@@ -4723,7 +4723,7 @@ Mib.convertOidToAddress = function (oid) {
|
|
4723
4723
|
var oidArray;
|
4724
4724
|
var i;
|
4725
4725
|
|
4726
|
-
if (typeof (oid) === 'object' &&
|
4726
|
+
if (typeof (oid) === 'object' && Array.isArray(oid)) {
|
4727
4727
|
address = oid;
|
4728
4728
|
} else if (typeof (oid) === 'string') {
|
4729
4729
|
address = oid.split('.');
|
package/package.json
CHANGED
@@ -85,6 +85,22 @@ describe('Object Types', function() {
|
|
85
85
|
assert.equal(snmp.ObjectTypeUtil.isValid(snmp.ObjectType.OctetString, Buffer.from('1.3.6.1.2.3.4.5')), true);
|
86
86
|
});
|
87
87
|
});
|
88
|
+
describe('A string with a length of 6 is valid for a size range of 2 - 7', function() {
|
89
|
+
it('returns true', function() {
|
90
|
+
const sizes = [
|
91
|
+
{ min: 2, max: 7 },
|
92
|
+
];
|
93
|
+
assert.equal(snmp.ObjectTypeUtil.isValid(snmp.ObjectType.OctetString, 'sixlet', { sizes }), true);
|
94
|
+
});
|
95
|
+
});
|
96
|
+
describe('A string with a length of 6 is not valid for a size range of 2 - 5', function() {
|
97
|
+
it('returns true', function() {
|
98
|
+
const sizes = [
|
99
|
+
{ min: 2, max: 5 },
|
100
|
+
];
|
101
|
+
assert.equal(snmp.ObjectTypeUtil.isValid(snmp.ObjectType.OctetString, 'sixlet', { sizes }), false);
|
102
|
+
});
|
103
|
+
});
|
88
104
|
});
|
89
105
|
|
90
106
|
describe('isValid() - OID', function() {
|