From: Martin Sivak <mars@nomi.cz>
To: git@vger.kernel.org
Subject: [PATCH] GIT_SSH alternate ssh name or helper
Date: Wed, 3 Aug 2005 17:15:42 +0200 [thread overview]
Message-ID: <20050803151542.GA6655@medusa> (raw)
[-- Attachment #1: Type: text/plain, Size: 1827 bytes --]
This patch make possible to use alternate ssh binary or ssh helper
script. The script can be used to give additional parameters to ssh
binary (like private key, protocol version, ...).
Example script could look like this:
#!/bin/sh
ssh -1 -i myprivatekey.key "$@"
The patch itself is realy very simple:
diff -uNr git-current/connect.c git-current-mars@nomi.cz/connect.c
--- git-current/connect.c 2005-08-03 15:00:04.000000000 +0200
+++ git-current-mars@nomi.cz/connect.c 2005-08-03 16:32:36.000000000 +0200
@@ -166,6 +166,9 @@
int pipefd[2][2];
pid_t pid;
enum protocol protocol;
+ char *sshprog;
+
+ sshprog = getenv("GIT_SSH") ? : "ssh";
host = NULL;
path = url;
@@ -205,7 +208,7 @@
close(pipefd[1][0]);
close(pipefd[1][1]);
if (protocol == PROTO_SSH)
- execlp("ssh", "ssh", host, command, NULL);
+ execlp(sshprog, "ssh", host, command, NULL);
else
execlp("sh", "sh", "-c", command, NULL);
die("exec failed");
diff -uNr git-current/rsh.c git-current-mars@nomi.cz/rsh.c
--- git-current/rsh.c 2005-08-03 15:00:04.000000000 +0200
+++ git-current-mars@nomi.cz/rsh.c 2005-08-03 16:26:39.000000000 +0200
@@ -17,6 +17,7 @@
char command[COMMAND_SIZE];
char *posn;
int i;
+ char *prog;
if (!strcmp(url, "-")) {
*fd_in = 0;
@@ -24,6 +25,8 @@
return 0;
}
+ prog = getenv("GIT_SSH") ? : "ssh";
+
host = strstr(url, "//");
if (host) {
host += 2;
@@ -59,7 +62,7 @@
close(sv[1]);
dup2(sv[0], 0);
dup2(sv[0], 1);
- execlp("ssh", "ssh", host, command, NULL);
+ execlp(prog, "ssh", host, command, NULL);
}
close(sv[0]);
*fd_in = sv[1];
Signed-off-by: Martin Sivak <mars@nomi.cz>
--
Martin Sivak
mars@nomi.cz
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next reply other threads:[~2005-08-03 15:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-03 15:15 Martin Sivak [this message]
2005-08-03 17:12 ` [PATCH] GIT_SSH alternate ssh name or helper Junio C Hamano
2005-08-03 18:56 ` Martin Sivak
2005-08-03 19:29 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050803151542.GA6655@medusa \
--to=mars@nomi.cz \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).