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

Index: session.c
--- session.c.orig 2019-10-09 02:31:03.000000000 +0200
+++ session.c 2019-10-09 23:04:15.891242000 +0200
@@ -111,6 +111,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);
@@ -665,6 +669,20 @@
int ret;
const char *forced = NULL, *tty = NULL;
char session_type[1024];
+ 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;
@@ -727,6 +745,8 @@
ret = do_exec_no_pty(ssh, s, command);
original_command = NULL;
+ if (scp_command != NULL)
+ free(scp_command);
/*
* Clear loginmsg: it's the child's responsibility to display