*/
#include "includes.h"
-RCSID("$OpenBSD: sshd.c,v 1.254 2002/06/30 21:54:16 deraadt Exp $");
+RCSID("$OpenBSD: sshd.c,v 1.257 2002/07/23 16:03:10 stevesk Exp $");
#include <openssl/dh.h>
#include <openssl/bn.h>
{
/* XXX no idea how fix this signal handler */
- /* Close the connection. */
- packet_close();
-
/* Log error and exit. */
fatal("Timeout before authentication for %s.", get_remote_ipaddr());
}
memset(pw->pw_passwd, 0, strlen(pw->pw_passwd));
endpwent();
- /* Change our root directory*/
+ /* Change our root directory */
if (chroot(_PATH_PRIVSEP_CHROOT_DIR) == -1)
fatal("chroot(\"%s\"): %s", _PATH_PRIVSEP_CHROOT_DIR,
strerror(errno));
#endif
}
-static Authctxt*
+static Authctxt *
privsep_preauth(void)
{
Authctxt *authctxt = NULL;
if (pid == -1) {
fatal("fork of unprivileged child failed");
} else if (pid != 0) {
+ fatal_remove_cleanup((void (*) (void *)) packet_close, NULL);
+
debug2("Network child is on pid %ld", (long)pid);
close(pmonitor->m_recvfd);
while (waitpid(pid, &status, 0) < 0)
if (errno != EINTR)
break;
+
+ /* Reinstall, since the child has finished */
+ fatal_add_cleanup((void (*) (void *)) packet_close, NULL);
+
return (authctxt);
} else {
/* child */
/* XXX - Remote port forwarding */
x_authctxt = authctxt;
-#ifdef BROKEN_FD_PASSING
+#ifdef DISABLE_FD_PASSING
if (1) {
#else
if (authctxt->pw->pw_uid == 0 || options.use_login) {
if (pmonitor->m_pid == -1)
fatal("fork of unprivileged child failed");
else if (pmonitor->m_pid != 0) {
+ fatal_remove_cleanup((void (*) (void *)) packet_close, NULL);
+
debug2("User child is on pid %ld", (long)pmonitor->m_pid);
close(pmonitor->m_recvfd);
monitor_child_postauth(pmonitor);
break;
case 'u':
utmp_len = atoi(optarg);
- if (utmp_len < 0 || utmp_len > MAXHOSTNAMELEN)
- usage();
+ if (utmp_len > MAXHOSTNAMELEN) {
+ fprintf(stderr, "Invalid utmp length.\n");
+ exit(1);
+ }
break;
case 'o':
if (process_server_config_line(&options, optarg,
SYSLOG_FACILITY_AUTH : options.log_facility,
!inetd_flag);
-#ifdef _CRAY
+#if defined(_CRAY) && !defined(_CRAYSV2)
/* Cray can define user privs drop all prives now!
* Not needed on PRIV_SU systems!
*/
debug("sshd version %.100s", SSH_VERSION);
/* load private host keys */
- sensitive_data.host_keys = xmalloc(options.num_host_key_files*sizeof(Key*));
+ sensitive_data.host_keys = xmalloc(options.num_host_key_files *
+ sizeof(Key *));
for (i = 0; i < options.num_host_key_files; i++)
sensitive_data.host_keys[i] = NULL;
sensitive_data.server_key = NULL;