]> andersk Git - openssh.git/blobdiff - sshd.c
- deraadt@cvs.openbsd.org 2003/06/10 22:20:52
[openssh.git] / sshd.c
diff --git a/sshd.c b/sshd.c
index 9e2e218c6c1958e825ead764601e4d53e1c821c3..bc458488be0835dea20cba9e85134c193187348e 100644 (file)
--- a/sshd.c
+++ b/sshd.c
@@ -42,7 +42,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: sshd.c,v 1.265 2003/04/14 14:17:50 markus Exp $");
+RCSID("$OpenBSD: sshd.c,v 1.268 2003/06/04 10:23:48 djm Exp $");
 
 #include <openssl/dh.h>
 #include <openssl/bn.h>
@@ -112,11 +112,7 @@ char *config_file_name = _PATH_SERVER_CONFIG_FILE;
  * Flag indicating whether IPv4 or IPv6.  This can be set on the command line.
  * Default value is AF_UNSPEC means both IPv4 and IPv6.
  */
-#ifdef IPV4_DEFAULT
-int IPv4or6 = AF_INET;
-#else
 int IPv4or6 = AF_UNSPEC;
-#endif
 
 /*
  * Debug mode flag.  This can be set on the command line.  If debug
@@ -568,8 +564,6 @@ privsep_preauth_child(void)
        do_setusercontext(pw);
 #else
        gidset[0] = pw->pw_gid;
-       if (setgid(pw->pw_gid) < 0)
-               fatal("setgid failed for %u", pw->pw_gid );
        if (setgroups(1, gidset) < 0)
                fatal("setgroups: %.100s", strerror(errno));
        permanently_set_uid(pw);
@@ -829,14 +823,15 @@ main(int ac, char **av)
 
        /* Save argv. Duplicate so setproctitle emulation doesn't clobber it */
        saved_argc = ac;
-       saved_argv = av;
-       saved_argv = xmalloc(sizeof(*saved_argv) * ac);
+       saved_argv = xmalloc(sizeof(*saved_argv) * (ac + 1));
        for (i = 0; i < ac; i++)
                saved_argv[i] = xstrdup(av[i]);
+       saved_argv[i] = NULL;
 
 #ifndef HAVE_SETPROCTITLE
        /* Prepare for later setproctitle emulation */
        compat_init_setproctitle(ac, av);
+       av = saved_argv;
 #endif
 
        /* Initialize configuration options to their default values. */
@@ -1378,7 +1373,7 @@ main(int ac, char **av)
                                if ((options.protocol & SSH_PROTO_1) &&
                                    key_used == 0) {
                                        /* Schedule server key regeneration alarm. */
-                                       signal(SIGALRM, key_regeneration_alarm);
+                                       mysignal(SIGALRM, key_regeneration_alarm);
                                        alarm(options.key_regeneration_time);
                                        key_used = 1;
                                }
@@ -1467,7 +1462,7 @@ main(int ac, char **av)
         * mode; it is just annoying to have the server exit just when you
         * are about to discover the bug.
         */
-       signal(SIGALRM, grace_alarm_handler);
+       mysignal(SIGALRM, grace_alarm_handler);
        if (!debug_flag)
                alarm(options.login_grace_time);
 
@@ -1544,7 +1539,8 @@ main(int ac, char **av)
        verbose("Closing connection to %.100s", remote_ip);
 
 #ifdef USE_PAM
-       finish_pam();
+       if (options.use_pam)
+               finish_pam();
 #endif /* USE_PAM */
 
        packet_close();
This page took 0.036112 seconds and 4 git commands to generate.