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

Michael Barabanov michael.barabanov at gmail.com
Wed Aug 20 04:37:47 EST 2008


The previous version broke the case of internal-sftp without arguments. This
is a fixed version.

--- /var/tmp/session.c  2008-08-18 21:07:10.000000000 -0700
+++ session.c   2008-08-19 11:28:29.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 (strcmp(INTERNAL_SFTP_NAME, command) == 0 ||
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 (strcmp(INTERNAL_SFTP_NAME, command) == 0 ||
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