diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2000-05-01 18:51:00 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2000-05-01 18:51:00 +0000 |
commit | 0efbbb488dcfe757e259cde40588be55c9862aaa (patch) | |
tree | d49662c803471a4d74d5b9764a591c91ae0a295e /usr.bin/ssh | |
parent | 756fb52ccabcff6737e97484a6d22b480f8f92d4 (diff) |
PidFile, pr 1210
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r-- | usr.bin/ssh/servconf.c | 22 | ||||
-rw-r--r-- | usr.bin/ssh/servconf.h | 3 | ||||
-rw-r--r-- | usr.bin/ssh/sshd.8 | 8 | ||||
-rw-r--r-- | usr.bin/ssh/sshd.c | 4 |
4 files changed, 30 insertions, 7 deletions
diff --git a/usr.bin/ssh/servconf.c b/usr.bin/ssh/servconf.c index ad4f62735af..181a7ade99a 100644 --- a/usr.bin/ssh/servconf.c +++ b/usr.bin/ssh/servconf.c @@ -12,7 +12,7 @@ */ #include "includes.h" -RCSID("$Id: servconf.c,v 1.35 2000/04/26 22:43:15 markus Exp $"); +RCSID("$Id: servconf.c,v 1.36 2000/05/01 18:50:58 markus Exp $"); #include "ssh.h" #include "servconf.h" @@ -33,6 +33,7 @@ initialize_server_options(ServerOptions *options) options->listen_addrs = NULL; options->host_key_file = NULL; options->dsa_key_file = NULL; + options->pid_file = NULL; options->server_key_bits = -1; options->login_grace_time = -1; options->key_regeneration_time = -1; @@ -84,6 +85,8 @@ fill_default_server_options(ServerOptions *options) options->host_key_file = HOST_KEY_FILE; if (options->dsa_key_file == NULL) options->dsa_key_file = DSA_KEY_FILE; + if (options->pid_file == NULL) + options->pid_file = SSH_DAEMON_PID_FILE; if (options->server_key_bits == -1) options->server_key_bits = 768; if (options->login_grace_time == -1) @@ -167,7 +170,7 @@ typedef enum { sPrintMotd, sIgnoreRhosts, sX11Forwarding, sX11DisplayOffset, sStrictModes, sEmptyPasswd, sRandomSeedFile, sKeepAlives, sCheckMail, sUseLogin, sAllowUsers, sDenyUsers, sAllowGroups, sDenyGroups, - sIgnoreUserKnownHosts, sDSAKeyFile, sCiphers, sProtocol + sIgnoreUserKnownHosts, sDSAKeyFile, sCiphers, sProtocol, sPidFile } ServerOpCodes; /* Textual representation of the tokens. */ @@ -178,6 +181,7 @@ static struct { { "port", sPort }, { "hostkey", sHostKeyFile }, { "dsakey", sDSAKeyFile }, + { "pidfile", sPidFile }, { "serverkeybits", sServerKeyBits }, { "logingracetime", sLoginGraceTime }, { "keyregenerationinterval", sKeyRegenerationTime }, @@ -355,7 +359,19 @@ parse_int: cp = strtok(NULL, WHITESPACE); if (!cp) { fprintf(stderr, "%s line %d: missing file name.\n", - filename, linenum); + filename, linenum); + exit(1); + } + if (*charptr == NULL) + *charptr = tilde_expand_filename(cp, getuid()); + break; + + case sPidFile: + charptr = &options->pid_file; + cp = strtok(NULL, WHITESPACE); + if (!cp) { + fprintf(stderr, "%s line %d: missing file name.\n", + filename, linenum); exit(1); } if (*charptr == NULL) diff --git a/usr.bin/ssh/servconf.h b/usr.bin/ssh/servconf.h index e7623fae7d0..df746045d61 100644 --- a/usr.bin/ssh/servconf.h +++ b/usr.bin/ssh/servconf.h @@ -13,7 +13,7 @@ * */ -/* RCSID("$Id: servconf.h,v 1.18 2000/04/14 10:30:33 markus Exp $"); */ +/* RCSID("$Id: servconf.h,v 1.19 2000/05/01 18:50:59 markus Exp $"); */ #ifndef SERVCONF_H #define SERVCONF_H @@ -33,6 +33,7 @@ typedef struct { struct addrinfo *listen_addrs; /* Addresses on which the server listens. */ char *host_key_file; /* File containing host key. */ char *dsa_key_file; /* File containing dsa host key. */ + char *pid_file; /* Where to put our pid */ int server_key_bits;/* Size of the server key. */ int login_grace_time; /* Disconnect if no auth in this time * (sec). */ diff --git a/usr.bin/ssh/sshd.8 b/usr.bin/ssh/sshd.8 index 14ae830e6fe..dbea25edf46 100644 --- a/usr.bin/ssh/sshd.8 +++ b/usr.bin/ssh/sshd.8 @@ -9,7 +9,7 @@ .\" .\" Created: Sat Apr 22 21:55:14 1995 ylo .\" -.\" $Id: sshd.8,v 1.42 2000/05/01 08:19:58 hugh Exp $ +.\" $Id: sshd.8,v 1.43 2000/05/01 18:50:59 markus Exp $ .\" .Dd September 25, 1999 .Dt SSHD 8 @@ -415,6 +415,12 @@ option has been specified will be allowed regardless of the value of this setting (which may be useful for taking remote backups even if root login is normally not allowed). +.It Cm PidFile +Specifies the file that contains the process identifier of the +.Nm +daemon. +The default is +.Pa /var/run/sshd.pid . .It Cm Port Specifies the port number that .Nm diff --git a/usr.bin/ssh/sshd.c b/usr.bin/ssh/sshd.c index 14f3eb965b4..a046b0d3725 100644 --- a/usr.bin/ssh/sshd.c +++ b/usr.bin/ssh/sshd.c @@ -14,7 +14,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sshd.c,v 1.111 2000/04/27 08:01:28 markus Exp $"); +RCSID("$OpenBSD: sshd.c,v 1.112 2000/05/01 18:50:59 markus Exp $"); #include "xmalloc.h" #include "rsa.h" @@ -724,7 +724,7 @@ main(int ac, char **av) * fail if there already is a daemon, and this will * overwrite any old pid in the file. */ - f = fopen(SSH_DAEMON_PID_FILE, "w"); + f = fopen(options.pid_file, "w"); if (f) { fprintf(f, "%u\n", (unsigned int) getpid()); fclose(f); |