summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorThomas Wolf <thomas.wolf@paranor.ch>2021-12-28 18:07:21 +0100
committerThomas Wolf <thomas.wolf@paranor.ch>2022-01-30 17:13:46 +0100
commit68bd2c146239b87d355ed6169ca0ec227a69995d (patch)
tree8d6ccafef21fa2e01d9e42385f28ea38db028932 /org.eclipse.jgit
parente0281c5adb89f0b109abca57970c7b89df63ede4 (diff)
downloadjgit-68bd2c146239b87d355ed6169ca0ec227a69995d.tar.gz
jgit-68bd2c146239b87d355ed6169ca0ec227a69995d.zip
sshd: handle "IdentityAgent SSH_AUTH_SOCK" in ssh config
OpenSSH has (for legacy reasons?) the option of specifying the default environment variable directly, instead of using ${SSH_AUTH_SOCK}. Make sure the plain variable name is not taken as a relative path name. Bug: 577053 Change-Id: If8f550dffc43887254f71aa0b487c50fa14d0627 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/transport/ssh/OpenSshConfigFile.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/SshConstants.java10
2 files changed, 11 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/transport/ssh/OpenSshConfigFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/transport/ssh/OpenSshConfigFile.java
index 4e8048baa8..cf966a528e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/transport/ssh/OpenSshConfigFile.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/transport/ssh/OpenSshConfigFile.java
@@ -871,7 +871,8 @@ public class OpenSshConfigFile implements SshConfigStore {
if (options != null) {
// HOSTNAME already done above
String value = options.get(SshConstants.IDENTITY_AGENT);
- if (value != null && !SshConstants.NONE.equals(value)) {
+ if (value != null && !SshConstants.NONE.equals(value)
+ && !SshConstants.ENV_SSH_AUTH_SOCKET.equals(value)) {
value = r.substitute(value, Replacer.DEFAULT_TOKENS, true);
value = toFile(value, home).getPath();
options.put(SshConstants.IDENTITY_AGENT, value);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SshConstants.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SshConstants.java
index 212a4e46c1..698982e1ae 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SshConstants.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SshConstants.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018, 2020 Thomas Wolf <thomas.wolf@paranor.ch> and others
+ * Copyright (C) 2018, 2021 Thomas Wolf <thomas.wolf@paranor.ch> and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0 which is available at
@@ -229,4 +229,12 @@ public final class SshConstants {
public static final String[] DEFAULT_IDENTITIES = { //
ID_RSA, ID_DSA, ID_ECDSA, ID_ED25519
};
+
+ /**
+ * Name of the environment variable holding the Unix domain socket for
+ * communication with an SSH agent.
+ *
+ * @since 6.1
+ */
+ public static final String ENV_SSH_AUTH_SOCKET = "SSH_AUTH_SOCK";
}