ssh-6-option

===================================================================

Gbp-Pq: Name ssh-6-option.diff
This commit is contained in:
Paul Slootman 2022-06-02 17:40:02 +08:00 committed by openKylinBot
parent aaa5426cd1
commit 0394b96e60
1 changed files with 18 additions and 0 deletions

18
main.c
View File

@ -117,6 +117,7 @@ int sender_keeps_checksum = 0;
# endif
static struct sigaction sigact;
#endif
extern int default_af_hint;
struct pid_status {
pid_t pid;
@ -454,6 +455,23 @@ static pid_t do_cmd(char *cmd, char *machine, char *user, char **remote_argv, in
*t++ = '\0';
}
#ifdef AF_INET
if (default_af_hint == AF_INET) {
if (strncmp(cmd, "ssh", 3) == 0 || strstr(cmd, "/ssh") != NULL) {
/* we're using ssh so we can add a -4 option */
args[argc++] = "-4";
}
}
#endif
#ifdef AF_INET6
if (default_af_hint == AF_INET6) {
if (strncmp(cmd, "ssh", 3) == 0 || strstr(cmd, "/ssh") != NULL) {
/* we're using ssh so we can add a -6 option */
args[argc++] = "-6";
}
}
#endif
/* check to see if we've already been given '-l user' in
* the remote-shell command */
for (i = 0; i < argc-1; i++) {