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
|
//
|
|
@@ -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.firstCompressedPacket) {
|
|
378
|
+
deCompressedDataBuffer = zlib.inflateSync(buffertoDeCompress, {finishFlush: zlib.constants.Z_SYNC_FLUSH});
|
|
379
|
+
this.sAtts.firstCompressedPacket = 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,48 @@ 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
|
+
compressedDataBuffer = zlib.deflateSync(buffertoCompress, {finishFlush: zlib.constants.Z_SYNC_FLUSH});
|
|
461
|
+
} catch (err) {
|
|
462
|
+
errors.throwErr(errors.ERR_DATA_COMPRESSION, err.message);
|
|
463
|
+
}
|
|
464
|
+
const resultLength = compressedDataBuffer.length;
|
|
465
|
+
if (resultLength < size - constants.NSPDADAT) {
|
|
466
|
+
dataFlags |= constants.NSPDAFCMP;
|
|
467
|
+
// concatenate buffer header with the compressed data
|
|
468
|
+
buf = Buffer.concat([bufferHeader, compressedDataBuffer]);
|
|
469
|
+
buf.writeUInt16BE(dataFlags, constants.NSPDAFLG);
|
|
470
|
+
const pktOffset = resultLength + constants.NSPDADAT;
|
|
471
|
+
if (this.sAtts.largeSDU) {
|
|
472
|
+
buf.writeUInt32BE(pktOffset, constants.NSPHDLEN);
|
|
473
|
+
} else {
|
|
474
|
+
buf.writeUInt16BE(pktOffset, constants.NSPHDLEN);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
407
479
|
this.ntAdapter.send(buf);
|
|
408
480
|
}
|
|
409
481
|
|
|
@@ -422,7 +494,7 @@ class NetworkSession {
|
|
|
422
494
|
|
|
423
495
|
this.isBreak = true;
|
|
424
496
|
this.markerPkt.prepare(constants.NSPMKTD1, constants.NIQIMARK);
|
|
425
|
-
this.
|
|
497
|
+
this.sendPacket(this.markerPkt.buf);
|
|
426
498
|
}
|
|
427
499
|
|
|
428
500
|
/**
|
|
@@ -432,12 +504,12 @@ class NetworkSession {
|
|
|
432
504
|
/* If posted send Break */
|
|
433
505
|
if (this.breakPosted) {
|
|
434
506
|
this.markerPkt.prepare(constants.NSPMKTD1, constants.NIQBMARK);
|
|
435
|
-
this.
|
|
507
|
+
this.sendPacket(this.markerPkt.buf);
|
|
436
508
|
this.breakPosted = false;
|
|
437
509
|
}
|
|
438
510
|
/* Send Reset */
|
|
439
511
|
this.markerPkt.prepare(constants.NSPMKTD1, constants.NIQRMARK);
|
|
440
|
-
this.
|
|
512
|
+
this.sendPacket(this.markerPkt.buf);
|
|
441
513
|
|
|
442
514
|
/* Await Reset */
|
|
443
515
|
while (!this.isReset) {
|
|
@@ -491,7 +563,7 @@ class NetworkSession {
|
|
|
491
563
|
}
|
|
492
564
|
|
|
493
565
|
while (len) {
|
|
494
|
-
this.
|
|
566
|
+
this.sendPacket(this.sndDatapkt.dataBuf);
|
|
495
567
|
|
|
496
568
|
/* If break throw error now */
|
|
497
569
|
if (this.isBreak) {
|
|
@@ -516,7 +588,7 @@ class NetworkSession {
|
|
|
516
588
|
}
|
|
517
589
|
this.sndDatapkt.dataLen = this.sndDatapkt.offset;
|
|
518
590
|
this.sndDatapkt.prepare2Send();
|
|
519
|
-
this.
|
|
591
|
+
this.sendPacket(Buffer.from(this.sndDatapkt.dataBuf));
|
|
520
592
|
this.sndDatapkt.dataLen = this.sndDatapkt.dataPtr;
|
|
521
593
|
this.sndDatapkt.offset = this.sndDatapkt.dataPtr;
|
|
522
594
|
}
|
|
@@ -569,7 +641,7 @@ class NetworkSession {
|
|
|
569
641
|
/* Send EOF packet */
|
|
570
642
|
this.sndDatapkt.dataLen = this.sndDatapkt.offset;
|
|
571
643
|
this.sndDatapkt.prepare2Send(constants.NSPDAFEOF);
|
|
572
|
-
this.
|
|
644
|
+
this.sendPacket(this.sndDatapkt.dataBuf);
|
|
573
645
|
}
|
|
574
646
|
this.ntAdapter.disconnect(type);
|
|
575
647
|
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,25 @@ 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.firstCompressedPacket = true;
|
|
262
|
+
} else {
|
|
263
|
+
sAtts.networkCompressionEnabled = false;
|
|
264
|
+
}
|
|
243
265
|
}
|
|
244
266
|
|
|
245
267
|
/* Accept flags */
|
|
246
268
|
this.flag0 = packet.buf.readUInt8(constants.NSPACFL0);
|
|
247
269
|
this.flag1 = packet.buf.readUInt8(constants.NSPACFL1);
|
|
248
270
|
|
|
271
|
+
sAtts.noNA = ((this.flag1 & constants.NSINANOSERVICES) == constants.NSINANOSERVICES);
|
|
272
|
+
if (!sAtts.noNA)
|
|
273
|
+
sAtts.noNA = ((this.flag0 & constants.NSINADISABLEDFORCONNECTION) == constants.NSINADISABLEDFORCONNECTION);
|
|
274
|
+
|
|
275
|
+
|
|
249
276
|
if (sAtts.version >= constants.TNS_VERSION_MIN_DATA_FLAGS) {
|
|
250
277
|
packet.flags = packet.buf.readUInt32BE(constants.NSPACFL2);
|
|
251
278
|
}
|
|
@@ -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,7 @@ class SessionAtts {
|
|
|
60
61
|
this.uuid = uuid;
|
|
61
62
|
this.nt.sslServerDNMatch = true;
|
|
62
63
|
this.nt.sslAllowWeakDNMatch = false;
|
|
64
|
+
this.nt.useSNI = false;
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
/**
|
|
@@ -71,6 +73,22 @@ class SessionAtts {
|
|
|
71
73
|
if (params.sdu > 0) {
|
|
72
74
|
this.sdu = parseInt(params.sdu);
|
|
73
75
|
}
|
|
76
|
+
if (typeof params.networkCompression == 'boolean') {
|
|
77
|
+
this.networkCompression = params.networkCompression;
|
|
78
|
+
this.networkCompressionLevels = [];
|
|
79
|
+
if (params.networkCompressionLevels) {
|
|
80
|
+
if (params.networkCompressionLevels.includes('high'))
|
|
81
|
+
this.networkCompressionLevels.push('high');
|
|
82
|
+
if (params.networkCompressionLevels.length == 0)
|
|
83
|
+
this.networkCompressionLevels.push('high');
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (params.networkCompressionThreshold >= 200) {
|
|
87
|
+
this.networkCompressionThreshold = parseInt(params.networkCompressionThreshold);
|
|
88
|
+
} else
|
|
89
|
+
this.networkCompressionThreshold = 1024;
|
|
90
|
+
|
|
91
|
+
|
|
74
92
|
if (typeof params.walletLocation === 'string') {
|
|
75
93
|
this.nt.walletFile = path.join(params.walletLocation, constants.PEM_WALLET_FILE_NAME);
|
|
76
94
|
}
|
|
@@ -119,6 +137,9 @@ class SessionAtts {
|
|
|
119
137
|
if (params.httpsProxyPort >= 0) {
|
|
120
138
|
this.nt.httpsProxyPort = parseInt(params.httpsProxyPort);
|
|
121
139
|
}
|
|
140
|
+
if (typeof params.useSNI === 'boolean') {
|
|
141
|
+
this.nt.useSNI = params.useSNI;
|
|
142
|
+
}
|
|
122
143
|
}
|
|
123
144
|
}
|
|
124
145
|
|
|
@@ -151,7 +172,7 @@ class SessionAtts {
|
|
|
151
172
|
* Prepare attributes for connection, Generate Connection ID and read Wallet file
|
|
152
173
|
*
|
|
153
174
|
*/
|
|
154
|
-
async prepare(protocol) {
|
|
175
|
+
async prepare(protocol, userConfig) {
|
|
155
176
|
if (!this.uuid) {
|
|
156
177
|
this.uuid = await genuuid();
|
|
157
178
|
this.uuid = this.uuid.toString('base64');
|
|
@@ -169,6 +190,8 @@ class SessionAtts {
|
|
|
169
190
|
|
|
170
191
|
if (!this.connectTimeout && !this.transportConnectTimeout)
|
|
171
192
|
this.transportConnectTimeout = constants.DEFAULT_TRANSPORT_CONNECT_TIMEOUT; /* Default to 20 secs */
|
|
193
|
+
|
|
194
|
+
this.NAFlags = getFlags(protocol, userConfig);
|
|
172
195
|
}
|
|
173
196
|
|
|
174
197
|
}
|
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,
|