diff options
author | Damien Miller <djm@mindrot.org> | 2000-05-02 09:23:45 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2000-05-02 09:23:45 +1000 |
commit | 6f83b8e34d3dc8227d7cf39989c5966abde2305e (patch) | |
tree | d5f01eb7883f7b87ab4d6479ae1c3714f3d0dca0 | |
parent | 63560f9bfc460329b966b17561313d5fa7328726 (diff) |
- OpenBSD CVS update
[channels.c]
- init all fds, close all fds.
[sshconnect2.c]
- check whether file exists before asking for passphrase
[servconf.c servconf.h sshd.8 sshd.c]
- PidFile, pr 1210
[channels.c]
- EINTR
[channels.c]
- unbreak, ok niels@
[sshd.c]
- unlink pid file, ok niels@
[auth2.c]
- Add missing #ifdefs; ok - markus
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | auth2.c | 2 | ||||
-rw-r--r-- | channels.c | 110 | ||||
-rw-r--r-- | servconf.c | 22 | ||||
-rw-r--r-- | servconf.h | 3 | ||||
-rw-r--r-- | sshconnect2.c | 11 | ||||
-rw-r--r-- | sshd.8 | 8 | ||||
-rw-r--r-- | sshd.c | 5 |
8 files changed, 117 insertions, 59 deletions
@@ -1,4 +1,19 @@ | |||
1 | 20000502 | 1 | 20000502 |
2 | - OpenBSD CVS update | ||
3 | [channels.c] | ||
4 | - init all fds, close all fds. | ||
5 | [sshconnect2.c] | ||
6 | - check whether file exists before asking for passphrase | ||
7 | [servconf.c servconf.h sshd.8 sshd.c] | ||
8 | - PidFile, pr 1210 | ||
9 | [channels.c] | ||
10 | - EINTR | ||
11 | [channels.c] | ||
12 | - unbreak, ok niels@ | ||
13 | [sshd.c] | ||
14 | - unlink pid file, ok niels@ | ||
15 | [auth2.c] | ||
16 | - Add missing #ifdefs; ok - markus | ||
2 | - Release 2.0.0beta1 | 17 | - Release 2.0.0beta1 |
3 | 18 | ||
4 | 20000501 | 19 | 20000501 |
@@ -27,7 +27,7 @@ | |||
27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 | */ | 28 | */ |
29 | #include "includes.h" | 29 | #include "includes.h" |
30 | RCSID("$OpenBSD: auth2.c,v 1.4 2000/05/01 07:45:08 markus Exp $"); | 30 | RCSID("$OpenBSD: auth2.c,v 1.5 2000/05/01 23:13:39 djm Exp $"); |
31 | 31 | ||
32 | #include <openssl/dsa.h> | 32 | #include <openssl/dsa.h> |
33 | #include <openssl/rsa.h> | 33 | #include <openssl/rsa.h> |
diff --git a/channels.c b/channels.c index 1f9b515c3..bd8c337ee 100644 --- a/channels.c +++ b/channels.c | |||
@@ -17,7 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include "includes.h" | 19 | #include "includes.h" |
20 | RCSID("$Id: channels.c,v 1.27 2000/04/30 00:00:53 damien Exp $"); | 20 | RCSID("$Id: channels.c,v 1.28 2000/05/01 23:23:45 damien Exp $"); |
21 | 21 | ||
22 | #include "ssh.h" | 22 | #include "ssh.h" |
23 | #include "packet.h" | 23 | #include "packet.h" |
@@ -148,17 +148,13 @@ channel_lookup(int id) | |||
148 | } | 148 | } |
149 | 149 | ||
150 | /* | 150 | /* |
151 | * Allocate a new channel object and set its type and socket. This will cause | 151 | * register filedescriptors for a channel, used when allocating a channel or |
152 | * remote_name to be freed. | 152 | * when the channel consumer/producer is ready, e.g. shell exec'd |
153 | */ | 153 | */ |
154 | 154 | ||
155 | int | 155 | void |
156 | channel_new(char *ctype, int type, int rfd, int wfd, int efd, | 156 | channel_register_fds(Channel *c, int rfd, int wfd, int efd, int extusage) |
157 | int window, int maxpack, int extended_usage, char *remote_name) | ||
158 | { | 157 | { |
159 | int i, found; | ||
160 | Channel *c; | ||
161 | |||
162 | /* Update the maximum file descriptor value. */ | 158 | /* Update the maximum file descriptor value. */ |
163 | if (rfd > channel_max_fd_value) | 159 | if (rfd > channel_max_fd_value) |
164 | channel_max_fd_value = rfd; | 160 | channel_max_fd_value = rfd; |
@@ -167,6 +163,24 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd, | |||
167 | if (efd > channel_max_fd_value) | 163 | if (efd > channel_max_fd_value) |
168 | channel_max_fd_value = efd; | 164 | channel_max_fd_value = efd; |
169 | /* XXX set close-on-exec -markus */ | 165 | /* XXX set close-on-exec -markus */ |
166 | c->rfd = rfd; | ||
167 | c->wfd = wfd; | ||
168 | c->sock = (rfd == wfd) ? rfd : -1; | ||
169 | c->efd = efd; | ||
170 | c->extended_usage = extusage; | ||
171 | } | ||
172 | |||
173 | /* | ||
174 | * Allocate a new channel object and set its type and socket. This will cause | ||
175 | * remote_name to be freed. | ||
176 | */ | ||
177 | |||
178 | int | ||
179 | channel_new(char *ctype, int type, int rfd, int wfd, int efd, | ||
180 | int window, int maxpack, int extusage, char *remote_name) | ||
181 | { | ||
182 | int i, found; | ||
183 | Channel *c; | ||
170 | 184 | ||
171 | /* Do initial allocation if this is the first call. */ | 185 | /* Do initial allocation if this is the first call. */ |
172 | if (channels_alloc == 0) { | 186 | if (channels_alloc == 0) { |
@@ -203,14 +217,10 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd, | |||
203 | buffer_init(&c->output); | 217 | buffer_init(&c->output); |
204 | buffer_init(&c->extended); | 218 | buffer_init(&c->extended); |
205 | chan_init_iostates(c); | 219 | chan_init_iostates(c); |
220 | channel_register_fds(c, rfd, wfd, efd, extusage); | ||
206 | c->self = found; | 221 | c->self = found; |
207 | c->type = type; | 222 | c->type = type; |
208 | c->ctype = ctype; | 223 | c->ctype = ctype; |
209 | c->rfd = rfd; | ||
210 | c->wfd = wfd; | ||
211 | c->sock = (rfd == wfd) ? rfd : -1; | ||
212 | c->efd = efd; | ||
213 | c->extended_usage = extended_usage; | ||
214 | c->local_window = window; | 224 | c->local_window = window; |
215 | c->local_window_max = window; | 225 | c->local_window_max = window; |
216 | c->local_consumed = 0; | 226 | c->local_consumed = 0; |
@@ -226,13 +236,38 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd, | |||
226 | debug("channel %d: new [%s]", found, remote_name); | 236 | debug("channel %d: new [%s]", found, remote_name); |
227 | return found; | 237 | return found; |
228 | } | 238 | } |
239 | /* old interface XXX */ | ||
229 | int | 240 | int |
230 | channel_allocate(int type, int sock, char *remote_name) | 241 | channel_allocate(int type, int sock, char *remote_name) |
231 | { | 242 | { |
232 | return channel_new("", type, sock, sock, -1, 0, 0, 0, remote_name); | 243 | return channel_new("", type, sock, sock, -1, 0, 0, 0, remote_name); |
233 | } | 244 | } |
234 | 245 | ||
235 | /* Free the channel and close its socket. */ | 246 | |
247 | /* Close all channel fd/socket. */ | ||
248 | |||
249 | void | ||
250 | channel_close_fds(Channel *c) | ||
251 | { | ||
252 | if (c->sock != -1) { | ||
253 | close(c->sock); | ||
254 | c->sock = -1; | ||
255 | } | ||
256 | if (c->rfd != -1) { | ||
257 | close(c->rfd); | ||
258 | c->rfd = -1; | ||
259 | } | ||
260 | if (c->wfd != -1) { | ||
261 | close(c->wfd); | ||
262 | c->wfd = -1; | ||
263 | } | ||
264 | if (c->efd != -1) { | ||
265 | close(c->efd); | ||
266 | c->efd = -1; | ||
267 | } | ||
268 | } | ||
269 | |||
270 | /* Free the channel and close its fd/socket. */ | ||
236 | 271 | ||
237 | void | 272 | void |
238 | channel_free(int id) | 273 | channel_free(int id) |
@@ -245,25 +280,9 @@ channel_free(int id) | |||
245 | debug("channel_free: channel %d: dettaching channel user", id); | 280 | debug("channel_free: channel %d: dettaching channel user", id); |
246 | c->dettach_user(c->self, NULL); | 281 | c->dettach_user(c->self, NULL); |
247 | } | 282 | } |
248 | if (c->sock != -1) { | 283 | if (c->sock != -1) |
249 | shutdown(c->sock, SHUT_RDWR); | 284 | shutdown(c->sock, SHUT_RDWR); |
250 | close(c->sock); | 285 | channel_close_fds(c); |
251 | c->sock = -1; | ||
252 | } | ||
253 | if (compat20) { | ||
254 | if (c->rfd != -1) { | ||
255 | close(c->rfd); | ||
256 | c->rfd = -1; | ||
257 | } | ||
258 | if (c->wfd != -1) { | ||
259 | close(c->wfd); | ||
260 | c->wfd = -1; | ||
261 | } | ||
262 | if (c->efd != -1) { | ||
263 | close(c->efd); | ||
264 | c->efd = -1; | ||
265 | } | ||
266 | } | ||
267 | buffer_free(&c->input); | 286 | buffer_free(&c->input); |
268 | buffer_free(&c->output); | 287 | buffer_free(&c->output); |
269 | buffer_free(&c->extended); | 288 | buffer_free(&c->extended); |
@@ -614,6 +633,8 @@ channel_handle_rfd(Channel *c, fd_set * readset, fd_set * writeset) | |||
614 | if (c->rfd != -1 && | 633 | if (c->rfd != -1 && |
615 | FD_ISSET(c->rfd, readset)) { | 634 | FD_ISSET(c->rfd, readset)) { |
616 | len = read(c->rfd, buf, sizeof(buf)); | 635 | len = read(c->rfd, buf, sizeof(buf)); |
636 | if (len < 0 && (errno == EINTR || errno == EAGAIN)) | ||
637 | return 1; | ||
617 | if (len <= 0) { | 638 | if (len <= 0) { |
618 | debug("channel %d: read<=0 rfd %d len %d", | 639 | debug("channel %d: read<=0 rfd %d len %d", |
619 | c->self, c->rfd, len); | 640 | c->self, c->rfd, len); |
@@ -640,7 +661,9 @@ channel_handle_wfd(Channel *c, fd_set * readset, fd_set * writeset) | |||
640 | FD_ISSET(c->wfd, writeset) && | 661 | FD_ISSET(c->wfd, writeset) && |
641 | buffer_len(&c->output) > 0) { | 662 | buffer_len(&c->output) > 0) { |
642 | len = write(c->wfd, buffer_ptr(&c->output), | 663 | len = write(c->wfd, buffer_ptr(&c->output), |
643 | buffer_len(&c->output)); | 664 | buffer_len(&c->output)); |
665 | if (len < 0 && (errno == EINTR || errno == EAGAIN)) | ||
666 | return 1; | ||
644 | if (len <= 0) { | 667 | if (len <= 0) { |
645 | if (compat13) { | 668 | if (compat13) { |
646 | buffer_consume(&c->output, buffer_len(&c->output)); | 669 | buffer_consume(&c->output, buffer_len(&c->output)); |
@@ -1267,7 +1290,7 @@ channel_stop_listening() | |||
1267 | } | 1290 | } |
1268 | 1291 | ||
1269 | /* | 1292 | /* |
1270 | * Closes the sockets of all channels. This is used to close extra file | 1293 | * Closes the sockets/fds of all channels. This is used to close extra file |
1271 | * descriptors after a fork. | 1294 | * descriptors after a fork. |
1272 | */ | 1295 | */ |
1273 | 1296 | ||
@@ -1275,10 +1298,9 @@ void | |||
1275 | channel_close_all() | 1298 | channel_close_all() |
1276 | { | 1299 | { |
1277 | int i; | 1300 | int i; |
1278 | for (i = 0; i < channels_alloc; i++) { | 1301 | for (i = 0; i < channels_alloc; i++) |
1279 | if (channels[i].type != SSH_CHANNEL_FREE) | 1302 | if (channels[i].type != SSH_CHANNEL_FREE) |
1280 | close(channels[i].sock); | 1303 | channel_close_fds(&channels[i]); |
1281 | } | ||
1282 | } | 1304 | } |
1283 | 1305 | ||
1284 | /* Returns the maximum file descriptor number used by the channels. */ | 1306 | /* Returns the maximum file descriptor number used by the channels. */ |
@@ -2269,17 +2291,9 @@ channel_set_fds(int id, int rfd, int wfd, int efd, int extusage) | |||
2269 | Channel *c = channel_lookup(id); | 2291 | Channel *c = channel_lookup(id); |
2270 | if (c == NULL || c->type != SSH_CHANNEL_LARVAL) | 2292 | if (c == NULL || c->type != SSH_CHANNEL_LARVAL) |
2271 | fatal("channel_activate for non-larval channel %d.", id); | 2293 | fatal("channel_activate for non-larval channel %d.", id); |
2272 | if (rfd > channel_max_fd_value) | 2294 | |
2273 | channel_max_fd_value = rfd; | 2295 | channel_register_fds(c, rfd, wfd, efd, extusage); |
2274 | if (wfd > channel_max_fd_value) | ||
2275 | channel_max_fd_value = wfd; | ||
2276 | if (efd > channel_max_fd_value) | ||
2277 | channel_max_fd_value = efd; | ||
2278 | c->type = SSH_CHANNEL_OPEN; | 2296 | c->type = SSH_CHANNEL_OPEN; |
2279 | c->rfd = rfd; | ||
2280 | c->wfd = wfd; | ||
2281 | c->efd = efd; | ||
2282 | c->extended_usage = extusage; | ||
2283 | /* XXX window size? */ | 2297 | /* XXX window size? */ |
2284 | c->local_window = c->local_window_max = c->local_maxpacket/2; | 2298 | c->local_window = c->local_window_max = c->local_maxpacket/2; |
2285 | packet_start(SSH2_MSG_CHANNEL_WINDOW_ADJUST); | 2299 | packet_start(SSH2_MSG_CHANNEL_WINDOW_ADJUST); |
diff --git a/servconf.c b/servconf.c index 298fefbe2..16eaeba01 100644 --- a/servconf.c +++ b/servconf.c | |||
@@ -12,7 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include "includes.h" | 14 | #include "includes.h" |
15 | RCSID("$Id: servconf.c,v 1.13 2000/04/29 13:57:11 damien Exp $"); | 15 | RCSID("$Id: servconf.c,v 1.14 2000/05/01 23:23:45 damien Exp $"); |
16 | 16 | ||
17 | #include "ssh.h" | 17 | #include "ssh.h" |
18 | #include "servconf.h" | 18 | #include "servconf.h" |
@@ -33,6 +33,7 @@ initialize_server_options(ServerOptions *options) | |||
33 | options->listen_addrs = NULL; | 33 | options->listen_addrs = NULL; |
34 | options->host_key_file = NULL; | 34 | options->host_key_file = NULL; |
35 | options->dsa_key_file = NULL; | 35 | options->dsa_key_file = NULL; |
36 | options->pid_file = NULL; | ||
36 | options->server_key_bits = -1; | 37 | options->server_key_bits = -1; |
37 | options->login_grace_time = -1; | 38 | options->login_grace_time = -1; |
38 | options->key_regeneration_time = -1; | 39 | options->key_regeneration_time = -1; |
@@ -84,6 +85,8 @@ fill_default_server_options(ServerOptions *options) | |||
84 | options->host_key_file = HOST_KEY_FILE; | 85 | options->host_key_file = HOST_KEY_FILE; |
85 | if (options->dsa_key_file == NULL) | 86 | if (options->dsa_key_file == NULL) |
86 | options->dsa_key_file = DSA_KEY_FILE; | 87 | options->dsa_key_file = DSA_KEY_FILE; |
88 | if (options->pid_file == NULL) | ||
89 | options->pid_file = SSH_DAEMON_PID_FILE; | ||
87 | if (options->server_key_bits == -1) | 90 | if (options->server_key_bits == -1) |
88 | options->server_key_bits = 768; | 91 | options->server_key_bits = 768; |
89 | if (options->login_grace_time == -1) | 92 | if (options->login_grace_time == -1) |
@@ -167,7 +170,7 @@ typedef enum { | |||
167 | sPrintMotd, sIgnoreRhosts, sX11Forwarding, sX11DisplayOffset, | 170 | sPrintMotd, sIgnoreRhosts, sX11Forwarding, sX11DisplayOffset, |
168 | sStrictModes, sEmptyPasswd, sRandomSeedFile, sKeepAlives, sCheckMail, | 171 | sStrictModes, sEmptyPasswd, sRandomSeedFile, sKeepAlives, sCheckMail, |
169 | sUseLogin, sAllowUsers, sDenyUsers, sAllowGroups, sDenyGroups, | 172 | sUseLogin, sAllowUsers, sDenyUsers, sAllowGroups, sDenyGroups, |
170 | sIgnoreUserKnownHosts, sDSAKeyFile, sCiphers, sProtocol | 173 | sIgnoreUserKnownHosts, sDSAKeyFile, sCiphers, sProtocol, sPidFile |
171 | } ServerOpCodes; | 174 | } ServerOpCodes; |
172 | 175 | ||
173 | /* Textual representation of the tokens. */ | 176 | /* Textual representation of the tokens. */ |
@@ -178,6 +181,7 @@ static struct { | |||
178 | { "port", sPort }, | 181 | { "port", sPort }, |
179 | { "hostkey", sHostKeyFile }, | 182 | { "hostkey", sHostKeyFile }, |
180 | { "dsakey", sDSAKeyFile }, | 183 | { "dsakey", sDSAKeyFile }, |
184 | { "pidfile", sPidFile }, | ||
181 | { "serverkeybits", sServerKeyBits }, | 185 | { "serverkeybits", sServerKeyBits }, |
182 | { "logingracetime", sLoginGraceTime }, | 186 | { "logingracetime", sLoginGraceTime }, |
183 | { "keyregenerationinterval", sKeyRegenerationTime }, | 187 | { "keyregenerationinterval", sKeyRegenerationTime }, |
@@ -355,7 +359,19 @@ parse_int: | |||
355 | cp = strtok(NULL, WHITESPACE); | 359 | cp = strtok(NULL, WHITESPACE); |
356 | if (!cp) { | 360 | if (!cp) { |
357 | fprintf(stderr, "%s line %d: missing file name.\n", | 361 | fprintf(stderr, "%s line %d: missing file name.\n", |
358 | filename, linenum); | 362 | filename, linenum); |
363 | exit(1); | ||
364 | } | ||
365 | if (*charptr == NULL) | ||
366 | *charptr = tilde_expand_filename(cp, getuid()); | ||
367 | break; | ||
368 | |||
369 | case sPidFile: | ||
370 | charptr = &options->pid_file; | ||
371 | cp = strtok(NULL, WHITESPACE); | ||
372 | if (!cp) { | ||
373 | fprintf(stderr, "%s line %d: missing file name.\n", | ||
374 | filename, linenum); | ||
359 | exit(1); | 375 | exit(1); |
360 | } | 376 | } |
361 | if (*charptr == NULL) | 377 | if (*charptr == NULL) |
diff --git a/servconf.h b/servconf.h index b8e8163dd..a5010093d 100644 --- a/servconf.h +++ b/servconf.h | |||
@@ -13,7 +13,7 @@ | |||
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | /* RCSID("$Id: servconf.h,v 1.9 2000/04/16 01:18:45 damien Exp $"); */ | 16 | /* RCSID("$Id: servconf.h,v 1.10 2000/05/01 23:23:46 damien Exp $"); */ |
17 | 17 | ||
18 | #ifndef SERVCONF_H | 18 | #ifndef SERVCONF_H |
19 | #define SERVCONF_H | 19 | #define SERVCONF_H |
@@ -33,6 +33,7 @@ typedef struct { | |||
33 | struct addrinfo *listen_addrs; /* Addresses on which the server listens. */ | 33 | struct addrinfo *listen_addrs; /* Addresses on which the server listens. */ |
34 | char *host_key_file; /* File containing host key. */ | 34 | char *host_key_file; /* File containing host key. */ |
35 | char *dsa_key_file; /* File containing dsa host key. */ | 35 | char *dsa_key_file; /* File containing dsa host key. */ |
36 | char *pid_file; /* Where to put our pid */ | ||
36 | int server_key_bits;/* Size of the server key. */ | 37 | int server_key_bits;/* Size of the server key. */ |
37 | int login_grace_time; /* Disconnect if no auth in this time | 38 | int login_grace_time; /* Disconnect if no auth in this time |
38 | * (sec). */ | 39 | * (sec). */ |
diff --git a/sshconnect2.c b/sshconnect2.c index 31ef3084c..a4342e2df 100644 --- a/sshconnect2.c +++ b/sshconnect2.c | |||
@@ -28,7 +28,7 @@ | |||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "includes.h" | 30 | #include "includes.h" |
31 | RCSID("$OpenBSD: sshconnect2.c,v 1.4 2000/04/27 17:54:01 markus Exp $"); | 31 | RCSID("$OpenBSD: sshconnect2.c,v 1.5 2000/05/01 18:41:06 markus Exp $"); |
32 | 32 | ||
33 | #include <openssl/bn.h> | 33 | #include <openssl/bn.h> |
34 | #include <openssl/rsa.h> | 34 | #include <openssl/rsa.h> |
@@ -310,7 +310,12 @@ ssh2_try_pubkey(char *filename, | |||
310 | Key *k; | 310 | Key *k; |
311 | unsigned char *blob, *signature; | 311 | unsigned char *blob, *signature; |
312 | int bloblen, slen; | 312 | int bloblen, slen; |
313 | struct stat st; | ||
313 | 314 | ||
315 | if (stat(filename, &st) != 0) { | ||
316 | debug("key does not exist: %s", filename); | ||
317 | return 0; | ||
318 | } | ||
314 | debug("try pubkey: %s", filename); | 319 | debug("try pubkey: %s", filename); |
315 | 320 | ||
316 | k = key_new(KEY_DSA); | 321 | k = key_new(KEY_DSA); |
@@ -318,9 +323,9 @@ ssh2_try_pubkey(char *filename, | |||
318 | int success = 0; | 323 | int success = 0; |
319 | char *passphrase; | 324 | char *passphrase; |
320 | char prompt[300]; | 325 | char prompt[300]; |
321 | snprintf(prompt, sizeof prompt, | 326 | snprintf(prompt, sizeof prompt, |
322 | "Enter passphrase for DSA key '%.100s': ", | 327 | "Enter passphrase for DSA key '%.100s': ", |
323 | filename); | 328 | filename); |
324 | passphrase = read_passphrase(prompt, 0); | 329 | passphrase = read_passphrase(prompt, 0); |
325 | success = load_private_key(filename, passphrase, k, NULL); | 330 | success = load_private_key(filename, passphrase, k, NULL); |
326 | memset(passphrase, 0, strlen(passphrase)); | 331 | memset(passphrase, 0, strlen(passphrase)); |
@@ -9,7 +9,7 @@ | |||
9 | .\" | 9 | .\" |
10 | .\" Created: Sat Apr 22 21:55:14 1995 ylo | 10 | .\" Created: Sat Apr 22 21:55:14 1995 ylo |
11 | .\" | 11 | .\" |
12 | .\" $Id: sshd.8,v 1.19 2000/05/01 11:10:34 damien Exp $ | 12 | .\" $Id: sshd.8,v 1.20 2000/05/01 23:23:46 damien Exp $ |
13 | .\" | 13 | .\" |
14 | .Dd September 25, 1999 | 14 | .Dd September 25, 1999 |
15 | .Dt SSHD 8 | 15 | .Dt SSHD 8 |
@@ -415,6 +415,12 @@ option has been | |||
415 | specified will be allowed regardless of the value of this setting | 415 | specified will be allowed regardless of the value of this setting |
416 | (which may be useful for taking remote backups even if root login is | 416 | (which may be useful for taking remote backups even if root login is |
417 | normally not allowed). | 417 | normally not allowed). |
418 | .It Cm PidFile | ||
419 | Specifies the file that contains the process identifier of the | ||
420 | .Nm | ||
421 | daemon. | ||
422 | The default is | ||
423 | .Pa /var/run/sshd.pid . | ||
418 | .It Cm Port | 424 | .It Cm Port |
419 | Specifies the port number that | 425 | Specifies the port number that |
420 | .Nm | 426 | .Nm |
@@ -14,7 +14,7 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include "includes.h" | 16 | #include "includes.h" |
17 | RCSID("$OpenBSD: sshd.c,v 1.111 2000/04/27 08:01:28 markus Exp $"); | 17 | RCSID("$OpenBSD: sshd.c,v 1.113 2000/05/01 20:34:51 markus Exp $"); |
18 | 18 | ||
19 | #include "xmalloc.h" | 19 | #include "xmalloc.h" |
20 | #include "rsa.h" | 20 | #include "rsa.h" |
@@ -190,6 +190,7 @@ sigterm_handler(int sig) | |||
190 | { | 190 | { |
191 | log("Received signal %d; terminating.", sig); | 191 | log("Received signal %d; terminating.", sig); |
192 | close_listen_socks(); | 192 | close_listen_socks(); |
193 | unlink(options.pid_file); | ||
193 | exit(255); | 194 | exit(255); |
194 | } | 195 | } |
195 | 196 | ||
@@ -729,7 +730,7 @@ main(int ac, char **av) | |||
729 | * fail if there already is a daemon, and this will | 730 | * fail if there already is a daemon, and this will |
730 | * overwrite any old pid in the file. | 731 | * overwrite any old pid in the file. |
731 | */ | 732 | */ |
732 | f = fopen(SSH_DAEMON_PID_FILE, "w"); | 733 | f = fopen(options.pid_file, "w"); |
733 | if (f) { | 734 | if (f) { |
734 | fprintf(f, "%u\n", (unsigned int) getpid()); | 735 | fprintf(f, "%u\n", (unsigned int) getpid()); |
735 | fclose(f); | 736 | fclose(f); |