version 1.29, 2002/04/02 17:37:48 |
version 1.29.2.3, 2003/04/03 22:35:17 |
|
|
size_t copy_buffer_len = 32768; |
size_t copy_buffer_len = 32768; |
size_t num_requests = 16; |
size_t num_requests = 16; |
|
|
|
extern int showprogress; |
|
|
static void |
static void |
connect_to_server(char *path, char **args, int *in, int *out, pid_t *sshpid) |
connect_to_server(char *path, char **args, int *in, int *out, pid_t *sshpid) |
{ |
{ |
int c_in, c_out; |
int c_in, c_out; |
|
|
#ifdef USE_PIPES |
#ifdef USE_PIPES |
int pin[2], pout[2]; |
int pin[2], pout[2]; |
|
|
if ((pipe(pin) == -1) || (pipe(pout) == -1)) |
if ((pipe(pin) == -1) || (pipe(pout) == -1)) |
fatal("pipe: %s", strerror(errno)); |
fatal("pipe: %s", strerror(errno)); |
*in = pin[0]; |
*in = pin[0]; |
|
|
c_out = pin[1]; |
c_out = pin[1]; |
#else /* USE_PIPES */ |
#else /* USE_PIPES */ |
int inout[2]; |
int inout[2]; |
|
|
if (socketpair(AF_UNIX, SOCK_STREAM, 0, inout) == -1) |
if (socketpair(AF_UNIX, SOCK_STREAM, 0, inout) == -1) |
fatal("socketpair: %s", strerror(errno)); |
fatal("socketpair: %s", strerror(errno)); |
*in = *out = inout[0]; |
*in = *out = inout[0]; |
|
|
int |
int |
main(int argc, char **argv) |
main(int argc, char **argv) |
{ |
{ |
int in, out, ch; |
int in, out, ch, err; |
pid_t sshpid; |
pid_t sshpid; |
char *host, *userhost, *cp, *file2; |
char *host, *userhost, *cp, *file2; |
int debug_level = 0, sshver = 2; |
int debug_level = 0, sshver = 2; |
|
|
|
|
args.list = NULL; |
args.list = NULL; |
addargs(&args, "ssh"); /* overwritten with ssh_program */ |
addargs(&args, "ssh"); /* overwritten with ssh_program */ |
addargs(&args, "-oFallBackToRsh no"); |
|
addargs(&args, "-oForwardX11 no"); |
addargs(&args, "-oForwardX11 no"); |
addargs(&args, "-oForwardAgent no"); |
addargs(&args, "-oForwardAgent no"); |
addargs(&args, "-oClearAllForwardings yes"); |
addargs(&args, "-oClearAllForwardings yes"); |
|
|
fatal("%s (%s).", strerror(errno), optarg); |
fatal("%s (%s).", strerror(errno), optarg); |
} else |
} else |
fatal("Filename already specified."); |
fatal("Filename already specified."); |
|
showprogress = 0; |
break; |
break; |
case 'P': |
case 'P': |
sftp_direct = optarg; |
sftp_direct = optarg; |
|
|
file1 = cp; |
file1 = cp; |
} |
} |
|
|
if ((host = strchr(userhost, '@')) == NULL) |
if ((host = strrchr(userhost, '@')) == NULL) |
host = userhost; |
host = userhost; |
else { |
else { |
*host++ = '\0'; |
*host++ = '\0'; |
|
|
&sshpid); |
&sshpid); |
} |
} |
|
|
interactive_loop(in, out, file1, file2); |
err = interactive_loop(in, out, file1, file2); |
|
|
close(in); |
close(in); |
close(out); |
close(out); |
|
|
fatal("Couldn't wait for ssh process: %s", |
fatal("Couldn't wait for ssh process: %s", |
strerror(errno)); |
strerror(errno)); |
|
|
exit(0); |
exit(err == 0 ? 0 : 1); |
} |
} |