diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2000-11-29 21:12:00 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2000-11-29 21:12:00 +0000 |
commit | 2e17e17a287aa224500c73cfb776f2092653ea19 (patch) | |
tree | 7c8daea51651c2ee41f82d40b2fe4bb485987d8b | |
parent | 01200c27d86143068cf712489a7ea606117d98c6 (diff) |
sshd -D, startup w/o daemon(), for monitoring scripts or initab;
from handler@sub-rosa.com and eric@urbanrage.com; ok niels@
-rw-r--r-- | usr.bin/ssh/sshd.8 | 10 | ||||
-rw-r--r-- | usr.bin/ssh/sshd.c | 12 |
2 files changed, 17 insertions, 5 deletions
diff --git a/usr.bin/ssh/sshd.8 b/usr.bin/ssh/sshd.8 index cac9929f9e3..38e4ee4712c 100644 --- a/usr.bin/ssh/sshd.8 +++ b/usr.bin/ssh/sshd.8 @@ -34,7 +34,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $OpenBSD: sshd.8,v 1.73 2000/11/22 15:38:30 provos Exp $ +.\" $OpenBSD: sshd.8,v 1.74 2000/11/29 21:11:59 markus Exp $ .Dd September 25, 1999 .Dt SSHD 8 .Os @@ -43,7 +43,7 @@ .Nd secure shell daemon .Sh SYNOPSIS .Nm sshd -.Op Fl diqQ46 +.Op Fl diqDQ46 .Op Fl b Ar bits .Op Fl f Ar config_file .Op Fl g Ar login_grace_time @@ -254,6 +254,12 @@ indicates that only dotted decimal addresses should be put into the .Pa utmp file. +.It Fl D +When this option is specified +.Nm +will not detach and does not become a daemon. +This allows easy monitoring of +.Nm . .It Fl Q Do not print an error message if RSA support is missing. .It Fl V Ar client_protocol_id diff --git a/usr.bin/ssh/sshd.c b/usr.bin/ssh/sshd.c index d3c8984dbfb..7e6f09e6780 100644 --- a/usr.bin/ssh/sshd.c +++ b/usr.bin/ssh/sshd.c @@ -40,7 +40,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sshd.c,v 1.134 2000/11/12 19:50:38 markus Exp $"); +RCSID("$OpenBSD: sshd.c,v 1.135 2000/11/29 21:11:59 markus Exp $"); #include "xmalloc.h" #include "rsa.h" @@ -101,6 +101,9 @@ int debug_flag = 0; /* Flag indicating that the daemon is being started from inetd. */ int inetd_flag = 0; +/* Flag indicating that sshd should not detach and become a daemon. */ +int no_daemon_flag = 0; + /* debug goes to stderr unless inetd_flag is set */ int log_stderr = 0; @@ -568,7 +571,7 @@ main(int ac, char **av) initialize_server_options(&options); /* Parse command-line arguments. */ - while ((opt = getopt(ac, av, "f:p:b:k:h:g:V:u:diqQ46")) != EOF) { + while ((opt = getopt(ac, av, "f:p:b:k:h:g:V:u:dDiqQ46")) != EOF) { switch (opt) { case '4': IPv4or6 = AF_INET; @@ -590,6 +593,9 @@ main(int ac, char **av) exit(1); } break; + case 'D': + no_daemon_flag = 1; + break; case 'i': inetd_flag = 1; break; @@ -750,7 +756,7 @@ main(int ac, char **av) * from the controlling terminal, and fork. The original process * exits. */ - if (!debug_flag && !inetd_flag) { + if (!(debug_flag || inetd_flag || no_daemon_flag)) { #ifdef TIOCNOTTY int fd; #endif /* TIOCNOTTY */ |