X-Git-Url: http://andersk.mit.edu/gitweb/gssapi-openssh.git/blobdiff_plain/0400944949b1e668235774778642b08f983a5947..refs/tags/OPENSSH_5_2P1_GSSAPI_20090225_GPT-merged:/openssh/session.c diff --git a/openssh/session.c b/openssh/session.c index 31d65c9..9bdc02b 100644 --- a/openssh/session.c +++ b/openssh/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.245 2009/01/22 09:46:01 djm Exp $ */ /* * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland * All rights reserved @@ -95,6 +95,12 @@ #include #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); @@ -234,7 +240,7 @@ auth_input_request_forwarding(struct passwd * pw) SSH_CHANNEL_AUTH_SOCKET, sock, sock, -1, CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, 0, "auth socket", 1); - strlcpy(nc->path, auth_sock_name, sizeof(nc->path)); + nc->path = xstrdup(auth_sock_name); return 1; authsock_err: @@ -802,7 +808,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; @@ -810,7 +816,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; @@ -967,7 +973,7 @@ check_quietlogin(Session *s, const char *command) /* * Sets the value of the given variable in the environment. If the variable - * already exists, its value is overriden. + * already exists, its value is overridden. */ void child_set_env(char ***envp, u_int *envsizep, const char *name, @@ -2009,7 +2015,7 @@ do_child(Session *s, const char *command) char *p, *args; setproctitle("%s@internal-sftp-server", s->pw->pw_name); - args = strdup(command ? command : "sftp-server"); + args = xstrdup(command ? command : "sftp-server"); for (i = 0, (p = strtok(args, " ")); p; (p = strtok(NULL, " "))) if (i < ARGV_MAX - 1) argv[i++] = p;