]> andersk Git - openssh.git/commitdiff
- djm@cvs.openbsd.org 2008/08/21 04:09:57
authordjm <djm>
Mon, 3 Nov 2008 08:17:57 +0000 (08:17 +0000)
committerdjm <djm>
Mon, 3 Nov 2008 08:17:57 +0000 (08:17 +0000)
     [session.c]
     allow ForceCommand internal-sftp with arguments. based on patch from
     michael.barabanov AT gmail.com; ok markus@

ChangeLog
session.c

index 6e81075c783df226eb36a3861176136b6431e984..dcc1977f06a993db8b1b9125dc36f955bf08f51e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
    - krw@cvs.openbsd.org 2008/08/02 04:29:51
      [ssh_config.5]
      whitepsace -> whitespace. From Matthew Clarke via bugs@.
+   - djm@cvs.openbsd.org 2008/08/21 04:09:57
+     [session.c]
+     allow ForceCommand internal-sftp with arguments. based on patch from
+     michael.barabanov AT gmail.com; ok markus@
 
 20080906
  - (dtucker) [config.guess config.sub] Update to latest versions from
index 93babf95701a723398e098d8965c1579ac269dac..471018bc9039aa8bb123f3e15df6becfc87bc8b6 100644 (file)
--- a/session.c
+++ b/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.241 2008/06/16 13:22:53 dtucker Exp $ */
+/* $OpenBSD: session.c,v 1.242 2008/08/21 04:09:57 djm Exp $ */
 /*
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
  *                    All rights reserved
 #include <kafs.h>
 #endif
 
+#define IS_INTERNAL_SFTP(c) \
+       (!strncmp(c, INTERNAL_SFTP_NAME, sizeof(INTERNAL_SFTP_NAME) - 1) && \
+        (c[sizeof(INTERNAL_SFTP_NAME) - 1] == '\0' || \
+         c[sizeof(INTERNAL_SFTP_NAME) - 1] == ' ' || \
+         c[sizeof(INTERNAL_SFTP_NAME) - 1] == '\t'))
+
 /* func */
 
 Session *session_new(void);
@@ -781,7 +787,7 @@ do_exec(Session *s, const char *command)
        if (options.adm_forced_command) {
                original_command = command;
                command = options.adm_forced_command;
-               if (strcmp(INTERNAL_SFTP_NAME, command) == 0)
+               if (IS_INTERNAL_SFTP(command))
                        s->is_subsystem = SUBSYSTEM_INT_SFTP;
                else if (s->is_subsystem)
                        s->is_subsystem = SUBSYSTEM_EXT;
@@ -789,7 +795,7 @@ do_exec(Session *s, const char *command)
        } else if (forced_command) {
                original_command = command;
                command = forced_command;
-               if (strcmp(INTERNAL_SFTP_NAME, command) == 0)
+               if (IS_INTERNAL_SFTP(command))
                        s->is_subsystem = SUBSYSTEM_INT_SFTP;
                else if (s->is_subsystem)
                        s->is_subsystem = SUBSYSTEM_EXT;
This page took 0.05425 seconds and 5 git commands to generate.