Skip to content

Commit 418d2a5

Browse files
committed
Add end of RPC flags for fast authentication
1 parent 14e0e79 commit 418d2a5

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

lib/thin/connection.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,11 @@ class ThinConnectionImpl extends ConnectionImpl {
692692
fastAuthMessage.dataTypeMessage = dataTypeMessage;
693693
fastAuthMessage.authMessage = authMessage;
694694
await this._protocol._processMessage(fastAuthMessage);
695+
if (fastAuthMessage.reNegotiate) {
696+
// Fast Authentication failed.
697+
await this._protocol._processMessage(dataTypeMessage);
698+
await this._protocol._processMessage(authMessage);
699+
}
695700
} else {
696701
await this._protocol._processMessage(protocolMessage);
697702
await this._protocol._processMessage(dataTypeMessage);

lib/thin/protocol/packet.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ const vector = require('../../impl/datahandlers/vector.js');
3535
const errors = require("../../errors.js");
3636

3737
const TNS_BASE64_ALPHABET_ARRAY = Buffer.from("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", 'utf8');
38+
const FAST_AUTH_END_OF_RPC_VALUE = 0x800;
39+
const FAST_AUTH_END_OF_RPC_OFFSET = 0x8;
3840

3941
/**
4042
* Class used for byte chunks used in the ChunkedBytesBuffer.
@@ -495,6 +497,10 @@ class WritePacket extends BaseBuffer {
495497
if (!finalPacket) {
496498
buf = Buffer.from(buf);
497499
this.startPacket();
500+
} else {
501+
// Write End of RPC bit in last packet used only for fastAuth Message.
502+
this.buf.writeUInt16BE(FAST_AUTH_END_OF_RPC_VALUE,
503+
FAST_AUTH_END_OF_RPC_OFFSET);
498504
}
499505
if (!this.nsi.ntAdapter) {
500506
errors.throwErr(errors.ERR_INVALID_CONNECTION);

0 commit comments

Comments
 (0)