diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 1999-11-16 21:15:20 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 1999-11-16 21:15:20 +0000 |
commit | 8f049ae088053b04ad5e6233ff6757346e68c83e (patch) | |
tree | 6db45515d758ebe797f46e8807406cd60e756d7d /usr.bin/ssh | |
parent | 28f119163244e31a5e43530b83cc6c92c1270692 (diff) |
force logging to stderr while loading private key file
(lost while converting to new log-levels)
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r-- | usr.bin/ssh/sshd.c | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/usr.bin/ssh/sshd.c b/usr.bin/ssh/sshd.c index 46c9e0666b9..1dacc774847 100644 --- a/usr.bin/ssh/sshd.c +++ b/usr.bin/ssh/sshd.c @@ -18,7 +18,7 @@ agent connections. */ #include "includes.h" -RCSID("$Id: sshd.c,v 1.55 1999/11/15 21:38:54 markus Exp $"); +RCSID("$Id: sshd.c,v 1.56 1999/11/16 21:15:19 markus Exp $"); #include "xmalloc.h" #include "rsa.h" @@ -339,35 +339,29 @@ main(int ac, char **av) exit(1); } - /* Initialize the log (it is reinitialized below in case we forked). */ - - if (debug_flag && !inetd_flag) - log_stderr = 1; - - log_init(av0, options.log_level, options.log_facility, log_stderr); + /* Force logging to stderr while loading the private host key + unless started from inetd */ + log_init(av0, options.log_level, options.log_facility, !inetd_flag); debug("sshd version %.100s", SSH_VERSION); sensitive_data.host_key = RSA_new(); + errno = 0; /* Load the host key. It must have empty passphrase. */ if (!load_private_key(options.host_key_file, "", sensitive_data.host_key, &comment)) { - if (debug_flag) - fprintf(stderr, "Could not load host key: %s: %s\n", - options.host_key_file, strerror(errno)); - else - { - int err = errno; - /* force logging */ - log_init(av0, SYSLOG_LEVEL_DEBUG, options.log_facility, log_stderr); - error("Could not load host key: %.200s: %.100s", - options.host_key_file, strerror(err)); - } + error("Could not load host key: %.200s: %.100s", + options.host_key_file, strerror(errno)); exit(1); } xfree(comment); + /* Initialize the log (it is reinitialized below in case we forked). */ + if (debug_flag && !inetd_flag) + log_stderr = 1; + log_init(av0, options.log_level, options.log_facility, log_stderr); + /* If not in debugging mode, and not started from inetd, disconnect from the controlling terminal, and fork. The original process exits. */ if (!debug_flag && !inetd_flag) |