You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
44 lines
1.1 KiB
Index: session.c |
|
--- session.c.orig 2013-07-20 05:21:53.000000000 +0200 |
|
+++ session.c 2013-11-10 14:49:59.331693725 +0100 |
|
@@ -107,6 +107,10 @@ |
|
c[sizeof(INTERNAL_SFTP_NAME) - 1] == ' ' || \ |
|
c[sizeof(INTERNAL_SFTP_NAME) - 1] == '\t')) |
|
|
|
+#ifndef SCPBINDIR |
|
+#define SCPBINDIR "@l_prefix@/bin" |
|
+#endif |
|
+ |
|
/* func */ |
|
|
|
Session *session_new(void); |
|
@@ -794,6 +798,20 @@ |
|
do_exec(Session *s, const char *command) |
|
{ |
|
int ret; |
|
+ 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; |
|
@@ -832,6 +850,8 @@ |
|
ret = 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
|
|
|