Skip to content

Commit 741a053

Browse files
committed
Code changes for token and ConnectIdPrefix
1 parent 8167e46 commit 741a053

File tree

6 files changed

+40
-36
lines changed

6 files changed

+40
-36
lines changed

lib/oracledb.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,11 @@ async function _verifyOptions(options, inCreatePool) {
306306
outOptions.sdu = options.sdu;
307307
}
308308

309-
// connectionIDPrefix must be a string
310-
if (options.connectionIDPrefix !== undefined) {
311-
errors.assertParamPropValue(typeof options.connectionIDPrefix === 'string',
312-
1, "connectionIDPrefix");
313-
outOptions.connectionIDPrefix = options.connectionIDPrefix;
309+
// connectionIdPrefix must be a string
310+
if (options.connectionIdPrefix !== undefined) {
311+
errors.assertParamPropValue(typeof options.connectionIdPrefix === 'string',
312+
1, "connectionIdPrefix");
313+
outOptions.connectionIdPrefix = options.connectionIdPrefix;
314314
}
315315

316316
// check pool specific options

lib/thin/protocol/messages/auth.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -247,19 +247,23 @@ class AuthMessage extends Message {
247247
if (!verifier11G) {
248248
buf.writeKeyValue("AUTH_PBKDF2_SPEEDY_KEY", this.speedyKey);
249249
}
250-
buf.writeKeyValue("SESSION_CLIENT_CHARSET", "873");
251-
buf.writeKeyValue("SESSION_CLIENT_DRIVER_NAME", constants.DRIVER_NAME);
252-
buf.writeKeyValue("SESSION_CLIENT_VERSION",
253-
constants.CLIENT_VERSION.toString());
254-
buf.writeKeyValue("AUTH_ALTER_SESSION", this.getAlterTimezoneStatement(), 1);
255250
}
251+
}
252+
if (!this.changePassword) {
253+
buf.writeKeyValue("SESSION_CLIENT_CHARSET", "873");
254+
buf.writeKeyValue("SESSION_CLIENT_DRIVER_NAME", constants.DRIVER_NAME);
255+
buf.writeKeyValue("SESSION_CLIENT_VERSION",
256+
constants.CLIENT_VERSION.toString());
257+
buf.writeKeyValue("AUTH_ALTER_SESSION", this.getAlterTimezoneStatement(), 1);
258+
}
259+
if (this.encodedPassword) {
256260
buf.writeKeyValue("AUTH_PASSWORD", this.encodedPassword);
257-
if (this.proxyStatus === 0) {
258-
buf.writeKeyValue("PROXY_CLIENT_NAME", this.schemaUser);
259-
}
260-
if (this.encodedNewPassword) {
261-
buf.writeKeyValue("AUTH_NEWPASSWORD", this.encodedNewPassword);
262-
}
261+
}
262+
if (this.proxyStatus === 0) {
263+
buf.writeKeyValue("PROXY_CLIENT_NAME", this.schemaUser);
264+
}
265+
if (this.encodedNewPassword) {
266+
buf.writeKeyValue("AUTH_NEWPASSWORD", this.encodedNewPassword);
263267
}
264268
if (this.conn.connClass) {
265269
buf.writeKeyValue("AUTH_KPPL_CONN_CLASS", this.conn.connClass);

lib/thin/sqlnet/navNodes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ class Description {
259259
for (let i = 0; i < listsize; i++) {
260260
tmpnv = childnv.getListElement(i);
261261
if (tmpnv.name.toUpperCase() == "CONNECTION_ID_PREFIX") {
262-
this.params.connectionIDPrefix = tmpnv.atom;
262+
this.params.connectionIdPrefix = tmpnv.atom;
263263
childnv.removeListElement(i);
264264
break;
265265
}

lib/thin/sqlnet/networkSession.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ class NetworkSession {
150150
/* Insert Connection ID */
151151
let rootNVPair = createNVPair(address.CNdata.join(""));
152152
let cdataNVPair = findNVPairRecurse(rootNVPair, "CONNECT_DATA");
153-
let connidStr = `(CONNECTION_ID=${this.sAtts.connectionID})`;
153+
let connidStr = `(CONNECTION_ID=${this.sAtts.connectionId})`;
154154
let childNVPair = createNVPair(connidStr);
155155
cdataNVPair.addListElement(childNVPair);
156156

@@ -208,7 +208,7 @@ class NetworkSession {
208208
/* Transport connect */
209209
if (this.sAtts.transportConnectTimeout) {
210210
let asyncPromise = this.transportConnect(address);
211-
await timeout(asyncPromise, this.sAtts.transportConnectTimeout, "transportConnectTimeout", address, this.sAtts.connectionID);
211+
await timeout(asyncPromise, this.sAtts.transportConnectTimeout, "transportConnectTimeout", address, this.sAtts.connectionId);
212212
} else {
213213
await this.transportConnect(address);
214214
}
@@ -231,13 +231,13 @@ class NetworkSession {
231231
this.refusePkt = null;
232232
let err = findValue(nvpair, ["DESCRIPTION", "ERR"]);
233233
if (err == "12514") {
234-
errors.throwErr(errors.ERR_INVALID_SERVICE_NAME, this.getOption(constants.SVCNAME), address.host, address.port, this.sAtts.connectionID);
234+
errors.throwErr(errors.ERR_INVALID_SERVICE_NAME, this.getOption(constants.SVCNAME), address.host, address.port, this.sAtts.connectionId);
235235
} else if (err == "12505") {
236-
errors.throwErr(errors.ERR_INVALID_SID, this.getOption(constants.SID), address.host, address.port, this.sAtts.connectionID);
236+
errors.throwErr(errors.ERR_INVALID_SID, this.getOption(constants.SID), address.host, address.port, this.sAtts.connectionId);
237237
} else if (err) {
238-
errors.throwErr(errors.ERR_CONNECTION_REFUSED, address.host, address.port, this.sAtts.connectionID, "ORA-" + err);
238+
errors.throwErr(errors.ERR_CONNECTION_REFUSED, address.host, address.port, this.sAtts.connectionId, "ORA-" + err);
239239
} else {
240-
errors.throwErr(errors.ERR_CONNECTION_REFUSED, address.host, address.port, this.sAtts.connectionID, "refused");
240+
errors.throwErr(errors.ERR_CONNECTION_REFUSED, address.host, address.port, this.sAtts.connectionId, "refused");
241241
}
242242
} else if (packet.type === constants.NSPTRS) { /* RESEND */
243243
if ((packet.flags & constants.NSPFSRN) == constants.NSPFSRN) {
@@ -274,7 +274,7 @@ class NetworkSession {
274274

275275
if (this.sAtts.transportConnectTimeout) {
276276
let asyncPromise = this.transportConnect(address);
277-
await timeout(asyncPromise, this.sAtts.transportConnectTimeout, "transportConnectTimeout", address, this.sAtts.connectionID);
277+
await timeout(asyncPromise, this.sAtts.transportConnectTimeout, "transportConnectTimeout", address, this.sAtts.connectionId);
278278
} else {
279279
await this.transportConnect(address);
280280
}
@@ -310,7 +310,7 @@ class NetworkSession {
310310
try {
311311
if (this.sAtts.connectTimeout) {
312312
let asyncPromise = this.connect2(address);
313-
connected = await timeout(asyncPromise, this.sAtts.connectTimeout, "connectTimeout", address, this.sAtts.connectionID);
313+
connected = await timeout(asyncPromise, this.sAtts.connectTimeout, "connectTimeout", address, this.sAtts.connectionId);
314314
} else {
315315
connected = await this.connect2(address);
316316
}

lib/thin/sqlnet/ntTcp.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class NTTCP {
116116
});
117117
});
118118
if (connectErrCause)
119-
errors.throwErr(errors.ERR_TLS_AUTH_FAILURE, this.host, this.port, this.atts.connectionID, connectErrCause);
119+
errors.throwErr(errors.ERR_TLS_AUTH_FAILURE, this.host, this.port, this.atts.connectionId, connectErrCause);
120120
this.connStream = connStream;
121121
}
122122

@@ -173,9 +173,9 @@ class NTTCP {
173173
req.removeAllListeners();
174174
if (!this.connected) {
175175
if (proxyConnectErrCause) {
176-
errors.throwErr(errors.ERR_PROXY_CONNECT_FAILURE, httpsProxy, httpsProxyPort, this.atts.connectionID, proxyConnectErrCause);
176+
errors.throwErr(errors.ERR_PROXY_CONNECT_FAILURE, httpsProxy, httpsProxyPort, this.atts.connectionId, proxyConnectErrCause);
177177
} else {
178-
errors.throwErr(errors.ERR_CONNECTION_INCOMPLETE, this.host, this.port, this.atts.connectionID, connectErrCause);
178+
errors.throwErr(errors.ERR_CONNECTION_INCOMPLETE, this.host, this.port, this.atts.connectionId, connectErrCause);
179179
}
180180
}
181181
}
@@ -297,9 +297,9 @@ class NTTCP {
297297
let err, newErr;
298298
if (this.savedErr) {
299299
err = errors.getErr(errors.ERR_CONNECTION_LOSTCONTACT,
300-
this.host, this.port, this.atts.connectionID, this.savedErr.message);
300+
this.host, this.port, this.atts.connectionId, this.savedErr.message);
301301
} else {
302-
err = errors.getErr(errors.ERR_CONNECTION_EOF, this.host, this.port, this.atts.connectionID,);
302+
err = errors.getErr(errors.ERR_CONNECTION_EOF, this.host, this.port, this.atts.connectionId,);
303303
}
304304
/* Wrap around NJS-500 */
305305
newErr = errors.getErr(errors.ERR_CONNECTION_CLOSED);

lib/thin/sqlnet/sessionAtts.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ class SessionAtts {
9191
if (params.sendTimeout > 0) {
9292
this.sendTimeout = params.sendTimeout * 1000;
9393
}
94-
if (typeof params.connectionIDPrefix === 'string') {
95-
this.connectionIDPrefix = params.connectionIDPrefix;
94+
if (typeof params.connectionIdPrefix === 'string') {
95+
this.connectionIdPrefix = params.connectionIdPrefix;
9696
}
9797
if (typeof params.tcpNoDelay === 'boolean') {
9898
this.nt.tcpNoDelay = params.tcpNoDelay;
@@ -146,12 +146,12 @@ class SessionAtts {
146146
this.uuid = await genuuid();
147147
this.uuid = this.uuid.toString('base64');
148148
}
149-
if (this.connectionIDPrefix) {
150-
this.connectionID = this.connectionIDPrefix + this.uuid;
149+
if (this.connectionIdPrefix) {
150+
this.connectionId = this.connectionIdPrefix + this.uuid;
151151
} else {
152-
this.connectionID = this.uuid;
152+
this.connectionId = this.uuid;
153153
}
154-
this.nt.connectionID = this.connectionID;
154+
this.nt.connectionId = this.connectionId;
155155

156156
if (this.nt.walletFile) {
157157
this.nt.wallet = await this.readWalletFile();

0 commit comments

Comments
 (0)