diff options
author | Damien Miller <djm@mindrot.org> | 2024-10-14 08:16:41 +0200 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2024-10-14 08:16:41 +0200 |
commit | 164ea4380564a2a83713eacf71908e3946e5e4e4 (patch) | |
tree | cb54f973182c313aa4c512bdd508cb0eda3aaee6 | |
parent | there's only one sandbox, move to a static global (diff) | |
download | openssh-164ea4380564a2a83713eacf71908e3946e5e4e4.tar.xz openssh-164ea4380564a2a83713eacf71908e3946e5e4e4.zip |
put back some portable bits for sshd-auth.c
-rw-r--r-- | sshd-auth.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/sshd-auth.c b/sshd-auth.c index 52bbd0b9a..53658cf11 100644 --- a/sshd-auth.c +++ b/sshd-auth.c @@ -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(); |