diff options
Diffstat (limited to 'sshd.c')
-rw-r--r-- | sshd.c | 30 |
1 files changed, 12 insertions, 18 deletions
@@ -18,7 +18,7 @@ agent connections. | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include "includes.h" | 20 | #include "includes.h" |
21 | RCSID("$Id: sshd.c,v 1.21 1999/11/16 02:37:17 damien Exp $"); | 21 | RCSID("$Id: sshd.c,v 1.22 1999/11/17 06:29:08 damien Exp $"); |
22 | 22 | ||
23 | #include "xmalloc.h" | 23 | #include "xmalloc.h" |
24 | #include "rsa.h" | 24 | #include "rsa.h" |
@@ -486,35 +486,29 @@ main(int ac, char **av) | |||
486 | exit(1); | 486 | exit(1); |
487 | } | 487 | } |
488 | 488 | ||
489 | /* Initialize the log (it is reinitialized below in case we forked). */ | 489 | /* Force logging to stderr while loading the private host key |
490 | 490 | unless started from inetd */ | |
491 | if (debug_flag && !inetd_flag) | 491 | log_init(av0, options.log_level, options.log_facility, !inetd_flag); |
492 | log_stderr = 1; | ||
493 | |||
494 | log_init(av0, options.log_level, options.log_facility, log_stderr); | ||
495 | 492 | ||
496 | debug("sshd version %.100s", SSH_VERSION); | 493 | debug("sshd version %.100s", SSH_VERSION); |
497 | 494 | ||
498 | sensitive_data.host_key = RSA_new(); | 495 | sensitive_data.host_key = RSA_new(); |
496 | errno = 0; | ||
499 | /* Load the host key. It must have empty passphrase. */ | 497 | /* Load the host key. It must have empty passphrase. */ |
500 | if (!load_private_key(options.host_key_file, "", | 498 | if (!load_private_key(options.host_key_file, "", |
501 | sensitive_data.host_key, &comment)) | 499 | sensitive_data.host_key, &comment)) |
502 | { | 500 | { |
503 | if (debug_flag) | 501 | error("Could not load host key: %.200s: %.100s", |
504 | fprintf(stderr, "Could not load host key: %s: %s\n", | 502 | options.host_key_file, strerror(errno)); |
505 | options.host_key_file, strerror(errno)); | ||
506 | else | ||
507 | { | ||
508 | int err = errno; | ||
509 | /* force logging */ | ||
510 | log_init(av0, SYSLOG_LEVEL_DEBUG, options.log_facility, log_stderr); | ||
511 | error("Could not load host key: %.200s: %.100s", | ||
512 | options.host_key_file, strerror(err)); | ||
513 | } | ||
514 | exit(1); | 503 | exit(1); |
515 | } | 504 | } |
516 | xfree(comment); | 505 | xfree(comment); |
517 | 506 | ||
507 | /* Initialize the log (it is reinitialized below in case we forked). */ | ||
508 | if (debug_flag && !inetd_flag) | ||
509 | log_stderr = 1; | ||
510 | log_init(av0, options.log_level, options.log_facility, log_stderr); | ||
511 | |||
518 | /* If not in debugging mode, and not started from inetd, disconnect from | 512 | /* If not in debugging mode, and not started from inetd, disconnect from |
519 | the controlling terminal, and fork. The original process exits. */ | 513 | the controlling terminal, and fork. The original process exits. */ |
520 | if (!debug_flag && !inetd_flag) | 514 | if (!debug_flag && !inetd_flag) |