]> andersk Git - openssh.git/blobdiff - serverloop.c
- (djm) Add pointer to http://www.imasy.or.jp/~gotoh/connect.c to
[openssh.git] / serverloop.c
index 0c07a2821a82da82bdc68a7a213051fd3c142375..6a81806bbda1340f7e835bf301f973f439950929 100644 (file)
@@ -35,6 +35,8 @@
  */
 
 #include "includes.h"
+RCSID("$OpenBSD: serverloop.c,v 1.34 2000/10/27 07:32:18 markus Exp $");
+
 #include "xmalloc.h"
 #include "ssh.h"
 #include "packet.h"
@@ -49,6 +51,8 @@
 #include "dispatch.h"
 #include "auth-options.h"
 
+extern ServerOptions options;
+
 static Buffer stdin_buffer;    /* Buffer for stdin data. */
 static Buffer stdout_buffer;   /* Buffer for stdout data. */
 static Buffer stderr_buffer;   /* Buffer for stderr data. */
@@ -97,9 +101,10 @@ sigchld_handler(int sig)
                        error("Strange, got SIGCHLD and wait returned pid %d but child is %d",
                              wait_pid, child_pid);
                if (WIFEXITED(child_wait_status) ||
-                   WIFSIGNALED(child_wait_status))
+                   WIFSIGNALED(child_wait_status)) {
                        child_terminated = 1;
                        child_has_selected = 0;
+               }
        }
        signal(SIGCHLD, sigchld_handler);
        errno = save_errno;
@@ -110,6 +115,7 @@ sigchld_handler2(int sig)
        int save_errno = errno;
        debug("Received SIGCHLD.");
        child_terminated = 1;
+       child_has_selected = 0;
        errno = save_errno;
 }
 
@@ -676,6 +682,7 @@ server_loop2(void)
                        while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
                                session_close_by_pid(pid, status);
                        child_terminated = 0;
+                       child_has_selected = 0;
                        signal(SIGCHLD, sigchld_handler2);
                }
                channel_after_select(&readset, &writeset);
@@ -749,7 +756,7 @@ input_direct_tcpip(void)
           originator, originator_port, target, target_port);
 
        /* XXX check permission */
-       if (no_port_forwarding_flag) {
+       if (no_port_forwarding_flag || !options.allow_tcp_forwarding) {
                xfree(target);
                xfree(originator);
                return -1;
@@ -761,7 +768,7 @@ input_direct_tcpip(void)
                return -1;
        return channel_new("direct-tcpip", SSH_CHANNEL_OPEN,
            sock, sock, -1, CHAN_TCP_WINDOW_DEFAULT,
-           CHAN_TCP_PACKET_DEFAULT, 0, xstrdup("direct-tcpip"));
+           CHAN_TCP_PACKET_DEFAULT, 0, xstrdup("direct-tcpip"), 1);
 }
 
 void
@@ -795,7 +802,7 @@ server_input_channel_open(int type, int plen, void *ctxt)
                 */
                id = channel_new(ctype, SSH_CHANNEL_LARVAL,
                    -1, -1, -1, 0, CHAN_SES_PACKET_DEFAULT,
-                   0, xstrdup("server-session"));
+                   0, xstrdup("server-session"), 1);
                if (session_open(id) == 1) {
                        channel_register_callback(id, SSH2_MSG_CHANNEL_REQUEST,
                            session_input_channel_req, (void *)0);
This page took 0.344957 seconds and 4 git commands to generate.