[patch] fix to ForceCommand to support additional arguments to internal-sftp

Michael Barabanov michael.barabanov at gmail.com
Tue Aug 19 14:40:21 EST 2008


Hi,

This patch makes things like ForceCommand internal-sftp -l INFO work
(current code in 5.1 would just end the session). Please consider for
inclusion into mainline.

Michael.

--- /var/tmp/session.c  2008-08-18 21:07:10.000000000 -0700
+++ session.c   2008-08-18 21:12:51.000000000 -0700
@@ -781,7 +781,7 @@
        if (options.adm_forced_command) {
                original_command = command;
                command = options.adm_forced_command;
-               if (strcmp(INTERNAL_SFTP_NAME, command) == 0)
+               if (strncmp(INTERNAL_SFTP_NAME, command,
strlen(INTERNAL_SFTP_NAME)) == 0 && isspace(command[strlen(
INTERNAL_SFTP_NAME)]))
                        s->is_subsystem = SUBSYSTEM_INT_SFTP;
                else if (s->is_subsystem)
                        s->is_subsystem = SUBSYSTEM_EXT;
@@ -789,7 +789,7 @@
        } else if (forced_command) {
                original_command = command;
                command = forced_command;
-               if (strcmp(INTERNAL_SFTP_NAME, command) == 0)
+               if (strncmp(INTERNAL_SFTP_NAME, command,
strlen(INTERNAL_SFTP_NAME)) == 0 &&
isspace(command[strlen(INTERNAL_SFTP_NAME)]))
                        s->is_subsystem = SUBSYSTEM_INT_SFTP;
                else if (s->is_subsystem)
                        s->is_subsystem = SUBSYSTEM_EXT;


More information about the openssh-unix-dev mailing list