]> andersk Git - openssh.git/blobdiff - session.c
- dtucker@cvs.openbsd.org 2006/07/19 08:56:41
[openssh.git] / session.c
index caf750ab4f4df840900144158c4ba5ae949fb7c8..5441a47624cf3ee5ae49dc5f9597e00fe49d7798 100644 (file)
--- a/session.c
+++ b/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.203 2006/04/20 21:53:44 djm Exp $ */
+/* $OpenBSD: session.c,v 1.209 2006/07/11 20:07:25 stevesk Exp $ */
 /*
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
  *                    All rights reserved
 #ifdef HAVE_SYS_STAT_H
 # include <sys/stat.h>
 #endif
+#include <sys/socket.h>
 #include <sys/wait.h>
 #include <sys/un.h>
 
+#include <errno.h>
+#include <grp.h>
 #ifdef HAVE_PATHS_H
 #include <paths.h>
 #endif
+#include <pwd.h>
 #include <signal.h>
+#include <arpa/inet.h>
 
 #include "ssh.h"
 #include "ssh1.h"
@@ -334,7 +339,11 @@ do_authenticated1(Authctxt *authctxt)
                                break;
                        }
                        debug("Received TCP/IP port forwarding request.");
-                       channel_input_port_forward_request(s->pw->pw_uid == 0, options.gateway_ports);
+                       if (channel_input_port_forward_request(s->pw->pw_uid == 0,
+                           options.gateway_ports) < 0) {
+                               debug("Port forwarding failed.");
+                               break;
+                       }
                        success = 1;
                        break;
 
@@ -984,7 +993,7 @@ do_setup_env(Session *s, const char *shell)
 
        /* Initialize the environment. */
        envsize = 100;
-       env = xmalloc(envsize * sizeof(char *));
+       env = xcalloc(envsize, sizeof(char *));
        env[0] = NULL;
 
 #ifdef HAVE_CYGWIN
@@ -1839,7 +1848,7 @@ session_subsystem_req(Session *s)
        struct stat st;
        u_int len;
        int success = 0;
-       char *cmd, *subsys = packet_get_string(&len);
+       char *prog, *cmd, *subsys = packet_get_string(&len);
        u_int i;
 
        packet_check_eom();
@@ -1847,9 +1856,10 @@ session_subsystem_req(Session *s)
 
        for (i = 0; i < options.num_subsystems; i++) {
                if (strcmp(subsys, options.subsystem_name[i]) == 0) {
-                       cmd = options.subsystem_command[i];
-                       if (stat(cmd, &st) < 0) {
-                               error("subsystem: cannot stat %s: %s", cmd,
+                       prog = options.subsystem_command[i];
+                       cmd = options.subsystem_args[i];
+                       if (stat(prog, &st) < 0) {
+                               error("subsystem: cannot stat %s: %s", prog,
                                    strerror(errno));
                                break;
                        }
This page took 0.051066 seconds and 4 git commands to generate.