summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2008-11-03 19:17:57 +1100
committerDamien Miller <djm@mindrot.org>2008-11-03 19:17:57 +1100
commitad793d59a95a3b69f705c46bcf4f6e720b65f32f (patch)
tree7d2c1fefd877e69ed757f33d26a2fe49868dc059
parentfa51b1626c56b848d488d356be897dc41751b490 (diff)
- 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@
-rw-r--r--ChangeLog6
-rw-r--r--session.c12
2 files changed, 14 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index c8840cbf..8bfe8ea1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -18,6 +18,10 @@
- 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
@@ -4752,4 +4756,4 @@
OpenServer 6 and add osr5bigcrypt support so when someone migrates
passwords between UnixWare and OpenServer they will still work. OK dtucker@
-$Id: ChangeLog,v 1.5103 2008/11/03 08:17:33 djm Exp $
+$Id: ChangeLog,v 1.5104 2008/11/03 08:17:57 djm Exp $
diff --git a/session.c b/session.c
index 93babf95..471018bc 100644
--- 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
@@ -95,6 +95,12 @@
#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;