oracledb 6.7.2 → 6.8.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/LICENSE.txt +1 -1
- package/NOTICE.txt +1 -1
- package/README.md +2 -2
- package/build/Release/oracledb-6.8.0-darwin-arm64.node +0 -0
- package/build/Release/oracledb-6.8.0-darwin-arm64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.8.0-darwin-x64.node +0 -0
- package/build/Release/oracledb-6.8.0-darwin-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.8.0-js-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.8.0-linux-arm64.node +0 -0
- package/build/Release/oracledb-6.8.0-linux-arm64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.8.0-linux-x64.node +0 -0
- package/build/Release/oracledb-6.8.0-linux-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.8.0-win32-x64.node +0 -0
- package/build/Release/oracledb-6.8.0-win32-x64.node-buildinfo.txt +1 -0
- package/lib/connection.js +66 -2
- package/lib/dbObject.js +42 -10
- package/lib/errors.js +96 -13
- package/lib/impl/connection.js +15 -1
- package/lib/impl/datahandlers/buffer.js +92 -1
- package/lib/impl/datahandlers/constants.js +2 -0
- package/lib/impl/datahandlers/oson.js +15 -1
- package/lib/impl/datahandlers/vector.js +72 -27
- package/lib/oracledb.js +80 -4
- package/lib/settings.js +5 -1
- package/lib/thin/connection.js +13 -2
- package/lib/thin/dbObject.js +38 -7
- package/lib/thin/pool.js +7 -3
- package/lib/thin/protocol/capabilities.js +1 -1
- package/lib/thin/protocol/constants.js +2 -0
- package/lib/thin/protocol/messages/auth.js +29 -6
- package/lib/thin/protocol/messages/fastAuth.js +6 -1
- package/lib/thin/protocol/messages/withData.js +10 -1
- package/lib/thin/protocol/packet.js +1 -1
- package/lib/thin/sqlnet/ANO.js +438 -0
- package/lib/thin/sqlnet/constants.js +5 -1
- package/lib/thin/sqlnet/ezConnectResolver.js +4 -2
- package/lib/thin/sqlnet/navNodes.js +21 -2
- package/lib/thin/sqlnet/networkSession.js +88 -16
- package/lib/thin/sqlnet/ntTcp.js +50 -3
- package/lib/thin/sqlnet/packet.js +31 -4
- package/lib/thin/sqlnet/sessionAtts.js +25 -2
- package/lib/thin/util.js +3 -8
- package/lib/transformer.js +13 -2
- package/lib/types.js +220 -3
- package/lib/util.js +1 -1
- package/lib/version.js +2 -2
- package/package.json +1 -1
- package/plugins/token/extensionAzure/index.js +101 -0
- package/plugins/token/extensionOci/index.js +174 -0
- package/build/Release/oracledb-6.7.2-darwin-arm64.node +0 -0
- package/build/Release/oracledb-6.7.2-darwin-arm64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.7.2-darwin-x64.node +0 -0
- package/build/Release/oracledb-6.7.2-darwin-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.7.2-js-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.7.2-linux-arm64.node +0 -0
- package/build/Release/oracledb-6.7.2-linux-arm64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.7.2-linux-x64.node +0 -0
- package/build/Release/oracledb-6.7.2-linux-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.7.2-win32-x64.node +0 -0
- package/build/Release/oracledb-6.7.2-win32-x64.node-buildinfo.txt +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2022,
|
|
1
|
+
// Copyright (c) 2022, 2025, Oracle and/or its affiliates.
|
|
2
2
|
|
|
3
3
|
//-----------------------------------------------------------------------------
|
|
4
4
|
//
|
|
@@ -280,6 +280,7 @@ class MessageWithData extends Message {
|
|
|
280
280
|
if (!(vectorFlags & constants.VECTOR_META_FLAG_FLEXIBLE_DIM)) {
|
|
281
281
|
fetchInfo.vectorDimensions = dimensions;
|
|
282
282
|
}
|
|
283
|
+
fetchInfo.isSparseVector = Boolean(vectorFlags & constants.VECTOR_META_FLAG_SPARSE);
|
|
283
284
|
if (vectorFormat !== constants.VECTOR_FORMAT_FLEX) {
|
|
284
285
|
fetchInfo.vectorFormat = vectorFormat;
|
|
285
286
|
}
|
|
@@ -501,6 +502,10 @@ class MessageWithData extends Message {
|
|
|
501
502
|
}
|
|
502
503
|
} else if (oraTypeNum === constants.TNS_DATA_TYPE_BOOLEAN) {
|
|
503
504
|
colValue = buf.readBool();
|
|
505
|
+
} else if (oraTypeNum === constants.TNS_DATA_TYPE_INTERVAL_YM) {
|
|
506
|
+
colValue = buf.readOracleIntervalYM();
|
|
507
|
+
} else if (oraTypeNum === constants.TNS_DATA_TYPE_INTERVAL_DS) {
|
|
508
|
+
colValue = buf.readOracleIntervalDS();
|
|
504
509
|
} else if (
|
|
505
510
|
oraTypeNum === constants.TNS_DATA_TYPE_CLOB ||
|
|
506
511
|
oraTypeNum === constants.TNS_DATA_TYPE_BLOB ||
|
|
@@ -861,6 +866,10 @@ class MessageWithData extends Message {
|
|
|
861
866
|
} else {
|
|
862
867
|
buf.writeUInt16BE(0x0100);
|
|
863
868
|
}
|
|
869
|
+
} else if (oraTypeNum === constants.TNS_DATA_TYPE_INTERVAL_YM) {
|
|
870
|
+
buf.writeOracleIntervalYM(value);
|
|
871
|
+
} else if (oraTypeNum === constants.TNS_DATA_TYPE_INTERVAL_DS) {
|
|
872
|
+
buf.writeOracleIntervalDS(value);
|
|
864
873
|
} else if (
|
|
865
874
|
oraTypeNum === constants.TNS_DATA_TYPE_CLOB ||
|
|
866
875
|
oraTypeNum === constants.TNS_DATA_TYPE_BLOB ||
|
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
// Copyright (c) 2022, 2025, Oracle and/or its affiliates.
|
|
2
|
+
|
|
3
|
+
//-----------------------------------------------------------------------------
|
|
4
|
+
//
|
|
5
|
+
// This software is dual-licensed to you under the Universal Permissive License
|
|
6
|
+
// (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
|
|
7
|
+
// 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose
|
|
8
|
+
// either license.
|
|
9
|
+
//
|
|
10
|
+
// If you elect to accept the software under the Apache License, Version 2.0,
|
|
11
|
+
// the following applies:
|
|
12
|
+
//
|
|
13
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
14
|
+
// you may not use this file except in compliance with the License.
|
|
15
|
+
// You may obtain a copy of the License at
|
|
16
|
+
//
|
|
17
|
+
// https://www.apache.org/licenses/LICENSE-2.0
|
|
18
|
+
//
|
|
19
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
20
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
21
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
22
|
+
// See the License for the specific language governing permissions and
|
|
23
|
+
// limitations under the License.
|
|
24
|
+
//
|
|
25
|
+
//-----------------------------------------------------------------------------
|
|
26
|
+
|
|
27
|
+
'use strict';
|
|
28
|
+
|
|
29
|
+
const errors = require("../../errors.js");
|
|
30
|
+
const constants = require("./constants.js");
|
|
31
|
+
|
|
32
|
+
const AUTHENTICATION = 1;
|
|
33
|
+
const ENCRYPTION = 2;
|
|
34
|
+
const DATAINTEGRITY = 3;
|
|
35
|
+
const SUPERVISOR = 4;
|
|
36
|
+
|
|
37
|
+
const MAGIC = 0xdeadbeef;
|
|
38
|
+
|
|
39
|
+
const NO_ERROR = 0;
|
|
40
|
+
const SUPERVISOR_OK = 0x1f;
|
|
41
|
+
const AUTHENTICATION_OK = 0xfaff;
|
|
42
|
+
const AUTHENTICATION_DONT_USE_AUTH = 0xfbff;
|
|
43
|
+
|
|
44
|
+
const HEADER_SIZE = 4 + 2 + 4 + 2 + 1; /* magic + length + version + services + flag */
|
|
45
|
+
const SERVICE_HEADER_SIZE = 2 + 2 + 4; /* service type + no of subpackets + error */
|
|
46
|
+
const ARRAY_PACKET_SIZE = 4 + 2 + 4; /* magic + ub2 + ub4 */
|
|
47
|
+
const SUBPACKET_SIZE = 4;
|
|
48
|
+
|
|
49
|
+
const VERSION_LENGTH = 4;
|
|
50
|
+
const VERSION = 0x17700000 ; /* Version 23.7.0.0.0 */
|
|
51
|
+
|
|
52
|
+
const STRING_TYPE = 0;
|
|
53
|
+
const RAW_TYPE = 1;
|
|
54
|
+
const UB1_TYPE = 2;
|
|
55
|
+
const UB2_TYPE = 3;
|
|
56
|
+
const VERSION_TYPE = 5;
|
|
57
|
+
const STATUS_TYPE = 6;
|
|
58
|
+
|
|
59
|
+
const CID_SIZE = 8;
|
|
60
|
+
|
|
61
|
+
const CLIENT_SERVER = 0xe0e1; /* cli/svr connection */
|
|
62
|
+
const AUTH_NOT_REQUIRED = 0xfcff; /* Auth. not required */
|
|
63
|
+
const AUTH_TCPS_ID = 2;
|
|
64
|
+
const AUTH_TCPS_NAME = "tcps";
|
|
65
|
+
|
|
66
|
+
const serviceMap = [-1, 0, 1, 2, 3];
|
|
67
|
+
|
|
68
|
+
class NetworkService {
|
|
69
|
+
|
|
70
|
+
constructor(sAtts) {
|
|
71
|
+
this.flags = constants.NSINAWANTED;
|
|
72
|
+
this.sAtts = sAtts;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
getDataSize() {
|
|
76
|
+
return SERVICE_HEADER_SIZE + SUBPACKET_SIZE + VERSION_LENGTH + SUBPACKET_SIZE;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
sendHeader(buf, pos) {
|
|
80
|
+
pos = buf.writeUInt16BE(this.service, pos);
|
|
81
|
+
pos = buf.writeUInt16BE(this.numSubPackets, pos);
|
|
82
|
+
pos = buf.writeUInt32BE(0, pos);
|
|
83
|
+
return pos;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
sendVersion(buf, pos) {
|
|
87
|
+
pos = buf.writeUInt16BE(4, pos);
|
|
88
|
+
pos = buf.writeUInt16BE(VERSION_TYPE, pos);
|
|
89
|
+
pos = buf.writeUInt32BE(VERSION, pos);
|
|
90
|
+
return pos;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
sendRaw(buf, rawData, length, pos) {
|
|
94
|
+
pos = buf.writeUInt16BE(length, pos);
|
|
95
|
+
pos = buf.writeUInt16BE(RAW_TYPE, pos);
|
|
96
|
+
pos += rawData.copy(buf, pos, 0, length);
|
|
97
|
+
return pos;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
sendArray(buf, array, pos) {
|
|
101
|
+
pos = buf.writeUInt16BE(ARRAY_PACKET_SIZE + array.length * 2, pos);
|
|
102
|
+
pos = buf.writeUInt16BE(RAW_TYPE, pos);
|
|
103
|
+
pos = buf.writeUInt32BE(MAGIC, pos);
|
|
104
|
+
pos = buf.writeUInt16BE(UB2_TYPE, pos);
|
|
105
|
+
pos = buf.writeUInt32BE(array.length, pos);
|
|
106
|
+
for (let i = 0; i < array.length; i++) {
|
|
107
|
+
pos = buf.writeUInt16BE(array[i], pos);
|
|
108
|
+
}
|
|
109
|
+
return pos;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
sendStatus(buf, status, pos) {
|
|
113
|
+
pos = buf.writeUInt16BE(2, pos);
|
|
114
|
+
pos = buf.writeUInt16BE(STATUS_TYPE, pos);
|
|
115
|
+
pos = buf.writeUInt16BE(status, pos);
|
|
116
|
+
return pos;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
sendString(buf, string, pos) {
|
|
120
|
+
pos = buf.writeUInt16BE(string.length, pos);
|
|
121
|
+
pos = buf.writeUInt16BE(STRING_TYPE, pos);
|
|
122
|
+
pos += buf.write(string, pos);
|
|
123
|
+
return pos;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
sendUB1(buf, data, pos) {
|
|
127
|
+
pos = buf.writeUInt16BE(1, pos);
|
|
128
|
+
pos = buf.writeUInt16BE(UB1_TYPE, pos);
|
|
129
|
+
pos = buf.writeUInt8(data, pos);
|
|
130
|
+
return pos;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
sendUB2(buf, data, pos) {
|
|
134
|
+
pos = buf.writeUInt16BE(2, pos);
|
|
135
|
+
pos = buf.writeUInt16BE(UB2_TYPE, pos);
|
|
136
|
+
pos = buf.writeUInt16BE(data, pos);
|
|
137
|
+
return pos;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
static receiveHeader(pkt, ret, pos) {
|
|
141
|
+
ret[0] = pkt.readUInt16BE(pos);
|
|
142
|
+
pos += 2;
|
|
143
|
+
ret[1] = pkt.readUInt16BE(pos);
|
|
144
|
+
pos += 2;
|
|
145
|
+
ret[2] = pkt.readUInt32BE(pos);
|
|
146
|
+
pos += 4;
|
|
147
|
+
|
|
148
|
+
return pos;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
receiveType(pkt, type, ret, pos) {
|
|
152
|
+
const len = pkt.readUInt16BE(pos);
|
|
153
|
+
pos += 2;
|
|
154
|
+
const receivedType = pkt.readUInt16BE(pos);
|
|
155
|
+
pos += 2;
|
|
156
|
+
|
|
157
|
+
if (receivedType != type) {
|
|
158
|
+
errors.throwErr(errors.ERR_ANO_PACKET);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
let version, status;
|
|
162
|
+
switch (type) {
|
|
163
|
+
case VERSION_TYPE:
|
|
164
|
+
version = pkt.readUInt32BE(pos);
|
|
165
|
+
pos += 4;
|
|
166
|
+
ret[0] = version;
|
|
167
|
+
return pos;
|
|
168
|
+
case STATUS_TYPE:
|
|
169
|
+
status = pkt.readUInt16BE(pos);
|
|
170
|
+
pos += 2;
|
|
171
|
+
ret[0] = status;
|
|
172
|
+
return pos;
|
|
173
|
+
case RAW_TYPE:
|
|
174
|
+
ret[0] = len;
|
|
175
|
+
return pos;
|
|
176
|
+
case STRING_TYPE:
|
|
177
|
+
ret[0] = len;
|
|
178
|
+
return pos;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
receiveUB2Array(pkt, ret, pos) {
|
|
183
|
+
const ret1 = [];
|
|
184
|
+
pos = this.receiveType(pkt, RAW_TYPE, ret1, pos);
|
|
185
|
+
|
|
186
|
+
if (pkt.readUInt32BE(pos) != MAGIC) {
|
|
187
|
+
errors.throwErr(errors.ERR_ANO_PACKET);
|
|
188
|
+
}
|
|
189
|
+
pos += 4;
|
|
190
|
+
|
|
191
|
+
const type = pkt.readUInt16BE(pos);
|
|
192
|
+
pos += 2;
|
|
193
|
+
|
|
194
|
+
if (type != UB2_TYPE) {
|
|
195
|
+
errors.throwErr(errors.ERR_ANO_PACKET);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const arrayLen = pkt.readUInt32BE(pos);
|
|
199
|
+
pos += 4;
|
|
200
|
+
|
|
201
|
+
for (let i = 0; i < arrayLen; i++) {
|
|
202
|
+
ret[i] = pkt.readUInt16BE(pos);
|
|
203
|
+
pos += 2;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return pos;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
receiveString(pkt, ret, pos) {
|
|
210
|
+
const ret1 = [];
|
|
211
|
+
pos = this.receiveType(pkt, STRING_TYPE, ret1, pos);
|
|
212
|
+
const string = pkt.toString('utf8', pos, pos + ret1[0]);
|
|
213
|
+
pos += ret1[0];
|
|
214
|
+
ret[0] = string;
|
|
215
|
+
return pos;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
receiveServiceData(pkt, numSubPakcets, pos) {
|
|
219
|
+
const ret = [];
|
|
220
|
+
ret[0] = pkt.readUInt16BE(pos);
|
|
221
|
+
pos += 2;
|
|
222
|
+
ret[1] = pkt.readUInt16BE(pos);
|
|
223
|
+
pos += 2;
|
|
224
|
+
ret[2] = pkt.readUInt32BE(pos);
|
|
225
|
+
pos += 4;
|
|
226
|
+
ret[3] = pkt.readUInt16BE(pos);
|
|
227
|
+
pos += 2;
|
|
228
|
+
ret[4] = pkt.readUInt16BE(pos);
|
|
229
|
+
pos += 2;
|
|
230
|
+
ret [5] = pkt.readUInt8(pos);
|
|
231
|
+
pos += 1;
|
|
232
|
+
|
|
233
|
+
return pos;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
class SupervisorService extends NetworkService {
|
|
238
|
+
|
|
239
|
+
constructor(sAtts) {
|
|
240
|
+
super(sAtts);
|
|
241
|
+
this.service = SUPERVISOR;
|
|
242
|
+
this.serviceList = [AUTHENTICATION, ENCRYPTION, DATAINTEGRITY, SUPERVISOR];
|
|
243
|
+
this.numSubPackets = 3; /* version, raw, services array */
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
getDataSize() {
|
|
247
|
+
return SERVICE_HEADER_SIZE + SUBPACKET_SIZE + VERSION_LENGTH +
|
|
248
|
+
SUBPACKET_SIZE + CID_SIZE + SUBPACKET_SIZE +
|
|
249
|
+
ARRAY_PACKET_SIZE + this.serviceList.length * 2;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
sendServiceData(buf, pos) {
|
|
253
|
+
pos = this.sendHeader(buf, pos);
|
|
254
|
+
pos = this.sendVersion(buf, pos);
|
|
255
|
+
pos = this.sendRaw(buf, Buffer.from(this.sAtts.uuid, "base64"), 8, pos);
|
|
256
|
+
pos = this.sendArray(buf, this.serviceList, pos);
|
|
257
|
+
return pos;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
receiveServiceData(pkt, numSubPackets, pos) {
|
|
261
|
+
const serverServices = [], version = [], status = [];
|
|
262
|
+
pos = this.receiveType(pkt, VERSION_TYPE, version, pos);
|
|
263
|
+
pos = this.receiveType(pkt, STATUS_TYPE, status, pos);
|
|
264
|
+
if (status[0] != SUPERVISOR_OK) {
|
|
265
|
+
errors.throwErr(errors.ERR_ANO_STATUS, "Supervisor");
|
|
266
|
+
}
|
|
267
|
+
pos = this.receiveUB2Array(pkt, serverServices, pos);
|
|
268
|
+
return pos;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
class AuthenticationService extends NetworkService {
|
|
273
|
+
|
|
274
|
+
constructor(sAtts) {
|
|
275
|
+
super(sAtts);
|
|
276
|
+
this.service = AUTHENTICATION;
|
|
277
|
+
this.status = AUTH_NOT_REQUIRED;
|
|
278
|
+
this.numSubPackets = 3 + 1 * 2; /* We support only tcps */
|
|
279
|
+
this.serviceList = [AUTH_TCPS_NAME];
|
|
280
|
+
this.authActivated = false;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
getDataSize() {
|
|
284
|
+
let len = SERVICE_HEADER_SIZE + SUBPACKET_SIZE + VERSION_LENGTH +
|
|
285
|
+
SUBPACKET_SIZE + 2 + SUBPACKET_SIZE + 2;
|
|
286
|
+
|
|
287
|
+
for (let i = 0; i < this.serviceList.length; i++) {
|
|
288
|
+
len += SUBPACKET_SIZE + 1;
|
|
289
|
+
len += SUBPACKET_SIZE + this.serviceList[i].length;
|
|
290
|
+
}
|
|
291
|
+
return len;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
sendServiceData(buf, pos) {
|
|
295
|
+
pos = this.sendHeader(buf, pos);
|
|
296
|
+
pos = this.sendVersion(buf, pos);
|
|
297
|
+
pos = this.sendUB2(buf, CLIENT_SERVER, pos);
|
|
298
|
+
pos = this.sendStatus(buf, this.status, pos);
|
|
299
|
+
|
|
300
|
+
/* send Auth drivers - we support only tcps */
|
|
301
|
+
pos = this.sendUB1(buf, AUTH_TCPS_ID, pos);
|
|
302
|
+
pos = this.sendString(buf, AUTH_TCPS_NAME, pos);
|
|
303
|
+
return pos;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
receiveServiceData(pkt, numSubPackets, pos) {
|
|
307
|
+
const version = [], status = [], service = [];
|
|
308
|
+
|
|
309
|
+
pos = this.receiveType(pkt, VERSION_TYPE, version, pos);
|
|
310
|
+
pos = this.receiveType(pkt, STATUS_TYPE, status, pos);
|
|
311
|
+
|
|
312
|
+
if (status[0] == AUTHENTICATION_OK && numSubPackets > 2) {
|
|
313
|
+
pos += 5;
|
|
314
|
+
pos = this.receiveString(pkt, service, pos);
|
|
315
|
+
this.authActivated = true;
|
|
316
|
+
} else if (status[0] == AUTHENTICATION_DONT_USE_AUTH) {
|
|
317
|
+
this.authActivated = false;
|
|
318
|
+
} else {
|
|
319
|
+
errors.throwErr(errors.ERR_ANO_STATUS, "Authentication");
|
|
320
|
+
}
|
|
321
|
+
return pos;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
class EncryptionService extends NetworkService {
|
|
326
|
+
|
|
327
|
+
constructor(sAtts) {
|
|
328
|
+
super(sAtts);
|
|
329
|
+
this.service = ENCRYPTION;
|
|
330
|
+
this.numSubPackets = 2;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
getDataSize() {
|
|
334
|
+
return SERVICE_HEADER_SIZE + SUBPACKET_SIZE + VERSION_LENGTH +
|
|
335
|
+
SUBPACKET_SIZE + 1;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
sendServiceData(buf, pos) {
|
|
339
|
+
pos = this.sendHeader(buf, pos);
|
|
340
|
+
pos = this.sendVersion(buf, pos);
|
|
341
|
+
const drivers = Buffer.from([0x00]); /* No encryption drivers supported */
|
|
342
|
+
pos = this.sendRaw(buf, drivers, 1, pos);
|
|
343
|
+
return pos;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
class DataIntegrityService extends NetworkService {
|
|
348
|
+
|
|
349
|
+
constructor(sAtts) {
|
|
350
|
+
super(sAtts);
|
|
351
|
+
this.service = DATAINTEGRITY;
|
|
352
|
+
this.numSubPackets = 2;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
getDataSize() {
|
|
356
|
+
return SERVICE_HEADER_SIZE + SUBPACKET_SIZE + VERSION_LENGTH +
|
|
357
|
+
SUBPACKET_SIZE + 1;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
sendServiceData(buf, pos) {
|
|
361
|
+
pos = this.sendHeader(buf, pos);
|
|
362
|
+
pos = this.sendVersion(buf, pos);
|
|
363
|
+
const drivers = Buffer.from([0x00]); /* No data integrity drivers supported */
|
|
364
|
+
pos = this.sendRaw(buf, drivers, 1, pos);
|
|
365
|
+
return pos;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/* Advanced Networking Options */
|
|
370
|
+
class ANO {
|
|
371
|
+
|
|
372
|
+
constructor(sAtts) {
|
|
373
|
+
this.serviceList = [new AuthenticationService(sAtts), new EncryptionService(sAtts),
|
|
374
|
+
new DataIntegrityService(sAtts), new SupervisorService(sAtts)];
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
sendPacket() {
|
|
378
|
+
let bufSize = HEADER_SIZE;
|
|
379
|
+
for (let i = 0; i < this.serviceList.length; i++) {
|
|
380
|
+
bufSize += this.serviceList[i].getDataSize();
|
|
381
|
+
}
|
|
382
|
+
const buf = Buffer.allocUnsafe(bufSize).fill(0);
|
|
383
|
+
let pos = buf.writeUInt32BE(MAGIC);
|
|
384
|
+
pos = buf.writeUInt16BE(bufSize, pos);
|
|
385
|
+
pos = buf.writeUInt32BE(VERSION, pos);
|
|
386
|
+
pos = buf.writeUInt16BE(this.serviceList.length, pos);
|
|
387
|
+
pos = buf.writeUInt8(0, pos);
|
|
388
|
+
|
|
389
|
+
/* Send in order of Supervisor, Auth, Encryption, Data Integrity */
|
|
390
|
+
pos = this.serviceList[3].sendServiceData(buf, pos);
|
|
391
|
+
pos = this.serviceList[0].sendServiceData(buf, pos);
|
|
392
|
+
pos = this.serviceList[1].sendServiceData(buf, pos);
|
|
393
|
+
this.serviceList[2].sendServiceData(buf, pos);
|
|
394
|
+
|
|
395
|
+
return buf;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
processPacket(pkt) {
|
|
399
|
+
let pos = 10;
|
|
400
|
+
if (pkt.readUInt32BE(pos) != MAGIC) {
|
|
401
|
+
errors.throwErr(errors.ERR_ANO_PACKET);
|
|
402
|
+
}
|
|
403
|
+
pos += 4;
|
|
404
|
+
//const pktLen = pkt.readUInt16BE(pos);
|
|
405
|
+
pos += 2;
|
|
406
|
+
//const version = pkt.readUInt32BE(pos);
|
|
407
|
+
pos += 4;
|
|
408
|
+
const services = pkt.readUInt16BE(pos);
|
|
409
|
+
pos += 2;
|
|
410
|
+
//const error = pkt.readUInt8(pos);
|
|
411
|
+
pos += 1;
|
|
412
|
+
|
|
413
|
+
/* Receive service headers */
|
|
414
|
+
const ret = [];
|
|
415
|
+
for (let i = 0; i < services; i++) {
|
|
416
|
+
pos = NetworkService.receiveHeader(pkt, ret, pos);
|
|
417
|
+
|
|
418
|
+
if (ret[2] != NO_ERROR) {
|
|
419
|
+
errors.throwErrWithORAError(errors.ERR_ANO_NEGOTIATION, ret[2]);
|
|
420
|
+
}
|
|
421
|
+
const serviceId = serviceMap[ret[0]];
|
|
422
|
+
|
|
423
|
+
pos = this.serviceList[serviceId].receiveServiceData(pkt, ret[1], pos);
|
|
424
|
+
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
function getFlags(protocol, userConfig) {
|
|
430
|
+
|
|
431
|
+
/* Do the NA negotiation only if external Auth and tpcs Authentication service is requested for a tcps connection */
|
|
432
|
+
if (protocol.toUpperCase() == 'TCPS' && userConfig.externalAuth && !userConfig.token)
|
|
433
|
+
return constants.NSINAWANTED;
|
|
434
|
+
else
|
|
435
|
+
return constants.NSINANOSERVICES;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
module.exports = { ANO, getFlags};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2022,
|
|
1
|
+
// Copyright (c) 2022, 2025, Oracle and/or its affiliates.
|
|
2
2
|
|
|
3
3
|
//-----------------------------------------------------------------------------
|
|
4
4
|
//
|
|
@@ -155,6 +155,7 @@ module.exports = {
|
|
|
155
155
|
NSPDAFLG: 8, // Data flags
|
|
156
156
|
NSPDADAT: 10, // Start of Data
|
|
157
157
|
NSPDAFEOF: 0x40, // "end of file"
|
|
158
|
+
NSPDAFCMP: 0x400, // "compressed data"
|
|
158
159
|
|
|
159
160
|
/* Marker Packet */
|
|
160
161
|
NSPMKTYP: 8, // marker type (see below)
|
|
@@ -201,6 +202,9 @@ module.exports = {
|
|
|
201
202
|
PURITY: 8, // Purity
|
|
202
203
|
SID: 9, // SID
|
|
203
204
|
|
|
205
|
+
/* Network Compression Algorithms */
|
|
206
|
+
NETWORK_COMPRESSION_ZLIB: 2,
|
|
207
|
+
|
|
204
208
|
/* FLAGS */
|
|
205
209
|
NSNOBLOCK: 0x0001, // Do not block
|
|
206
210
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2022,
|
|
1
|
+
// Copyright (c) 2022, 2025, Oracle and/or its affiliates.
|
|
2
2
|
|
|
3
3
|
//-----------------------------------------------------------------------------
|
|
4
4
|
//
|
|
@@ -57,7 +57,7 @@ const EXT_PARAM_SEP = '&';
|
|
|
57
57
|
const DESCRIPTION_PARAMS = ["ENABLE", "FAILOVER", "LOAD_BALANCE",
|
|
58
58
|
"RECV_BUF_SIZE", "SEND_BUF_SIZE", "SDU",
|
|
59
59
|
"SOURCE_ROUTE", "RETRY_COUNT", "RETRY_DELAY",
|
|
60
|
-
"CONNECT_TIMEOUT", "TRANSPORT_CONNECT_TIMEOUT", "RECV_TIMEOUT"];
|
|
60
|
+
"CONNECT_TIMEOUT", "TRANSPORT_CONNECT_TIMEOUT", "RECV_TIMEOUT", "USE_SNI", "COMPRESSION"];
|
|
61
61
|
/*
|
|
62
62
|
DESCRIPTION
|
|
63
63
|
This class takes care resolving the EZConnect format to Long TNS URL format.
|
|
@@ -438,6 +438,7 @@ class EZConnectResolver {
|
|
|
438
438
|
initializeUrlAlias() {
|
|
439
439
|
const aliasMap = new Map();
|
|
440
440
|
aliasMap.set("enable", "ENABLE");
|
|
441
|
+
aliasMap.set("compression", "COMPRESSION");
|
|
441
442
|
aliasMap.set("failover", "FAILOVER");
|
|
442
443
|
aliasMap.set("load_balance", "LOAD_BALANCE");
|
|
443
444
|
aliasMap.set("recv_buf_size", "RECV_BUF_SIZE");
|
|
@@ -459,6 +460,7 @@ class EZConnectResolver {
|
|
|
459
460
|
aliasMap.set("service_tag", "SERVICE_TAG");
|
|
460
461
|
aliasMap.set("connection_id_prefix", "CONNECTION_ID_PREFIX");
|
|
461
462
|
aliasMap.set("pool_boundary", "POOL_BOUNDARY");
|
|
463
|
+
aliasMap.set("use_sni", "USE_SNI");
|
|
462
464
|
return aliasMap;
|
|
463
465
|
}
|
|
464
466
|
}module.exports = EZConnectResolver;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2022,
|
|
1
|
+
// Copyright (c) 2022, 2025, Oracle and/or its affiliates.
|
|
2
2
|
|
|
3
3
|
//-----------------------------------------------------------------------------
|
|
4
4
|
//
|
|
@@ -246,6 +246,10 @@ class Description {
|
|
|
246
246
|
this.failover = (childnv.atom.toLowerCase() == "yes"
|
|
247
247
|
|| childnv.atom.toLowerCase() == "on"
|
|
248
248
|
|| childnv.atom.toLowerCase() == "true");
|
|
249
|
+
} else if (childnv.name.toUpperCase() == "USE_SNI") {
|
|
250
|
+
this.params.useSNI = (childnv.atom.toLowerCase() == "yes"
|
|
251
|
+
|| childnv.atom.toLowerCase() == "on"
|
|
252
|
+
|| childnv.atom.toLowerCase() == "true");
|
|
249
253
|
} else if (childnv.name.toUpperCase() == "ADDRESS_LIST") {
|
|
250
254
|
child = new NavAddressList();
|
|
251
255
|
child.initFromNVPair(childnv);
|
|
@@ -290,6 +294,19 @@ class Description {
|
|
|
290
294
|
}
|
|
291
295
|
} else if (childnv.name.toUpperCase() == "SDU") {
|
|
292
296
|
this.params.sdu = childnv.atom;
|
|
297
|
+
} else if (childnv.name.toUpperCase() == "COMPRESSION") {
|
|
298
|
+
this.params.networkCompression = (childnv.atom.toLowerCase() == "yes"
|
|
299
|
+
|| childnv.atom.toLowerCase() == "on"
|
|
300
|
+
|| childnv.atom.toLowerCase() == "true");
|
|
301
|
+
this.params.networkCompressionLevels = [];
|
|
302
|
+
} else if (childnv.name.toUpperCase() == "COMPRESSION_LEVELS") {
|
|
303
|
+
const listsize = childnv.getListSize();
|
|
304
|
+
for (let i = 0; i < listsize; i++) {
|
|
305
|
+
const tmpnv = childnv.getListElement(i);
|
|
306
|
+
if (tmpnv.name.toUpperCase() == "LEVEL") {
|
|
307
|
+
this.params.networkCompressionLevels.push(tmpnv.atom.toLowerCase());
|
|
308
|
+
}
|
|
309
|
+
}
|
|
293
310
|
} else if (childnv.name.toUpperCase() == "EXPIRE_TIME") {
|
|
294
311
|
if (childnv.atom > 0)
|
|
295
312
|
this.params.expireTime = childnv.atom;
|
|
@@ -696,7 +713,6 @@ class NavDescription extends Description {
|
|
|
696
713
|
}
|
|
697
714
|
|
|
698
715
|
desc.params = this.params;
|
|
699
|
-
|
|
700
716
|
if ('connectTimeout' in this.params) {
|
|
701
717
|
cs.sBuf.push("(CONNECT_TIMEOUT=" + this.params.connectTimeout + ")");
|
|
702
718
|
}
|
|
@@ -715,6 +731,9 @@ class NavDescription extends Description {
|
|
|
715
731
|
if ('enable' in this.params) {
|
|
716
732
|
cs.sBuf.push("(ENABLE=" + this.params.enable + ")");
|
|
717
733
|
}
|
|
734
|
+
if ('useSNI' in this.params) {
|
|
735
|
+
cs.sBuf.push("(USE_SNI=" + this.params.useSNI + ")");
|
|
736
|
+
}
|
|
718
737
|
if (('sslServerCertDN' in this.params) || ('sslServerDNMatch' in this.params) || ('walletLocation' in this.params) || ('sslAllowWeakDNMatch' in this.params)) {
|
|
719
738
|
cs.sBuf.push("(SECURITY=");
|
|
720
739
|
if ('sslServerCertDN' in this.params) {
|