| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- This patch provides a workaround for the nasty issue that scp(1) is
- found on the server side only if it is in $PATH (due to a ~/.bashrc,
- /etc/profile, etc). The default $PATH is out of scope for OpenPKG and is
- different across platforms anyway. Nevertheless we want to ensure that
- with OpenPKG on the server side, scp(1) is always usable (on the client
- side) without having to adjust the system and/or user environment (on
- the server side).
- Index: session.c
- --- session.c.orig 2004-04-16 14:47:55.000000000 +0200
- +++ session.c 2004-05-19 17:02:30.000000000 +0200
- @@ -66,6 +66,10 @@
- #include "ssh-gss.h"
- #endif
-
- +#ifndef SCPBINDIR
- +#define SCPBINDIR "@l_prefix@/bin"
- +#endif
- +
- /* func */
-
- Session *session_new(void);
- @@ -652,6 +656,21 @@
- void
- do_exec(Session *s, const char *command)
- {
- + char *scp_command = NULL;
- +
- + if ( command != NULL
- + && strlen(command) >= 3
- + && strncmp(command, "scp", 3) == 0
- + && (command[3] == ' ' || command[3] == '\0')) {
- + size_t l, k;
- + l = strlen(SCPBINDIR);
- + k = strlen(command);
- + scp_command = xmalloc(l+1+k+1);
- + snprintf(scp_command, l+1+k+1, "%s/%s", SCPBINDIR, command);
- + command = (const char *)scp_command;
- + debug("Forced SCP command '%.900s'", command);
- + }
- +
- if (forced_command) {
- original_command = command;
- command = forced_command;
- @@ -672,6 +691,8 @@
- do_exec_no_pty(s, command);
-
- original_command = NULL;
- + if (scp_command != NULL)
- + xfree(scp_command);
- }
-
-
|