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 2005-08-31 18:59:49 +0200 +++ session.c 2005-09-01 20:06:43 +0200 @@ -67,6 +67,10 @@ #include "ssh-gss.h" #endif +#ifndef SCPBINDIR +#define SCPBINDIR "@l_prefix@/bin" +#endif + /* func */ Session *session_new(void); @@ -660,6 +664,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; @@ -684,6 +703,8 @@ do_exec_no_pty(s, command); original_command = NULL; + if (scp_command != NULL) + (scp_command); /* * Clear loginmsg: it's the child's responsibility to display