diff options
Diffstat (limited to 'session.c')
-rw-r--r-- | session.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: session.c,v 1.241 2008/06/16 13:22:53 dtucker Exp $ */ | 1 | /* $OpenBSD: session.c,v 1.242 2008/08/21 04:09:57 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
4 | * All rights reserved | 4 | * All rights reserved |
@@ -95,6 +95,12 @@ | |||
95 | #include <kafs.h> | 95 | #include <kafs.h> |
96 | #endif | 96 | #endif |
97 | 97 | ||
98 | #define IS_INTERNAL_SFTP(c) \ | ||
99 | (!strncmp(c, INTERNAL_SFTP_NAME, sizeof(INTERNAL_SFTP_NAME) - 1) && \ | ||
100 | (c[sizeof(INTERNAL_SFTP_NAME) - 1] == '\0' || \ | ||
101 | c[sizeof(INTERNAL_SFTP_NAME) - 1] == ' ' || \ | ||
102 | c[sizeof(INTERNAL_SFTP_NAME) - 1] == '\t')) | ||
103 | |||
98 | /* func */ | 104 | /* func */ |
99 | 105 | ||
100 | Session *session_new(void); | 106 | Session *session_new(void); |
@@ -781,7 +787,7 @@ do_exec(Session *s, const char *command) | |||
781 | if (options.adm_forced_command) { | 787 | if (options.adm_forced_command) { |
782 | original_command = command; | 788 | original_command = command; |
783 | command = options.adm_forced_command; | 789 | command = options.adm_forced_command; |
784 | if (strcmp(INTERNAL_SFTP_NAME, command) == 0) | 790 | if (IS_INTERNAL_SFTP(command)) |
785 | s->is_subsystem = SUBSYSTEM_INT_SFTP; | 791 | s->is_subsystem = SUBSYSTEM_INT_SFTP; |
786 | else if (s->is_subsystem) | 792 | else if (s->is_subsystem) |
787 | s->is_subsystem = SUBSYSTEM_EXT; | 793 | s->is_subsystem = SUBSYSTEM_EXT; |
@@ -789,7 +795,7 @@ do_exec(Session *s, const char *command) | |||
789 | } else if (forced_command) { | 795 | } else if (forced_command) { |
790 | original_command = command; | 796 | original_command = command; |
791 | command = forced_command; | 797 | command = forced_command; |
792 | if (strcmp(INTERNAL_SFTP_NAME, command) == 0) | 798 | if (IS_INTERNAL_SFTP(command)) |
793 | s->is_subsystem = SUBSYSTEM_INT_SFTP; | 799 | s->is_subsystem = SUBSYSTEM_INT_SFTP; |
794 | else if (s->is_subsystem) | 800 | else if (s->is_subsystem) |
795 | s->is_subsystem = SUBSYSTEM_EXT; | 801 | s->is_subsystem = SUBSYSTEM_EXT; |