Skip to content

Commit 46d2199

Browse files
committed
Merge branch 'fork/Maxime-J/fix-unix-socket' into develop
# Conflicts: # test/integration/test-auth-plugin.js
2 parents a719dab + 4a4e81c commit 46d2199

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/cmd/handshake/auth/caching-sha2-password-auth.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: LGPL-2.1-or-later
2-
// Copyright (c) 2015-2024 MariaDB Corporation Ab
2+
// Copyright (c) 2015-2025 MariaDB Corporation Ab
33

44
import PluginAuth from './plugin-auth.js';
55
import fs from 'node:fs';
@@ -27,6 +27,10 @@ class CachingSha2PasswordAuth extends PluginAuth {
2727
this.state = State.INIT;
2828
}
2929

30+
isSecureConnection() {
31+
return this.cmdParam.opts.ssl || (this.cmdParam.opts.socketPath && process.platform !== 'win32');
32+
}
33+
3034
start(out, opts, info) {
3135
this.exchange(this.pluginData, out, opts, info);
3236
this.onPacketReceive = this.response;
@@ -57,8 +61,8 @@ class CachingSha2PasswordAuth extends PluginAuth {
5761
return;
5862

5963
case 0x04:
60-
if (opts.ssl) {
61-
// using SSL, so sending password in clear
64+
if (this.isSecureConnection()) {
65+
// Secure connection, sending password in clear
6266
out.startPacket(this);
6367
out.writeString(opts.password);
6468
out.writeInt8(0);

0 commit comments

Comments
 (0)