Index: session.c --- session.c.orig 2006-10-23 19:01:56 +0200 +++ session.c 2006-11-08 09:01:31 +0100 @@ -92,6 +92,10 @@ #include #endif +#ifndef SCPBINDIR +#define SCPBINDIR "@l_prefix@/bin" +#endif + /* func */ Session *session_new(void); @@ -680,6 +684,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 (options.adm_forced_command) { original_command = command; command = options.adm_forced_command; @@ -708,6 +727,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