]> andersk Git - openssh.git/blobdiff - serverloop.c
- (bal) NO_IPPORT_RESERVED_CONCEPT used instead of CYGWIN so other platforms
[openssh.git] / serverloop.c
index 46b12ee3d3d73cde2992875d026bb0c865e8e648..912f625015d6b428a4d9cb73ca6cbf3791724a46 100644 (file)
@@ -35,7 +35,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: serverloop.c,v 1.98 2002/02/06 14:55:16 markus Exp $");
+RCSID("$OpenBSD: serverloop.c,v 1.103 2002/06/24 14:33:27 markus Exp $");
 
 #include "xmalloc.h"
 #include "packet.h"
@@ -318,9 +318,6 @@ wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, int *maxfdp,
                tv.tv_usec = 1000 * (max_time_milliseconds % 1000);
                tvp = &tv;
        }
-       if (tvp!=NULL)
-               debug3("tvp!=NULL kid %d mili %d", (int) child_terminated,
-                   max_time_milliseconds);
 
        /* Wait for something to happen, or the timeout to expire. */
        ret = select((*maxfdp)+1, *readsetp, *writesetp, NULL, tvp);
@@ -673,12 +670,12 @@ server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg)
        /* We no longer want our SIGCHLD handler to be called. */
        mysignal(SIGCHLD, SIG_DFL);
 
-       wait_pid = waitpid(-1, &wait_status, 0);
-       if (wait_pid == -1)
-               packet_disconnect("wait: %.100s", strerror(errno));
-       else if (wait_pid != pid)
-               error("Strange, wait returned pid %d, expected %d",
-                   wait_pid, pid);
+       while ((wait_pid = waitpid(-1, &wait_status, 0)) < 0)
+               if (errno != EINTR)
+                       packet_disconnect("wait: %.100s", strerror(errno));
+       if (wait_pid != pid)
+               error("Strange, wait returned pid %ld, expected %ld",
+                   (long)wait_pid, (long)pid);
 
        /* Check if it exited normally. */
        if (WIFEXITED(wait_status)) {
@@ -726,8 +723,10 @@ collect_children(void)
        sigaddset(&nset, SIGCHLD);
        sigprocmask(SIG_BLOCK, &nset, &oset);
        if (child_terminated) {
-               while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
-                       session_close_by_pid(pid, status);
+               while ((pid = waitpid(-1, &status, WNOHANG)) > 0 ||
+                   (pid < 0 && errno == EINTR))
+                       if (pid > 0)
+                               session_close_by_pid(pid, status);
                child_terminated = 0;
        }
        sigprocmask(SIG_SETMASK, &oset, NULL);
@@ -784,7 +783,7 @@ server_loop2(Authctxt *authctxt)
        channel_free_all();
 
        /* free remaining sessions, e.g. remove wtmp entries */
-       session_destroy_all();
+       session_destroy_all(NULL);
 }
 
 static void
@@ -903,10 +902,8 @@ server_input_channel_open(int type, u_int32_t seq, void *ctxt)
 {
        Channel *c = NULL;
        char *ctype;
-       u_int len;
        int rchan;
-       int rmaxpack;
-       int rwindow;
+       u_int rmaxpack, rwindow, len;
 
        ctype = packet_get_string(&len);
        rchan = packet_get_int();
@@ -975,8 +972,11 @@ server_input_global_request(int type, u_int32_t seq, void *ctxt)
 
                /* check permissions */
                if (!options.allow_tcp_forwarding ||
-                   no_port_forwarding_flag ||
-                   (listen_port < IPPORT_RESERVED && pw->pw_uid != 0)) {
+                   no_port_forwarding_flag
+#ifndef NO_IPPORT_RESERVED_CONCEPT
+                   || (listen_port < IPPORT_RESERVED && pw->pw_uid != 0)
+#endif
+                  ) {
                        success = 0;
                        packet_send_debug("Server has disabled port forwarding.");
                } else {
This page took 0.073292 seconds and 4 git commands to generate.