From e68e88d2de7449b53c98ad7fc3e1ff169313bef3 Mon Sep 17 00:00:00 2001 From: Alex Wilson <alex.wilson@joyent.com> Date: Wed, 5 Aug 2015 12:25:15 -0700 Subject: [PATCH 21/34] Try to create privsep chroot dir if it doesn't exist yet --- openssh-10.0p1/sshd-auth.c.orig +++ openssh-10.0p1/sshd-auth.c @@ -189,6 +189,20 @@ #endif /* Demote the child */ if (privsep_chroot) { + struct stat st; + int rc; + + if ((stat(_PATH_PRIVSEP_CHROOT_DIR, &st) == -1) || + (S_ISDIR(st.st_mode) == 0)) { + rc = mkdir(_PATH_PRIVSEP_CHROOT_DIR, 0755); + if (rc != 0) { + fatal("Failed to create privilege separation " + "directory %s: %s", + _PATH_PRIVSEP_CHROOT_DIR, + strerror(errno)); + } + } + /* Change our root directory */ if (chroot(_PATH_PRIVSEP_CHROOT_DIR) == -1) fatal("chroot(\"%s\"): %s", _PATH_PRIVSEP_CHROOT_DIR,