oracledb 6.7.2 → 6.9.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 +39 -3
- package/build/Release/oracledb-6.9.0-darwin-arm64.node +0 -0
- package/build/Release/oracledb-6.9.0-darwin-arm64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.9.0-darwin-x64.node +0 -0
- package/build/Release/oracledb-6.9.0-darwin-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.9.0-js-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.9.0-linux-arm64.node +0 -0
- package/build/Release/oracledb-6.9.0-linux-arm64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.9.0-linux-x64.node +0 -0
- package/build/Release/oracledb-6.9.0-linux-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.9.0-win32-x64.node +0 -0
- package/build/Release/oracledb-6.9.0-win32-x64.node-buildinfo.txt +1 -0
- package/lib/aqMessage.js +10 -1
- package/lib/configProviders/file.js +72 -0
- package/lib/connection.js +153 -4
- package/lib/dbObject.js +51 -10
- package/lib/errors.js +144 -36
- package/lib/impl/connection.js +24 -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/impl/pool.js +10 -1
- package/lib/impl/resultset.js +5 -4
- package/lib/lob.js +9 -1
- package/lib/oracledb.js +209 -20
- package/lib/pool.js +12 -1
- package/lib/poolStatistics.js +3 -1
- package/lib/settings.js +5 -1
- package/lib/thin/connection.js +130 -12
- package/lib/thin/dbObject.js +46 -13
- package/lib/thin/lob.js +2 -3
- package/lib/thin/pool.js +112 -31
- package/lib/thin/protocol/capabilities.js +8 -4
- package/lib/thin/protocol/constants.js +31 -1
- package/lib/thin/protocol/messages/auth.js +42 -6
- package/lib/thin/protocol/messages/base.js +98 -9
- package/lib/thin/protocol/messages/dataType.js +2 -1
- package/lib/thin/protocol/messages/execute.js +46 -4
- package/lib/thin/protocol/messages/fastAuth.js +6 -1
- package/lib/thin/protocol/messages/lobOp.js +5 -22
- package/lib/thin/protocol/messages/logOff.js +0 -1
- package/lib/thin/protocol/messages/sessionRelease.js +0 -1
- package/lib/thin/protocol/messages/transactionSwitch.js +12 -4
- package/lib/thin/protocol/messages/withData.js +10 -1
- package/lib/thin/protocol/packet.js +1 -1
- package/lib/thin/protocol/protocol.js +2 -1
- package/lib/thin/sqlnet/ANO.js +438 -0
- package/lib/thin/sqlnet/connStrategy.js +2 -1
- package/lib/thin/sqlnet/constants.js +5 -1
- package/lib/thin/sqlnet/ezConnectResolver.js +4 -2
- package/lib/thin/sqlnet/navNodes.js +22 -3
- package/lib/thin/sqlnet/networkSession.js +94 -16
- package/lib/thin/sqlnet/ntTcp.js +50 -3
- package/lib/thin/sqlnet/packet.js +32 -4
- package/lib/thin/sqlnet/sessionAtts.js +24 -2
- package/lib/thin/util.js +3 -8
- package/lib/transformer.js +13 -2
- package/lib/types.js +220 -8
- package/lib/util.js +77 -3
- package/lib/version.js +2 -2
- package/package/install.js +3 -3
- package/package/prunebinaries.js +6 -12
- package/package.json +2 -2
- package/{lib/configProviders/azure.js → plugins/configProviders/azure/index.js} +70 -63
- package/plugins/configProviders/azurevault/index.js +84 -0
- package/{lib → plugins}/configProviders/base.js +13 -3
- package/{lib/configProviders/ociobject.js → plugins/configProviders/ociobject/index.js} +43 -78
- package/plugins/configProviders/ocivault/index.js +100 -0
- package/plugins/token/extensionAzure/index.js +101 -0
- package/plugins/token/extensionOci/index.js +210 -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
|
//
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
//-----------------------------------------------------------------------------
|
|
26
26
|
|
|
27
27
|
'use strict';
|
|
28
|
-
|
|
28
|
+
const zlib = require('zlib');
|
|
29
29
|
const Packet = require("./packet.js");
|
|
30
30
|
const NTTCP = require("./ntTcp.js");
|
|
31
31
|
const SessionAtts = require("./sessionAtts.js");
|
|
@@ -38,6 +38,7 @@ const EzConnect = require("./ezConnectResolver.js");
|
|
|
38
38
|
const { NLParamParser, tnsnamesFilePath } = require("./paramParser.js");
|
|
39
39
|
const process = require('process');
|
|
40
40
|
const downHostInstance = require("./connStrategy.js").SOLE_INST_DHCACHE;
|
|
41
|
+
const {ANO} = require("./ANO.js");
|
|
41
42
|
/**
|
|
42
43
|
*
|
|
43
44
|
* @param {string} userConfig
|
|
@@ -138,6 +139,7 @@ class NetworkSession {
|
|
|
138
139
|
this.isBreak = false;
|
|
139
140
|
this.isReset = false;
|
|
140
141
|
this.breakPosted = false;
|
|
142
|
+
this.compressionEnabled = false;
|
|
141
143
|
}
|
|
142
144
|
|
|
143
145
|
async getAddress(addressNode, userConfig) {
|
|
@@ -149,7 +151,7 @@ class NetworkSession {
|
|
|
149
151
|
this.sAtts = new SessionAtts(uuid);
|
|
150
152
|
this.sAtts.setFrom(userConfig);
|
|
151
153
|
this.sAtts.setFrom(address.desc.params); /* Resolve attributes from Connect String */
|
|
152
|
-
await this.sAtts.prepare(address.protocol);
|
|
154
|
+
await this.sAtts.prepare(address.protocol, userConfig);
|
|
153
155
|
|
|
154
156
|
/* Insert Connection ID */
|
|
155
157
|
const rootNVPair = createNVPair(address.CNdata.join(""));
|
|
@@ -189,7 +191,7 @@ class NetworkSession {
|
|
|
189
191
|
* @param {object} connectPkt Connect Packet
|
|
190
192
|
*/
|
|
191
193
|
_sendConnect(connectPkt) {
|
|
192
|
-
this.
|
|
194
|
+
this.sendPacket(connectPkt.buf);
|
|
193
195
|
if (connectPkt.overflow) {
|
|
194
196
|
this._send(connectPkt.connectData, 0, connectPkt.connectDataLen);
|
|
195
197
|
this.flush();
|
|
@@ -295,17 +297,28 @@ class NetworkSession {
|
|
|
295
297
|
}
|
|
296
298
|
|
|
297
299
|
/* Accepted */
|
|
300
|
+
|
|
298
301
|
this.connected = true;
|
|
299
302
|
this.cData = null;
|
|
300
303
|
this.sndDatapkt = new Packet.DataPacket(this.sAtts.largeSDU);
|
|
301
|
-
this.sndDatapkt.createPacket(constants.NSPDADAT); //Currently only used for disconnect
|
|
302
|
-
this.sndDatapkt.offset = this.sndDatapkt.dataPtr;
|
|
303
|
-
this.sndDatapkt.len = this.sndDatapkt.bufLen;
|
|
304
304
|
this.markerPkt = new Packet.MarkerPacket(this.sAtts.largeSDU);
|
|
305
305
|
this.controlPkt = new Packet.ControlPacket();
|
|
306
306
|
this.ntAdapter.largeSDU = this.sAtts.largeSDU;
|
|
307
307
|
this.sAtts.clearWallet();
|
|
308
308
|
this.sAtts.nt.walletPassword = null;
|
|
309
|
+
|
|
310
|
+
if (!this.sAtts.noNA) {
|
|
311
|
+
const NAContext = new ANO(this.sAtts);
|
|
312
|
+
const buf = NAContext.sendPacket();
|
|
313
|
+
this._send(buf, 0, buf.length);
|
|
314
|
+
this.flush();
|
|
315
|
+
const packet = await this._recvPacket();
|
|
316
|
+
NAContext.processPacket(packet.buf);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
this.sndDatapkt.createPacket(constants.NSPDADAT); //Currently only used for disconnect
|
|
320
|
+
this.sndDatapkt.offset = this.sndDatapkt.dataPtr;
|
|
321
|
+
this.sndDatapkt.len = this.sndDatapkt.bufLen;
|
|
309
322
|
return (true);
|
|
310
323
|
}
|
|
311
324
|
|
|
@@ -353,9 +366,36 @@ class NetworkSession {
|
|
|
353
366
|
*/
|
|
354
367
|
_processPacket(packet) {
|
|
355
368
|
switch (packet.type) {
|
|
356
|
-
case constants.NSPTDA: /* DATA packet */
|
|
369
|
+
case constants.NSPTDA: { /* DATA packet */
|
|
370
|
+
const size = packet.buf.length;
|
|
371
|
+
const dataFlags = packet.buf.readUInt16BE(constants.NSPDAFLG);
|
|
372
|
+
if ((dataFlags & constants.NSPDAFCMP) != 0) { // compression enabled
|
|
373
|
+
const packetHeader = packet.buf.subarray(0, constants.NSPDADAT);
|
|
374
|
+
const buffertoDeCompress = packet.buf.subarray(constants.NSPDADAT, size);
|
|
375
|
+
let deCompressedDataBuffer;
|
|
376
|
+
try {
|
|
377
|
+
if (this.sAtts.firstRecvCompressedPacket) {
|
|
378
|
+
deCompressedDataBuffer = zlib.inflateSync(buffertoDeCompress, {finishFlush: zlib.constants.Z_SYNC_FLUSH});
|
|
379
|
+
this.sAtts.firstRecvCompressedPacket = 0;
|
|
380
|
+
} else {
|
|
381
|
+
deCompressedDataBuffer = zlib.inflateRawSync(buffertoDeCompress, {finishFlush: zlib.constants.Z_SYNC_FLUSH});
|
|
382
|
+
}
|
|
383
|
+
} catch (err) {
|
|
384
|
+
errors.throwErr(errors.ERR_DATA_COMPRESSION, err.message);
|
|
385
|
+
}
|
|
386
|
+
const resultLength = deCompressedDataBuffer.length;
|
|
387
|
+
//concatenate packet header with decompressed data
|
|
388
|
+
packet.buf = Buffer.concat([packetHeader, deCompressedDataBuffer]);
|
|
389
|
+
const length = resultLength + constants.NSPDADAT;
|
|
390
|
+
if (this.sAtts.largeSDU) {
|
|
391
|
+
packet.buf.writeUInt32BE(length, constants.NSPHDLEN);
|
|
392
|
+
} else {
|
|
393
|
+
packet.buf.writeUInt16BE(length, constants.NSPHDLEN);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
357
396
|
this.rcvDatapkt.fromPacket(packet);
|
|
358
397
|
break;
|
|
398
|
+
}
|
|
359
399
|
case constants.NSPTMK: /* MARKER packet */
|
|
360
400
|
this.markerPkt.fromPacket(packet, this);
|
|
361
401
|
break;
|
|
@@ -394,16 +434,54 @@ class NetworkSession {
|
|
|
394
434
|
const packet = await this.ntAdapter.receive();
|
|
395
435
|
if (!packet)
|
|
396
436
|
break;
|
|
437
|
+
|
|
397
438
|
this._processPacket(packet);
|
|
398
|
-
if (packet.type !== constants.NSPTCNL)
|
|
439
|
+
if (packet.type !== constants.NSPTCNL) {
|
|
399
440
|
return packet;
|
|
441
|
+
}
|
|
400
442
|
}
|
|
401
443
|
}
|
|
402
444
|
|
|
403
445
|
/**
|
|
404
446
|
* Send data (Internal)
|
|
405
447
|
*/
|
|
406
|
-
|
|
448
|
+
sendPacket(buf) {
|
|
449
|
+
const packetType = buf.readUInt8(constants.NSPHDTYP);
|
|
450
|
+
// only data packets need to be compressed
|
|
451
|
+
if (packetType == constants.NSPTDA) {
|
|
452
|
+
const size = buf.length;
|
|
453
|
+
let dataFlags = buf.readUInt16BE(constants.NSPDAFLG);
|
|
454
|
+
if (this.sAtts.networkCompressionEnabled && size > this.sAtts.networkCompressionThreshold) {
|
|
455
|
+
this.compressionEnabled = true;
|
|
456
|
+
const buffertoCompress = buf.subarray(constants.NSPDADAT, size);
|
|
457
|
+
const bufferHeader = buf.subarray(0, constants.NSPDADAT);
|
|
458
|
+
let compressedDataBuffer;
|
|
459
|
+
try {
|
|
460
|
+
if (this.sAtts.firstSendCompressedPacket) {
|
|
461
|
+
compressedDataBuffer = zlib.deflateSync(buffertoCompress, {finishFlush: zlib.
|
|
462
|
+
constants.Z_SYNC_FLUSH});
|
|
463
|
+
this.sAtts.firstSendCompressedPacket = 0;
|
|
464
|
+
} else {
|
|
465
|
+
compressedDataBuffer = zlib.deflateRawSync(buffertoCompress, {finishFlush: zlib.constants.Z_SYNC_FLUSH});
|
|
466
|
+
}
|
|
467
|
+
} catch (err) {
|
|
468
|
+
errors.throwErr(errors.ERR_DATA_COMPRESSION, err.message);
|
|
469
|
+
}
|
|
470
|
+
const resultLength = compressedDataBuffer.length;
|
|
471
|
+
if (resultLength < size - constants.NSPDADAT) {
|
|
472
|
+
dataFlags |= constants.NSPDAFCMP;
|
|
473
|
+
// concatenate buffer header with the compressed data
|
|
474
|
+
buf = Buffer.concat([bufferHeader, compressedDataBuffer]);
|
|
475
|
+
buf.writeUInt16BE(dataFlags, constants.NSPDAFLG);
|
|
476
|
+
const pktOffset = resultLength + constants.NSPDADAT;
|
|
477
|
+
if (this.sAtts.largeSDU) {
|
|
478
|
+
buf.writeUInt32BE(pktOffset, constants.NSPHDLEN);
|
|
479
|
+
} else {
|
|
480
|
+
buf.writeUInt16BE(pktOffset, constants.NSPHDLEN);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
407
485
|
this.ntAdapter.send(buf);
|
|
408
486
|
}
|
|
409
487
|
|
|
@@ -422,7 +500,7 @@ class NetworkSession {
|
|
|
422
500
|
|
|
423
501
|
this.isBreak = true;
|
|
424
502
|
this.markerPkt.prepare(constants.NSPMKTD1, constants.NIQIMARK);
|
|
425
|
-
this.
|
|
503
|
+
this.sendPacket(this.markerPkt.buf);
|
|
426
504
|
}
|
|
427
505
|
|
|
428
506
|
/**
|
|
@@ -432,12 +510,12 @@ class NetworkSession {
|
|
|
432
510
|
/* If posted send Break */
|
|
433
511
|
if (this.breakPosted) {
|
|
434
512
|
this.markerPkt.prepare(constants.NSPMKTD1, constants.NIQBMARK);
|
|
435
|
-
this.
|
|
513
|
+
this.sendPacket(this.markerPkt.buf);
|
|
436
514
|
this.breakPosted = false;
|
|
437
515
|
}
|
|
438
516
|
/* Send Reset */
|
|
439
517
|
this.markerPkt.prepare(constants.NSPMKTD1, constants.NIQRMARK);
|
|
440
|
-
this.
|
|
518
|
+
this.sendPacket(this.markerPkt.buf);
|
|
441
519
|
|
|
442
520
|
/* Await Reset */
|
|
443
521
|
while (!this.isReset) {
|
|
@@ -491,7 +569,7 @@ class NetworkSession {
|
|
|
491
569
|
}
|
|
492
570
|
|
|
493
571
|
while (len) {
|
|
494
|
-
this.
|
|
572
|
+
this.sendPacket(this.sndDatapkt.dataBuf);
|
|
495
573
|
|
|
496
574
|
/* If break throw error now */
|
|
497
575
|
if (this.isBreak) {
|
|
@@ -516,7 +594,7 @@ class NetworkSession {
|
|
|
516
594
|
}
|
|
517
595
|
this.sndDatapkt.dataLen = this.sndDatapkt.offset;
|
|
518
596
|
this.sndDatapkt.prepare2Send();
|
|
519
|
-
this.
|
|
597
|
+
this.sendPacket(Buffer.from(this.sndDatapkt.dataBuf));
|
|
520
598
|
this.sndDatapkt.dataLen = this.sndDatapkt.dataPtr;
|
|
521
599
|
this.sndDatapkt.offset = this.sndDatapkt.dataPtr;
|
|
522
600
|
}
|
|
@@ -569,7 +647,7 @@ class NetworkSession {
|
|
|
569
647
|
/* Send EOF packet */
|
|
570
648
|
this.sndDatapkt.dataLen = this.sndDatapkt.offset;
|
|
571
649
|
this.sndDatapkt.prepare2Send(constants.NSPDAFEOF);
|
|
572
|
-
this.
|
|
650
|
+
this.sendPacket(this.sndDatapkt.dataBuf);
|
|
573
651
|
}
|
|
574
652
|
this.ntAdapter.disconnect(type);
|
|
575
653
|
this.ntAdapter = null;
|
package/lib/thin/sqlnet/ntTcp.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2022,
|
|
1
|
+
// Copyright (c) 2022, 2025, Oracle and/or its affiliates.
|
|
2
2
|
|
|
3
3
|
//-----------------------------------------------------------------------------
|
|
4
4
|
//
|
|
@@ -34,7 +34,7 @@ const http = require("http");
|
|
|
34
34
|
const Timers = require('timers');
|
|
35
35
|
const constants = require("./constants.js");
|
|
36
36
|
const errors = require("../../errors.js");
|
|
37
|
-
const { findValue } = require("./nvStrToNvPair.js");
|
|
37
|
+
const { findValue, findNVPair } = require("./nvStrToNvPair.js");
|
|
38
38
|
|
|
39
39
|
const PACKET_HEADER_SIZE = 8;
|
|
40
40
|
const DEFAULT_PORT = 1521;
|
|
@@ -48,6 +48,12 @@ const TCPCHA = 1 << 1 | /* ASYNC support */
|
|
|
48
48
|
1 << 9 | /* Full Duplex support */
|
|
49
49
|
1 << 12; /* SIGPIPE Support */
|
|
50
50
|
|
|
51
|
+
const sniAllowedCDParams = ["SERVICE_NAME", "INSTANCE_NAME", "SERVER", "COLOCATION_TAG", "CONNECTION_ID", "POOL_BOUNDARY",
|
|
52
|
+
"POOL_PURITY", "POOL_CONNECTION_CLASS", "POOL_NAME", "SERVICE_TAG", "CID"];
|
|
53
|
+
const sniParams = ["SERVICE_NAME", "INSTANCE_NAME", "SERVER", "COLOCATION_TAG"];
|
|
54
|
+
const sniMap = ['S', 'I', 'T', 'C'];
|
|
55
|
+
const SNI_MAX_BYTES = 256;
|
|
56
|
+
|
|
51
57
|
let streamNum = 1;
|
|
52
58
|
|
|
53
59
|
/**
|
|
@@ -113,10 +119,13 @@ class NTTCP {
|
|
|
113
119
|
*/
|
|
114
120
|
async tlsConnect(secureContext, connStream) {
|
|
115
121
|
this.stream.removeAllListeners();
|
|
116
|
-
let connectErrCause;
|
|
122
|
+
let connectErrCause, sni = null;
|
|
123
|
+
if (this.atts.useSNI)
|
|
124
|
+
sni = this.generateSNI();
|
|
117
125
|
const tlsOptions = {
|
|
118
126
|
host: this.host,
|
|
119
127
|
socket: connStream,
|
|
128
|
+
servername: sni,
|
|
120
129
|
rejectUnauthorized: true,
|
|
121
130
|
secureContext: secureContext,
|
|
122
131
|
enableTrace: false,
|
|
@@ -557,6 +566,44 @@ class NTTCP {
|
|
|
557
566
|
}
|
|
558
567
|
}
|
|
559
568
|
|
|
569
|
+
/**
|
|
570
|
+
* Generate SNI data.
|
|
571
|
+
*/
|
|
572
|
+
generateSNI() {
|
|
573
|
+
/* No SNI if source route is set */
|
|
574
|
+
if ((findValue(this.atts.cDataNVPair, ["DESCRIPTION", "SOURCE_ROUTE"]) == "yes") ||
|
|
575
|
+
(findValue(this.atts.cDataNVPair, ["DESCRIPTION", "ADDRESS_LIST", "SOURCE_ROUTE"]) == "yes"))
|
|
576
|
+
return null;
|
|
577
|
+
|
|
578
|
+
const cdnvp = findNVPair(this.atts.cDataNVPair, "CONNECT_DATA");
|
|
579
|
+
/* Loop through the list of params */
|
|
580
|
+
for (let i = 0; i < cdnvp.getListSize(); i++) {
|
|
581
|
+
const child = cdnvp.getListElement(i);
|
|
582
|
+
if (!sniAllowedCDParams.includes(child.name.toUpperCase()))
|
|
583
|
+
return null; /* No SNI for unsupported Connect Data params */
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
/* Generate SNI */
|
|
587
|
+
let value, sni = "";
|
|
588
|
+
for (let i = 0; i < sniParams.length; i++) {
|
|
589
|
+
if ((value = findValue(this.atts.cDataNVPair, ["DESCRIPTION", "CONNECT_DATA", sniParams[i]]))) {
|
|
590
|
+
if (sniParams[i] == 'SERVER') /* For server type just pick the first letter */
|
|
591
|
+
sni += sniMap[i] + "1" + "." + value[0] + ".";
|
|
592
|
+
else
|
|
593
|
+
sni += sniMap[i] + value.length + "." + value + ".";
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
sni += "V3." + constants.TNS_VERSION_DESIRED; /* Version */
|
|
597
|
+
|
|
598
|
+
const match_pattern = new RegExp("^[A-Za-z0-9._-]+$");
|
|
599
|
+
if (!(sni.match(match_pattern)))
|
|
600
|
+
return null; /* No SNI if special characters are present */
|
|
601
|
+
|
|
602
|
+
if (sni.length > SNI_MAX_BYTES)
|
|
603
|
+
return null; /* Max allowed length */
|
|
604
|
+
|
|
605
|
+
return sni;
|
|
606
|
+
}
|
|
560
607
|
}
|
|
561
608
|
|
|
562
609
|
module.exports = NTTCP;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2022,
|
|
1
|
+
// Copyright (c) 2022, 2025, Oracle and/or its affiliates.
|
|
2
2
|
|
|
3
3
|
//-----------------------------------------------------------------------------
|
|
4
4
|
//
|
|
@@ -108,12 +108,12 @@ function ConnectPacket(connectData, sAtts, flags = 0) {
|
|
|
108
108
|
); /* Connect data offset */
|
|
109
109
|
|
|
110
110
|
this.buf.writeUInt8(
|
|
111
|
-
|
|
111
|
+
sAtts.NAFlags,
|
|
112
112
|
constants.NSPCNFL0
|
|
113
113
|
); /* NA disabled */
|
|
114
114
|
|
|
115
115
|
this.buf.writeUInt8(
|
|
116
|
-
|
|
116
|
+
sAtts.NAFlags,
|
|
117
117
|
constants.NSPCNFL1
|
|
118
118
|
); /* NA disabled *
|
|
119
119
|
|
|
@@ -125,7 +125,21 @@ function ConnectPacket(connectData, sAtts, flags = 0) {
|
|
|
125
125
|
|
|
126
126
|
this.buf.writeUInt32BE(sAtts.sdu, constants.NSPCNLSD); /* SDU */
|
|
127
127
|
this.buf.writeUInt32BE(sAtts.tdu, constants.NSPCNLTD); /* TDU */
|
|
128
|
-
|
|
128
|
+
let compressionFieldBuilder = 0; // we will be using just the last 2 bytes
|
|
129
|
+
/*
|
|
130
|
+
* For the 2 byte field, the first bit represent ON/OFF , second is empty
|
|
131
|
+
* After that every 4 bits represent a value in the user preference of sch
|
|
132
|
+
eme
|
|
133
|
+
* scheme values are 1 = LZO, 2 = ZLIB, 3 = GZIP ( only ZLIB supported in node-oracledb) */
|
|
134
|
+
|
|
135
|
+
if (sAtts.networkCompression) {
|
|
136
|
+
compressionFieldBuilder = constants.NSPACCFON << 8 ; // set the ON bit
|
|
137
|
+
const schemeShiftCounter = 10; // shifting by 10 puts the 4 bit field in the right place
|
|
138
|
+
if (sAtts.networkCompressionLevels.includes('high'))
|
|
139
|
+
compressionFieldBuilder |= constants.NETWORK_COMPRESSION_ZLIB << schemeShiftCounter;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
this.buf.writeUInt16BE(compressionFieldBuilder, constants.NSPCNCFL); /* Compression field added */
|
|
129
143
|
|
|
130
144
|
this.buf.writeUInt32BE(
|
|
131
145
|
0,
|
|
@@ -240,12 +254,26 @@ function AcceptPacket(packet, sAtts) {
|
|
|
240
254
|
sAtts.sdu = packet.buf.readUInt32BE(constants.NSPACLSD);
|
|
241
255
|
sAtts.tdu = packet.buf.readUInt32BE(constants.NSPACLTD);
|
|
242
256
|
sAtts.largeSDU = true;
|
|
257
|
+
this.cflag = packet.buf.readUInt8(constants.NSPACCFL); // 00001000
|
|
258
|
+
if ((this.cflag & constants.NSPACCFON) != 0) { // compression ON
|
|
259
|
+
sAtts.negotiatedNetworkCompressionScheme = (this.cflag & 0x3c) >> 2; // 0x3c
|
|
260
|
+
sAtts.networkCompressionEnabled = true;
|
|
261
|
+
sAtts.firstRecvCompressedPacket = true;
|
|
262
|
+
sAtts.firstSendCompressedPacket = true;
|
|
263
|
+
} else {
|
|
264
|
+
sAtts.networkCompressionEnabled = false;
|
|
265
|
+
}
|
|
243
266
|
}
|
|
244
267
|
|
|
245
268
|
/* Accept flags */
|
|
246
269
|
this.flag0 = packet.buf.readUInt8(constants.NSPACFL0);
|
|
247
270
|
this.flag1 = packet.buf.readUInt8(constants.NSPACFL1);
|
|
248
271
|
|
|
272
|
+
sAtts.noNA = ((this.flag1 & constants.NSINANOSERVICES) == constants.NSINANOSERVICES);
|
|
273
|
+
if (!sAtts.noNA)
|
|
274
|
+
sAtts.noNA = ((this.flag0 & constants.NSINADISABLEDFORCONNECTION) == constants.NSINADISABLEDFORCONNECTION);
|
|
275
|
+
|
|
276
|
+
|
|
249
277
|
if (sAtts.version >= constants.TNS_VERSION_MIN_DATA_FLAGS) {
|
|
250
278
|
packet.flags = packet.buf.readUInt32BE(constants.NSPACFL2);
|
|
251
279
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2022,
|
|
1
|
+
// Copyright (c) 2022, 2025, Oracle and/or its affiliates.
|
|
2
2
|
|
|
3
3
|
//-----------------------------------------------------------------------------
|
|
4
4
|
//
|
|
@@ -30,6 +30,7 @@ const crypto = require('crypto');
|
|
|
30
30
|
const path = require('path');
|
|
31
31
|
const constants = require("./constants.js");
|
|
32
32
|
const fs = require("fs");
|
|
33
|
+
const {getFlags} = require("./ANO.js");
|
|
33
34
|
|
|
34
35
|
/**
|
|
35
36
|
* Generate UUID (Used for Connection ID)
|
|
@@ -60,6 +61,8 @@ class SessionAtts {
|
|
|
60
61
|
this.uuid = uuid;
|
|
61
62
|
this.nt.sslServerDNMatch = true;
|
|
62
63
|
this.nt.sslAllowWeakDNMatch = false;
|
|
64
|
+
this.nt.useSNI = false;
|
|
65
|
+
this.networkCompressionThreshold = 1024;
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
/**
|
|
@@ -71,6 +74,20 @@ class SessionAtts {
|
|
|
71
74
|
if (params.sdu > 0) {
|
|
72
75
|
this.sdu = parseInt(params.sdu);
|
|
73
76
|
}
|
|
77
|
+
if (typeof params.networkCompression == 'boolean') {
|
|
78
|
+
this.networkCompression = params.networkCompression;
|
|
79
|
+
this.networkCompressionLevels = [];
|
|
80
|
+
if (params.networkCompressionLevels) {
|
|
81
|
+
if (params.networkCompressionLevels.includes('high'))
|
|
82
|
+
this.networkCompressionLevels.push('high');
|
|
83
|
+
if (params.networkCompressionLevels.length == 0)
|
|
84
|
+
this.networkCompressionLevels.push('high');
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (params.networkCompressionThreshold >= 200) {
|
|
88
|
+
this.networkCompressionThreshold = parseInt(params.networkCompressionThreshold);
|
|
89
|
+
}
|
|
90
|
+
|
|
74
91
|
if (typeof params.walletLocation === 'string') {
|
|
75
92
|
this.nt.walletFile = path.join(params.walletLocation, constants.PEM_WALLET_FILE_NAME);
|
|
76
93
|
}
|
|
@@ -119,6 +136,9 @@ class SessionAtts {
|
|
|
119
136
|
if (params.httpsProxyPort >= 0) {
|
|
120
137
|
this.nt.httpsProxyPort = parseInt(params.httpsProxyPort);
|
|
121
138
|
}
|
|
139
|
+
if (typeof params.useSNI === 'boolean') {
|
|
140
|
+
this.nt.useSNI = params.useSNI;
|
|
141
|
+
}
|
|
122
142
|
}
|
|
123
143
|
}
|
|
124
144
|
|
|
@@ -151,7 +171,7 @@ class SessionAtts {
|
|
|
151
171
|
* Prepare attributes for connection, Generate Connection ID and read Wallet file
|
|
152
172
|
*
|
|
153
173
|
*/
|
|
154
|
-
async prepare(protocol) {
|
|
174
|
+
async prepare(protocol, userConfig) {
|
|
155
175
|
if (!this.uuid) {
|
|
156
176
|
this.uuid = await genuuid();
|
|
157
177
|
this.uuid = this.uuid.toString('base64');
|
|
@@ -169,6 +189,8 @@ class SessionAtts {
|
|
|
169
189
|
|
|
170
190
|
if (!this.connectTimeout && !this.transportConnectTimeout)
|
|
171
191
|
this.transportConnectTimeout = constants.DEFAULT_TRANSPORT_CONNECT_TIMEOUT; /* Default to 20 secs */
|
|
192
|
+
|
|
193
|
+
this.NAFlags = getFlags(protocol, userConfig);
|
|
172
194
|
}
|
|
173
195
|
|
|
174
196
|
}
|
package/lib/thin/util.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2022,
|
|
1
|
+
// Copyright (c) 2022, 2025, Oracle and/or its affiliates.
|
|
2
2
|
|
|
3
3
|
//-----------------------------------------------------------------------------
|
|
4
4
|
//
|
|
@@ -152,9 +152,7 @@ function checkProxyUserValidity(userName) {
|
|
|
152
152
|
index++;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
if (proxyUser.length
|
|
156
|
-
return result;
|
|
157
|
-
} else {
|
|
155
|
+
if (proxyUser.length != 0) {
|
|
158
156
|
result.proxyUser = proxyUser;
|
|
159
157
|
}
|
|
160
158
|
|
|
@@ -229,10 +227,7 @@ function checkProxyUserValidity(userName) {
|
|
|
229
227
|
// Check Credentials for Password Authentication
|
|
230
228
|
//---------------------------------------------------------------------------
|
|
231
229
|
function checkCredentials(params) {
|
|
232
|
-
if (params.
|
|
233
|
-
if (params.externalAuth === true) {
|
|
234
|
-
errors.throwErr(errors.ERR_NOT_IMPLEMENTED, 'External Authentication');
|
|
235
|
-
}
|
|
230
|
+
if (params.externalAuth === false) {
|
|
236
231
|
if (params.password === undefined) {
|
|
237
232
|
errors.throwErr(errors.ERR_MISSING_CREDENTIALS);
|
|
238
233
|
}
|
package/lib/transformer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2023,
|
|
1
|
+
// Copyright (c) 2023, 2025, Oracle and/or its affiliates.
|
|
2
2
|
|
|
3
3
|
//-----------------------------------------------------------------------------
|
|
4
4
|
//
|
|
@@ -89,7 +89,8 @@ function transformJsonValue(value) {
|
|
|
89
89
|
if (value === undefined || value === null ||
|
|
90
90
|
typeof value === 'number' || typeof value === 'string' ||
|
|
91
91
|
typeof value === 'boolean' || Buffer.isBuffer(value) ||
|
|
92
|
-
util.types.isDate(value) || nodbUtil.isVectorValue(value)
|
|
92
|
+
util.types.isDate(value) || nodbUtil.isVectorValue(value) ||
|
|
93
|
+
value instanceof types.IntervalYM || value instanceof types.IntervalDS)
|
|
93
94
|
return value;
|
|
94
95
|
|
|
95
96
|
// arrays are transformed to a new array with processed values
|
|
@@ -197,6 +198,16 @@ function transformValueIn(info, value, options) {
|
|
|
197
198
|
types.DB_TYPE_DATE);
|
|
198
199
|
return value;
|
|
199
200
|
|
|
201
|
+
// handle intervals
|
|
202
|
+
} else if (value instanceof types.IntervalYM) {
|
|
203
|
+
checkType(info, options,
|
|
204
|
+
types.DB_TYPE_INTERVAL_YM);
|
|
205
|
+
return value;
|
|
206
|
+
} else if (value instanceof types.IntervalDS) {
|
|
207
|
+
checkType(info, options,
|
|
208
|
+
types.DB_TYPE_INTERVAL_DS);
|
|
209
|
+
return value;
|
|
210
|
+
|
|
200
211
|
// handle binding buffers
|
|
201
212
|
} else if (Buffer.isBuffer(value)) {
|
|
202
213
|
checkType(info, options,
|