diff options
author | Colin Watson <cjwatson@debian.org> | 2010-01-01 17:15:23 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2010-01-01 17:15:23 +0000 |
commit | 99b402ea4c8457b0a3cafff37f5b3410a8dc6476 (patch) | |
tree | 1d24ce54c9981ea8cbb4c5a9309964a0e4c4b320 /session.c | |
parent | 87552344215a38d3a2b0d4d63dc151e05978bbe1 (diff) | |
parent | 54af7a4ae8d455791a631bdfaade4b64436ae16a (diff) |
import openssh-5.2p1-gsskex-all-20090726.patch
Diffstat (limited to 'session.c')
-rw-r--r-- | session.c | 18 |
1 files changed, 12 insertions, 6 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.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 | ||
100 | Session *session_new(void); | 106 | Session *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 | */ |
931 | void | 937 | void |
932 | child_set_env(char ***envp, u_int *envsizep, const char *name, | 938 | child_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; |