diff options
Diffstat (limited to 'sshd.c')
-rw-r--r-- | sshd.c | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -40,7 +40,7 @@ | |||
40 | */ | 40 | */ |
41 | 41 | ||
42 | #include "includes.h" | 42 | #include "includes.h" |
43 | RCSID("$OpenBSD: sshd.c,v 1.202 2001/06/26 16:15:25 dugsong Exp $"); | 43 | RCSID("$OpenBSD: sshd.c,v 1.203 2001/07/26 17:18:22 stevesk Exp $"); |
44 | 44 | ||
45 | #include <openssl/dh.h> | 45 | #include <openssl/dh.h> |
46 | #include <openssl/bn.h> | 46 | #include <openssl/bn.h> |
@@ -113,6 +113,9 @@ int IPv4or6 = AF_UNSPEC; | |||
113 | */ | 113 | */ |
114 | int debug_flag = 0; | 114 | int debug_flag = 0; |
115 | 115 | ||
116 | /* Flag indicating that the daemon should only test the configuration and keys. */ | ||
117 | int test_flag = 0; | ||
118 | |||
116 | /* Flag indicating that the daemon is being started from inetd. */ | 119 | /* Flag indicating that the daemon is being started from inetd. */ |
117 | int inetd_flag = 0; | 120 | int inetd_flag = 0; |
118 | 121 | ||
@@ -560,7 +563,7 @@ main(int ac, char **av) | |||
560 | initialize_server_options(&options); | 563 | initialize_server_options(&options); |
561 | 564 | ||
562 | /* Parse command-line arguments. */ | 565 | /* Parse command-line arguments. */ |
563 | while ((opt = getopt(ac, av, "f:p:b:k:h:g:V:u:dDeiqQ46")) != -1) { | 566 | while ((opt = getopt(ac, av, "f:p:b:k:h:g:V:u:dDeiqtQ46")) != -1) { |
564 | switch (opt) { | 567 | switch (opt) { |
565 | case '4': | 568 | case '4': |
566 | IPv4or6 = AF_INET; | 569 | IPv4or6 = AF_INET; |
@@ -636,6 +639,9 @@ main(int ac, char **av) | |||
636 | /* only makes sense with inetd_flag, i.e. no listen() */ | 639 | /* only makes sense with inetd_flag, i.e. no listen() */ |
637 | inetd_flag = 1; | 640 | inetd_flag = 1; |
638 | break; | 641 | break; |
642 | case 't': | ||
643 | test_flag = 1; | ||
644 | break; | ||
639 | case 'u': | 645 | case 'u': |
640 | utmp_len = atoi(optarg); | 646 | utmp_len = atoi(optarg); |
641 | break; | 647 | break; |
@@ -648,6 +654,7 @@ main(int ac, char **av) | |||
648 | fprintf(stderr, " -d Debugging mode (multiple -d means more debugging)\n"); | 654 | fprintf(stderr, " -d Debugging mode (multiple -d means more debugging)\n"); |
649 | fprintf(stderr, " -i Started from inetd\n"); | 655 | fprintf(stderr, " -i Started from inetd\n"); |
650 | fprintf(stderr, " -D Do not fork into daemon mode\n"); | 656 | fprintf(stderr, " -D Do not fork into daemon mode\n"); |
657 | fprintf(stderr, " -t Only test configuration file and keys\n"); | ||
651 | fprintf(stderr, " -q Quiet (no logging)\n"); | 658 | fprintf(stderr, " -q Quiet (no logging)\n"); |
652 | fprintf(stderr, " -p port Listen on the specified port (default: 22)\n"); | 659 | fprintf(stderr, " -p port Listen on the specified port (default: 22)\n"); |
653 | fprintf(stderr, " -k seconds Regenerate server key every this many seconds (default: 3600)\n"); | 660 | fprintf(stderr, " -k seconds Regenerate server key every this many seconds (default: 3600)\n"); |
@@ -755,6 +762,10 @@ main(int ac, char **av) | |||
755 | } | 762 | } |
756 | } | 763 | } |
757 | 764 | ||
765 | /* Configuration looks good, so exit if in test mode. */ | ||
766 | if (test_flag) | ||
767 | exit(0); | ||
768 | |||
758 | #ifdef HAVE_SCO_PROTECTED_PW | 769 | #ifdef HAVE_SCO_PROTECTED_PW |
759 | (void) set_auth_parameters(ac, av); | 770 | (void) set_auth_parameters(ac, av); |
760 | #endif | 771 | #endif |