diff options
author | djm@openbsd.org <djm@openbsd.org> | 2014-12-22 07:55:51 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2014-12-22 19:08:12 +1100 |
commit | 161cf419f412446635013ac49e8c660cadc36080 (patch) | |
tree | 849be0516d697c2bad7277ed780144a84602d86f /sshd.c | |
parent | f69b69b8625be447b8826b21d87713874dac25a6 (diff) |
upstream commit
make internal handling of filename arguments of "none"
more consistent with ssh. "none" arguments are now replaced with NULL when
the configuration is finalised.
Simplifies checking later on (just need to test not-NULL rather than
that + strcmp) and cleans up some inconsistencies. ok markus@
Diffstat (limited to 'sshd.c')
-rw-r--r-- | sshd.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshd.c,v 1.429 2014/12/11 08:20:09 djm Exp $ */ | 1 | /* $OpenBSD: sshd.c,v 1.430 2014/12/22 07:55:51 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -1208,7 +1208,8 @@ server_accept_loop(int *sock_in, int *sock_out, int *newsock, int *config_s) | |||
1208 | logit("Received signal %d; terminating.", | 1208 | logit("Received signal %d; terminating.", |
1209 | (int) received_sigterm); | 1209 | (int) received_sigterm); |
1210 | close_listen_socks(); | 1210 | close_listen_socks(); |
1211 | unlink(options.pid_file); | 1211 | if (options.pid_file != NULL) |
1212 | unlink(options.pid_file); | ||
1212 | exit(received_sigterm == SIGTERM ? 0 : 255); | 1213 | exit(received_sigterm == SIGTERM ? 0 : 255); |
1213 | } | 1214 | } |
1214 | if (key_used && key_do_regen) { | 1215 | if (key_used && key_do_regen) { |
@@ -1694,10 +1695,6 @@ main(int ac, char **av) | |||
1694 | sizeof(Key *)); | 1695 | sizeof(Key *)); |
1695 | sensitive_data.host_pubkeys = xcalloc(options.num_host_key_files, | 1696 | sensitive_data.host_pubkeys = xcalloc(options.num_host_key_files, |
1696 | sizeof(Key *)); | 1697 | sizeof(Key *)); |
1697 | for (i = 0; i < options.num_host_key_files; i++) { | ||
1698 | sensitive_data.host_keys[i] = NULL; | ||
1699 | sensitive_data.host_pubkeys[i] = NULL; | ||
1700 | } | ||
1701 | 1698 | ||
1702 | if (options.host_key_agent) { | 1699 | if (options.host_key_agent) { |
1703 | if (strcmp(options.host_key_agent, SSH_AUTHSOCKET_ENV_NAME)) | 1700 | if (strcmp(options.host_key_agent, SSH_AUTHSOCKET_ENV_NAME)) |
@@ -1707,6 +1704,8 @@ main(int ac, char **av) | |||
1707 | } | 1704 | } |
1708 | 1705 | ||
1709 | for (i = 0; i < options.num_host_key_files; i++) { | 1706 | for (i = 0; i < options.num_host_key_files; i++) { |
1707 | if (options.host_key_files[i] == NULL) | ||
1708 | continue; | ||
1710 | key = key_load_private(options.host_key_files[i], "", NULL); | 1709 | key = key_load_private(options.host_key_files[i], "", NULL); |
1711 | pubkey = key_load_public(options.host_key_files[i], NULL); | 1710 | pubkey = key_load_public(options.host_key_files[i], NULL); |
1712 | sensitive_data.host_keys[i] = key; | 1711 | sensitive_data.host_keys[i] = key; |
@@ -1765,6 +1764,8 @@ main(int ac, char **av) | |||
1765 | sensitive_data.host_certificates[i] = NULL; | 1764 | sensitive_data.host_certificates[i] = NULL; |
1766 | 1765 | ||
1767 | for (i = 0; i < options.num_host_cert_files; i++) { | 1766 | for (i = 0; i < options.num_host_cert_files; i++) { |
1767 | if (options.host_cert_files[i] == NULL) | ||
1768 | continue; | ||
1768 | key = key_load_public(options.host_cert_files[i], NULL); | 1769 | key = key_load_public(options.host_cert_files[i], NULL); |
1769 | if (key == NULL) { | 1770 | if (key == NULL) { |
1770 | error("Could not load host certificate: %s", | 1771 | error("Could not load host certificate: %s", |
@@ -1932,7 +1933,7 @@ main(int ac, char **av) | |||
1932 | * Write out the pid file after the sigterm handler | 1933 | * Write out the pid file after the sigterm handler |
1933 | * is setup and the listen sockets are bound | 1934 | * is setup and the listen sockets are bound |
1934 | */ | 1935 | */ |
1935 | if (!debug_flag) { | 1936 | if (options.pid_file != NULL && !debug_flag) { |
1936 | FILE *f = fopen(options.pid_file, "w"); | 1937 | FILE *f = fopen(options.pid_file, "w"); |
1937 | 1938 | ||
1938 | if (f == NULL) { | 1939 | if (f == NULL) { |