@tier0/node-red-contrib-opcda-client 1.0.7 → 1.0.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.
- package/node_modules/@tier0/node-dcom/dcom/ndr/ndrbuffer.js +10 -1
- package/node_modules/@tier0/node-dcom/dcom/rpc/defaultconnection.js +33 -5
- package/node_modules/@tier0/node-dcom/dcom/rpc/security/ntlm1.js +3 -3
- package/node_modules/@tier0/node-dcom/dcom/rpc/security/ntlmconnection.js +2 -2
- package/node_modules/@tier0/node-dcom/package.json +1 -1
- package/node_modules/@tier0/node-opc-da/package.json +5 -5
- package/node_modules/@tier0/node-opc-da/tier0-node-opc-da-1.0.10.tgz +0 -0
- package/package.json +48 -4
|
@@ -131,7 +131,10 @@ NdrBuffer.prototype.enc_ndr_small = function (s){
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
NdrBuffer.prototype.dec_ndr_small = function (){
|
|
134
|
-
|
|
134
|
+
if (this.index < 0 || this.index >= this.buf.length) {
|
|
135
|
+
throw new Error("NdrBuffer: dec_ndr_small out of range (index=" + this.index + ", bufLen=" + this.buf.length + ")");
|
|
136
|
+
}
|
|
137
|
+
let val = this.buf.readUInt8(this.index);
|
|
135
138
|
this.advance(1);
|
|
136
139
|
return val;
|
|
137
140
|
}
|
|
@@ -144,6 +147,9 @@ NdrBuffer.prototype.enc_ndr_short = function (s){
|
|
|
144
147
|
|
|
145
148
|
NdrBuffer.prototype.dec_ndr_short = function (){
|
|
146
149
|
this.align(2);
|
|
150
|
+
if (this.index < 0 || this.index + 2 > this.buf.length) {
|
|
151
|
+
throw new Error("NdrBuffer: dec_ndr_short out of range (index=" + this.index + ", bufLen=" + this.buf.length + ")");
|
|
152
|
+
}
|
|
147
153
|
let val = Encdec.dec_uint16le(this.buf,this.index);
|
|
148
154
|
this.advance(2);
|
|
149
155
|
return val;
|
|
@@ -157,6 +163,9 @@ NdrBuffer.prototype.enc_ndr_long = function (l){
|
|
|
157
163
|
|
|
158
164
|
NdrBuffer.prototype.dec_ndr_long = function (){
|
|
159
165
|
this.align(4);
|
|
166
|
+
if (this.index < 0 || this.index + 4 > this.buf.length) {
|
|
167
|
+
throw new Error("NdrBuffer: dec_ndr_long out of range (index=" + this.index + ", bufLen=" + this.buf.length + ")");
|
|
168
|
+
}
|
|
160
169
|
let val = Encdec.dec_uint32le(this.buf, this.index);
|
|
161
170
|
this.advance(4);
|
|
162
171
|
return val;
|
|
@@ -510,6 +510,9 @@ class DefaultConnection
|
|
|
510
510
|
const _pduHdr = new ConnectionOrientedPdu();
|
|
511
511
|
buffer.setIndex(_pduHdr.AUTH_LENGTH_OFFSET);
|
|
512
512
|
var length = buffer.dec_ndr_short();
|
|
513
|
+
if (length == 0) {
|
|
514
|
+
return null;
|
|
515
|
+
}
|
|
513
516
|
var index = 20;
|
|
514
517
|
buffer.setIndex(index);
|
|
515
518
|
var verifier = new AuthenticationVerifier(length);
|
|
@@ -520,9 +523,10 @@ class DefaultConnection
|
|
|
520
523
|
buffer.enc_ndr_short(length);
|
|
521
524
|
buffer.enc_ndr_short(0);
|
|
522
525
|
buffer.setIndex(length);
|
|
526
|
+
buffer.length = length;
|
|
523
527
|
return verifier;
|
|
524
528
|
}catch(e){
|
|
525
|
-
throw new Error("Error striping authentication from PDU");
|
|
529
|
+
throw new Error("Error striping authentication from PDU: " + (e.message || e));
|
|
526
530
|
}
|
|
527
531
|
}
|
|
528
532
|
|
|
@@ -536,6 +540,10 @@ class DefaultConnection
|
|
|
536
540
|
}
|
|
537
541
|
|
|
538
542
|
var index = buffer.getLength() - length - 8;
|
|
543
|
+
if (index < 0) {
|
|
544
|
+
debug("detachAuthentication: invalid auth trailer position (index=%d, authLen=%d, bufLen=%d)", index, length, buffer.getLength());
|
|
545
|
+
return null;
|
|
546
|
+
}
|
|
539
547
|
buffer.setIndex(index);
|
|
540
548
|
var verifier = new AuthenticationVerifier(length);
|
|
541
549
|
verifier.decode(this.ndr, buffer);
|
|
@@ -545,10 +553,11 @@ class DefaultConnection
|
|
|
545
553
|
buffer.enc_ndr_short(length);
|
|
546
554
|
buffer.enc_ndr_short(0);
|
|
547
555
|
buffer.setIndex(length);
|
|
556
|
+
buffer.length = length;
|
|
548
557
|
|
|
549
558
|
return verifier;
|
|
550
559
|
} catch (e) {
|
|
551
|
-
throw new Error("Error striping authentication from PDU.
|
|
560
|
+
throw new Error("Error striping authentication from PDU: " + (e.message || e));
|
|
552
561
|
}
|
|
553
562
|
}
|
|
554
563
|
|
|
@@ -614,6 +623,7 @@ class DefaultConnection
|
|
|
614
623
|
{
|
|
615
624
|
const _pdu = new ConnectionOrientedPdu();
|
|
616
625
|
var buffer = ndr.getBuffer();
|
|
626
|
+
var bufLen = buffer.getLength();
|
|
617
627
|
buffer.setIndex(_pdu.AUTH_LENGTH_OFFSET);
|
|
618
628
|
|
|
619
629
|
var verifierLength = ndr.readUnsignedShort();
|
|
@@ -621,7 +631,12 @@ class DefaultConnection
|
|
|
621
631
|
return;
|
|
622
632
|
}
|
|
623
633
|
|
|
624
|
-
var verifierIndex =
|
|
634
|
+
var verifierIndex = bufLen - verifierLength;
|
|
635
|
+
if (verifierIndex < _pdu.HEADER_LENGTH + 8 || verifierIndex > bufLen) {
|
|
636
|
+
debug("verifyAndUnseal: invalid verifierIndex=%d (verifierLength=%d, bufLen=%d)", verifierIndex, verifierLength, bufLen);
|
|
637
|
+
return;
|
|
638
|
+
}
|
|
639
|
+
|
|
625
640
|
var length = verifierIndex - 8;
|
|
626
641
|
var index = _pdu.HEADER_LENGTH;
|
|
627
642
|
|
|
@@ -649,6 +664,11 @@ class DefaultConnection
|
|
|
649
664
|
}
|
|
650
665
|
length = length - index;
|
|
651
666
|
|
|
667
|
+
if (length < 0) {
|
|
668
|
+
debug("verifyAndUnseal: negative data length=%d (index=%d, verifierIndex=%d)", length, index, verifierIndex);
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
671
|
+
|
|
652
672
|
var isFragmented = true;
|
|
653
673
|
buffer.setIndex(_pdu.FLAGS_OFFSET);
|
|
654
674
|
var flags = ndr.readUnsignedSmall();
|
|
@@ -658,8 +678,16 @@ class DefaultConnection
|
|
|
658
678
|
}
|
|
659
679
|
|
|
660
680
|
this.security.processIncoming(ndr, index, length, verifierIndex, isFragmented);
|
|
661
|
-
|
|
662
|
-
|
|
681
|
+
|
|
682
|
+
var padLengthOffset = verifierIndex - 6;
|
|
683
|
+
if (padLengthOffset < 0 || padLengthOffset >= buffer.buf.length) {
|
|
684
|
+
debug("verifyAndUnseal: invalid padLengthOffset=%d (verifierIndex=%d, bufLen=%d)", padLengthOffset, verifierIndex, buffer.buf.length);
|
|
685
|
+
length = verifierIndex - 8;
|
|
686
|
+
} else {
|
|
687
|
+
buffer.setIndex(padLengthOffset);
|
|
688
|
+
length = verifierIndex - ndr.readUnsignedSmall() - 8;
|
|
689
|
+
}
|
|
690
|
+
|
|
663
691
|
buffer.setIndex(_pdu.FRAG_LENGTH_OFFSET);
|
|
664
692
|
ndr.writeUnsignedShort(length);
|
|
665
693
|
ndr.writeUnsignedShort(0);
|
|
@@ -77,14 +77,14 @@ class Ntlm1
|
|
|
77
77
|
buffer.setIndex(verifierIndex);
|
|
78
78
|
|
|
79
79
|
let signing = new Array(16);
|
|
80
|
-
ndr.readOctetArray(signing, 0, signing.length);
|
|
80
|
+
signing = ndr.readOctetArray(signing, 0, signing.length);
|
|
81
81
|
|
|
82
|
-
if (signing.every(b => b === 0)) {
|
|
82
|
+
if (Buffer.isBuffer(signing) && signing.every(b => b === 0)) {
|
|
83
83
|
this.responseCounter++;
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
if (this.keyFactory.compareSignature(verifier, signing)) {
|
|
87
|
+
if (this.keyFactory.compareSignature(verifier, Array.isArray(signing) ? signing : [...signing])) {
|
|
88
88
|
throw new Error("Message out of sequence. Perhaps the user being used to run this application is different from the one under which the COM server is running.");
|
|
89
89
|
}
|
|
90
90
|
|
|
@@ -25,13 +25,13 @@ class NTLMConnection extends DefaultConnection
|
|
|
25
25
|
setTransmitLength(transmitLength)
|
|
26
26
|
{
|
|
27
27
|
this.transmitLength = transmitLength;
|
|
28
|
-
this.transmitBuffer = new NdrBuffer(
|
|
28
|
+
this.transmitBuffer = new NdrBuffer(new Array(transmitLength), 0);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
setReceiveLength(receiveLength)
|
|
32
32
|
{
|
|
33
33
|
this.receiveLength = receiveLength;
|
|
34
|
-
this.receiveBuffer = new NdrBuffer(
|
|
34
|
+
this.receiveBuffer = new NdrBuffer(new Array(receiveLength), 0);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
incomingRebind(verifier)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tier0/node-opc-da",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "An implementation of the OPC DA Specification for Node.js",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@tier0/node-dcom": "1.2.
|
|
27
|
-
"
|
|
28
|
-
"
|
|
26
|
+
"@tier0/node-dcom": "file:../node-dcom/tier0-node-dcom-1.2.3.tgz",
|
|
27
|
+
"long": "^4.0.0",
|
|
28
|
+
"random": "^2.1.1"
|
|
29
29
|
}
|
|
30
|
-
}
|
|
30
|
+
}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tier0/node-red-contrib-opcda-client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Node-RED OPC DA Reading and Writing Node",
|
|
5
5
|
"node-red": {
|
|
6
6
|
"nodes": {
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@tier0/node-dcom": "1.2.
|
|
47
|
-
"@tier0/node-opc-da": "1.0.
|
|
46
|
+
"@tier0/node-dcom": "file:../node-dcom/tier0-node-dcom-1.2.3.tgz",
|
|
47
|
+
"@tier0/node-opc-da": "file:../node-opc-da/tier0-node-opc-da-1.0.11.tgz"
|
|
48
48
|
},
|
|
49
49
|
"bundledDependencies": [
|
|
50
50
|
"babel-runtime",
|
|
@@ -89,5 +89,49 @@
|
|
|
89
89
|
"x-mac-cyrillic",
|
|
90
90
|
"@tier0/node-dcom",
|
|
91
91
|
"@tier0/node-opc-da"
|
|
92
|
+
],
|
|
93
|
+
"bundleDependencies": [
|
|
94
|
+
"babel-runtime",
|
|
95
|
+
"bytebuffer",
|
|
96
|
+
"core-js",
|
|
97
|
+
"hashcode",
|
|
98
|
+
"hashmap",
|
|
99
|
+
"iconv-lite",
|
|
100
|
+
"ip",
|
|
101
|
+
"iso-8859-15",
|
|
102
|
+
"iso-8859-2",
|
|
103
|
+
"iso-8859-3",
|
|
104
|
+
"iso-8859-4",
|
|
105
|
+
"iso-8859-5",
|
|
106
|
+
"iso-8859-6",
|
|
107
|
+
"iso-8859-7",
|
|
108
|
+
"iso-8859-8",
|
|
109
|
+
"iso-8859-8-i",
|
|
110
|
+
"jconv",
|
|
111
|
+
"js-md4",
|
|
112
|
+
"koi8-r",
|
|
113
|
+
"legacy-encoding",
|
|
114
|
+
"long",
|
|
115
|
+
"macintosh",
|
|
116
|
+
"object-hash",
|
|
117
|
+
"ow",
|
|
118
|
+
"ow-lite",
|
|
119
|
+
"random",
|
|
120
|
+
"regenerator-runtime",
|
|
121
|
+
"safer-buffer",
|
|
122
|
+
"seedrandom",
|
|
123
|
+
"windows-1250",
|
|
124
|
+
"windows-1251",
|
|
125
|
+
"windows-1252",
|
|
126
|
+
"windows-1253",
|
|
127
|
+
"windows-1254",
|
|
128
|
+
"windows-1255",
|
|
129
|
+
"windows-1256",
|
|
130
|
+
"windows-1257",
|
|
131
|
+
"windows-1258",
|
|
132
|
+
"windows-874",
|
|
133
|
+
"x-mac-cyrillic",
|
|
134
|
+
"@tier0/node-dcom",
|
|
135
|
+
"@tier0/node-opc-da"
|
|
92
136
|
]
|
|
93
|
-
}
|
|
137
|
+
}
|