summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-08-06 21:09:07 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-08-06 21:09:07 +0000
commit794325ac7a490d02c9ce5c0ad3093e1874df59a0 (patch)
treedafbde2bec0ae7b2d1b84e85f685793751ca4f9e
parentf9cedb9ca0c90652712b8e652d5ce740c903ee9b (diff)
- stevesk@cvs.openbsd.org 2001/07/26 17:18:22
[sshd.8 sshd.c] add -t option to test configuration file and keys; pekkas@netcore.fi ok markus@
-rw-r--r--ChangeLog6
-rw-r--r--sshd.88
-rw-r--r--sshd.c15
3 files changed, 25 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index d5f7f6694..7008ff9d3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -36,6 +36,10 @@
36 [readconf.c ssh.1 ssh.c sshconnect.c] 36 [readconf.c ssh.1 ssh.c sshconnect.c]
37 cleanup connect(); connection_attempts 4 -> 1; from 37 cleanup connect(); connection_attempts 4 -> 1; from
38 eivind@freebsd.org 38 eivind@freebsd.org
39 - stevesk@cvs.openbsd.org 2001/07/26 17:18:22
40 [sshd.8 sshd.c]
41 add -t option to test configuration file and keys; pekkas@netcore.fi
42 ok markus@
39 43
4020010803 4420010803
41 - (djm) Fix interrupted read in entropy gatherer. Spotted by markus@ on 45 - (djm) Fix interrupted read in entropy gatherer. Spotted by markus@ on
@@ -6146,4 +6150,4 @@
6146 - Wrote replacements for strlcpy and mkdtemp 6150 - Wrote replacements for strlcpy and mkdtemp
6147 - Released 1.0pre1 6151 - Released 1.0pre1
6148 6152
6149$Id: ChangeLog,v 1.1436 2001/08/06 21:07:11 mouring Exp $ 6153$Id: ChangeLog,v 1.1437 2001/08/06 21:09:07 mouring Exp $
diff --git a/sshd.8 b/sshd.8
index 01fd21421..94bd62738 100644
--- a/sshd.8
+++ b/sshd.8
@@ -34,7 +34,7 @@
34.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 34.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36.\" 36.\"
37.\" $OpenBSD: sshd.8,v 1.136 2001/07/22 22:24:16 markus Exp $ 37.\" $OpenBSD: sshd.8,v 1.137 2001/07/26 17:18:22 stevesk Exp $
38.Dd September 25, 1999 38.Dd September 25, 1999
39.Dt SSHD 8 39.Dt SSHD 8
40.Os 40.Os
@@ -247,6 +247,12 @@ Quiet mode.
247Nothing is sent to the system log. 247Nothing is sent to the system log.
248Normally the beginning, 248Normally the beginning,
249authentication, and termination of each connection is logged. 249authentication, and termination of each connection is logged.
250.It Fl t
251Test mode.
252Only check the validity of the configuration file and sanity of the keys.
253This is useful for updating
254.Nm
255reliably as configuration options may change.
250.It Fl u Ar len 256.It Fl u Ar len
251This option is used to specify the size of the field 257This option is used to specify the size of the field
252in the 258in the
diff --git a/sshd.c b/sshd.c
index dd5d7ab2c..d1c68445d 100644
--- a/sshd.c
+++ b/sshd.c
@@ -40,7 +40,7 @@
40 */ 40 */
41 41
42#include "includes.h" 42#include "includes.h"
43RCSID("$OpenBSD: sshd.c,v 1.202 2001/06/26 16:15:25 dugsong Exp $"); 43RCSID("$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 */
114int debug_flag = 0; 114int debug_flag = 0;
115 115
116/* Flag indicating that the daemon should only test the configuration and keys. */
117int 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. */
117int inetd_flag = 0; 120int 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