]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
put back some portable bits for sshd-auth.c
authorDamien Miller <djm@mindrot.org>
Mon, 14 Oct 2024 06:16:41 +0000 (17:16 +1100)
committerDamien Miller <djm@mindrot.org>
Mon, 14 Oct 2024 06:16:41 +0000 (17:16 +1100)
sshd-auth.c

index 52bbd0b9ae8cfeb8627e0aab3cf72b9abac3db0f..53658cf11f0e2a914273cd7c67285d1c42037045 100644 (file)
@@ -42,7 +42,9 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <netdb.h>
-#include <paths.h>
+#ifdef HAVE_PATHS_H
+# include <paths.h>
+#endif
 #include <pwd.h>
 #include <grp.h>
 #include <signal.h>
@@ -456,8 +458,23 @@ main(int ac, char **av)
        sigemptyset(&sigmask);
        sigprocmask(SIG_SETMASK, &sigmask, NULL);
 
-       /* Save argv. */
-       saved_argv = av;
+#ifdef HAVE_SECUREWARE
+       (void)set_auth_parameters(ac, av);
+#endif
+       __progname = ssh_get_progname(av[0]);
+
+       /* Save argv. Duplicate so setproctitle emulation doesn't clobber it */
+       saved_argc = ac;
+       saved_argv = xcalloc(ac + 1, sizeof(*saved_argv));
+       for (i = 0; (int)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
 
        /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
        sanitise_stdfd();