summaryrefslogtreecommitdiff
path: root/session.c
diff options
context:
space:
mode:
Diffstat (limited to 'session.c')
-rw-r--r--session.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/session.c b/session.c
index 93babf957..f2549e0cd 100644
--- a/session.c
+++ b/session.c
@@ -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.245 2009/01/22 09:46:01 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
100Session *session_new(void); 106Session *session_new(void);
@@ -228,7 +234,7 @@ auth_input_request_forwarding(struct passwd * pw)
228 SSH_CHANNEL_AUTH_SOCKET, sock, sock, -1, 234 SSH_CHANNEL_AUTH_SOCKET, sock, sock, -1,
229 CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, 235 CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT,
230 0, "auth socket", 1); 236 0, "auth socket", 1);
231 strlcpy(nc->path, auth_sock_name, sizeof(nc->path)); 237 nc->path = xstrdup(auth_sock_name);
232 return 1; 238 return 1;
233 239
234 authsock_err: 240 authsock_err:
@@ -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;
@@ -926,7 +932,7 @@ check_quietlogin(Session *s, const char *command)
926 932
927/* 933/*
928 * Sets the value of the given variable in the environment. If the variable 934 * Sets the value of the given variable in the environment. If the variable
929 * already exists, its value is overriden. 935 * already exists, its value is overridden.
930 */ 936 */
931void 937void
932child_set_env(char ***envp, u_int *envsizep, const char *name, 938child_set_env(char ***envp, u_int *envsizep, const char *name,
@@ -1789,7 +1795,7 @@ do_child(Session *s, const char *command)
1789 char *p, *args; 1795 char *p, *args;
1790 1796
1791 setproctitle("%s@internal-sftp-server", s->pw->pw_name); 1797 setproctitle("%s@internal-sftp-server", s->pw->pw_name);
1792 args = strdup(command ? command : "sftp-server"); 1798 args = xstrdup(command ? command : "sftp-server");
1793 for (i = 0, (p = strtok(args, " ")); p; (p = strtok(NULL, " "))) 1799 for (i = 0, (p = strtok(args, " ")); p; (p = strtok(NULL, " ")))
1794 if (i < ARGV_MAX - 1) 1800 if (i < ARGV_MAX - 1)
1795 argv[i++] = p; 1801 argv[i++] = p;