diff options
Diffstat (limited to 'readconf.c')
-rw-r--r-- | readconf.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/readconf.c b/readconf.c index ec497e79f..f78b4d6fe 100644 --- a/readconf.c +++ b/readconf.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: readconf.c,v 1.304 2019/03/01 02:08:50 djm Exp $ */ | 1 | /* $OpenBSD: readconf.c,v 1.309 2019/09/06 14:45:34 naddy 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 |
@@ -86,7 +86,7 @@ | |||
86 | User foo | 86 | User foo |
87 | 87 | ||
88 | Host fake.com | 88 | Host fake.com |
89 | HostName another.host.name.real.org | 89 | Hostname another.host.name.real.org |
90 | User blaah | 90 | User blaah |
91 | Port 34289 | 91 | Port 34289 |
92 | ForwardX11 no | 92 | ForwardX11 no |
@@ -148,7 +148,7 @@ typedef enum { | |||
148 | oGatewayPorts, oExitOnForwardFailure, | 148 | oGatewayPorts, oExitOnForwardFailure, |
149 | oPasswordAuthentication, oRSAAuthentication, | 149 | oPasswordAuthentication, oRSAAuthentication, |
150 | oChallengeResponseAuthentication, oXAuthLocation, | 150 | oChallengeResponseAuthentication, oXAuthLocation, |
151 | oIdentityFile, oHostName, oPort, oCipher, oRemoteForward, oLocalForward, | 151 | oIdentityFile, oHostname, oPort, oCipher, oRemoteForward, oLocalForward, |
152 | oCertificateFile, oAddKeysToAgent, oIdentityAgent, | 152 | oCertificateFile, oAddKeysToAgent, oIdentityAgent, |
153 | oUser, oEscapeChar, oRhostsRSAAuthentication, oProxyCommand, | 153 | oUser, oEscapeChar, oRhostsRSAAuthentication, oProxyCommand, |
154 | oGlobalKnownHostsFile, oUserKnownHostsFile, oConnectionAttempts, | 154 | oGlobalKnownHostsFile, oUserKnownHostsFile, oConnectionAttempts, |
@@ -240,7 +240,7 @@ static struct { | |||
240 | { "certificatefile", oCertificateFile }, | 240 | { "certificatefile", oCertificateFile }, |
241 | { "addkeystoagent", oAddKeysToAgent }, | 241 | { "addkeystoagent", oAddKeysToAgent }, |
242 | { "identityagent", oIdentityAgent }, | 242 | { "identityagent", oIdentityAgent }, |
243 | { "hostname", oHostName }, | 243 | { "hostname", oHostname }, |
244 | { "hostkeyalias", oHostKeyAlias }, | 244 | { "hostkeyalias", oHostKeyAlias }, |
245 | { "proxycommand", oProxyCommand }, | 245 | { "proxycommand", oProxyCommand }, |
246 | { "port", oPort }, | 246 | { "port", oPort }, |
@@ -486,6 +486,11 @@ execute_in_shell(const char *cmd) | |||
486 | if ((shell = getenv("SHELL")) == NULL) | 486 | if ((shell = getenv("SHELL")) == NULL) |
487 | shell = _PATH_BSHELL; | 487 | shell = _PATH_BSHELL; |
488 | 488 | ||
489 | if (access(shell, X_OK) == -1) { | ||
490 | fatal("Shell \"%s\" is not executable: %s", | ||
491 | shell, strerror(errno)); | ||
492 | } | ||
493 | |||
489 | /* Need this to redirect subprocess stdin/out */ | 494 | /* Need this to redirect subprocess stdin/out */ |
490 | if ((devnull = open(_PATH_DEVNULL, O_RDWR)) == -1) | 495 | if ((devnull = open(_PATH_DEVNULL, O_RDWR)) == -1) |
491 | fatal("open(/dev/null): %s", strerror(errno)); | 496 | fatal("open(/dev/null): %s", strerror(errno)); |
@@ -518,7 +523,7 @@ execute_in_shell(const char *cmd) | |||
518 | _exit(1); | 523 | _exit(1); |
519 | } | 524 | } |
520 | /* Parent. */ | 525 | /* Parent. */ |
521 | if (pid < 0) | 526 | if (pid == -1) |
522 | fatal("%s: fork: %.100s", __func__, strerror(errno)); | 527 | fatal("%s: fork: %.100s", __func__, strerror(errno)); |
523 | 528 | ||
524 | close(devnull); | 529 | close(devnull); |
@@ -1117,7 +1122,7 @@ parse_char_array: | |||
1117 | max_entries = SSH_MAX_HOSTS_FILES; | 1122 | max_entries = SSH_MAX_HOSTS_FILES; |
1118 | goto parse_char_array; | 1123 | goto parse_char_array; |
1119 | 1124 | ||
1120 | case oHostName: | 1125 | case oHostname: |
1121 | charptr = &options->hostname; | 1126 | charptr = &options->hostname; |
1122 | goto parse_string; | 1127 | goto parse_string; |
1123 | 1128 | ||
@@ -1194,7 +1199,8 @@ parse_int: | |||
1194 | arg = strdelim(&s); | 1199 | arg = strdelim(&s); |
1195 | if (!arg || *arg == '\0') | 1200 | if (!arg || *arg == '\0') |
1196 | fatal("%.200s line %d: Missing argument.", filename, linenum); | 1201 | fatal("%.200s line %d: Missing argument.", filename, linenum); |
1197 | if (*arg != '-' && !ciphers_valid(*arg == '+' ? arg + 1 : arg)) | 1202 | if (*arg != '-' && |
1203 | !ciphers_valid(*arg == '+' || *arg == '^' ? arg + 1 : arg)) | ||
1198 | fatal("%.200s line %d: Bad SSH2 cipher spec '%s'.", | 1204 | fatal("%.200s line %d: Bad SSH2 cipher spec '%s'.", |
1199 | filename, linenum, arg ? arg : "<NONE>"); | 1205 | filename, linenum, arg ? arg : "<NONE>"); |
1200 | if (*activep && options->ciphers == NULL) | 1206 | if (*activep && options->ciphers == NULL) |
@@ -1205,8 +1211,9 @@ parse_int: | |||
1205 | arg = strdelim(&s); | 1211 | arg = strdelim(&s); |
1206 | if (!arg || *arg == '\0') | 1212 | if (!arg || *arg == '\0') |
1207 | fatal("%.200s line %d: Missing argument.", filename, linenum); | 1213 | fatal("%.200s line %d: Missing argument.", filename, linenum); |
1208 | if (*arg != '-' && !mac_valid(*arg == '+' ? arg + 1 : arg)) | 1214 | if (*arg != '-' && |
1209 | fatal("%.200s line %d: Bad SSH2 Mac spec '%s'.", | 1215 | !mac_valid(*arg == '+' || *arg == '^' ? arg + 1 : arg)) |
1216 | fatal("%.200s line %d: Bad SSH2 MAC spec '%s'.", | ||
1210 | filename, linenum, arg ? arg : "<NONE>"); | 1217 | filename, linenum, arg ? arg : "<NONE>"); |
1211 | if (*activep && options->macs == NULL) | 1218 | if (*activep && options->macs == NULL) |
1212 | options->macs = xstrdup(arg); | 1219 | options->macs = xstrdup(arg); |
@@ -1218,7 +1225,8 @@ parse_int: | |||
1218 | fatal("%.200s line %d: Missing argument.", | 1225 | fatal("%.200s line %d: Missing argument.", |
1219 | filename, linenum); | 1226 | filename, linenum); |
1220 | if (*arg != '-' && | 1227 | if (*arg != '-' && |
1221 | !kex_names_valid(*arg == '+' ? arg + 1 : arg)) | 1228 | !kex_names_valid(*arg == '+' || *arg == '^' ? |
1229 | arg + 1 : arg)) | ||
1222 | fatal("%.200s line %d: Bad SSH2 KexAlgorithms '%s'.", | 1230 | fatal("%.200s line %d: Bad SSH2 KexAlgorithms '%s'.", |
1223 | filename, linenum, arg ? arg : "<NONE>"); | 1231 | filename, linenum, arg ? arg : "<NONE>"); |
1224 | if (*activep && options->kex_algorithms == NULL) | 1232 | if (*activep && options->kex_algorithms == NULL) |
@@ -1233,7 +1241,8 @@ parse_keytypes: | |||
1233 | fatal("%.200s line %d: Missing argument.", | 1241 | fatal("%.200s line %d: Missing argument.", |
1234 | filename, linenum); | 1242 | filename, linenum); |
1235 | if (*arg != '-' && | 1243 | if (*arg != '-' && |
1236 | !sshkey_names_valid2(*arg == '+' ? arg + 1 : arg, 1)) | 1244 | !sshkey_names_valid2(*arg == '+' || *arg == '^' ? |
1245 | arg + 1 : arg, 1)) | ||
1237 | fatal("%s line %d: Bad key types '%s'.", | 1246 | fatal("%s line %d: Bad key types '%s'.", |
1238 | filename, linenum, arg ? arg : "<NONE>"); | 1247 | filename, linenum, arg ? arg : "<NONE>"); |
1239 | if (*activep && *charptr == NULL) | 1248 | if (*activep && *charptr == NULL) |
@@ -2593,7 +2602,7 @@ dump_client_config(Options *o, const char *host) | |||
2593 | 2602 | ||
2594 | /* Most interesting options first: user, host, port */ | 2603 | /* Most interesting options first: user, host, port */ |
2595 | dump_cfg_string(oUser, o->user); | 2604 | dump_cfg_string(oUser, o->user); |
2596 | dump_cfg_string(oHostName, host); | 2605 | dump_cfg_string(oHostname, host); |
2597 | dump_cfg_int(oPort, o->port); | 2606 | dump_cfg_int(oPort, o->port); |
2598 | 2607 | ||
2599 | /* Flag options */ | 2608 | /* Flag options */ |