mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-22 08:03:40 +00:00
fix: honor SSH agent opt-out
This commit is contained in:
1 parent
7cb722a5c5
commit
0046291376
14 files changed
+61
-13
No files matched your search
@@ -831,6 +831,7 @@ function isPasswordProvided(password) {
|
||||
*/
|
||||
function buildAuthHandler(options) {
|
||||
const { privateKey, password, passphrase, agent, username, logPrefix = "[SSH]", unlockedEncryptedKeys = [], defaultKeys = [], sshAgentSocketOverride, onAuthAttempt } = options;
|
||||
const allowAgentFallback = options.allowAgentFallback !== false;
|
||||
|
||||
// Determine what type of explicit auth the user configured
|
||||
const hasExplicitKey = !!privateKey;
|
||||
@@ -845,7 +846,9 @@ function buildAuthHandler(options) {
|
||||
// Allow callers to pass in a pre-validated agent socket (e.g. from async
|
||||
// getAvailableAgentSocket). Fall back to synchronous getSshAgentSocket()
|
||||
// which on Windows always returns the pipe path without checking the service.
|
||||
const sshAgentSocket = sshAgentSocketOverride !== undefined ? sshAgentSocketOverride : getSshAgentSocket();
|
||||
const sshAgentSocket = allowAgentFallback
|
||||
? (sshAgentSocketOverride !== undefined ? sshAgentSocketOverride : getSshAgentSocket())
|
||||
: null;
|
||||
|
||||
// Only use system ssh-agent BEFORE user's auth when:
|
||||
// - User explicitly configured agent, OR
|
||||
|
||||
Reference in new issue
Block a user