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 2ba312441..9812b8d98 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 |
@@ -87,7 +87,7 @@ | |||
87 | User foo | 87 | User foo |
88 | 88 | ||
89 | Host fake.com | 89 | Host fake.com |
90 | HostName another.host.name.real.org | 90 | Hostname another.host.name.real.org |
91 | User blaah | 91 | User blaah |
92 | Port 34289 | 92 | Port 34289 |
93 | ForwardX11 no | 93 | ForwardX11 no |
@@ -149,7 +149,7 @@ typedef enum { | |||
149 | oGatewayPorts, oExitOnForwardFailure, | 149 | oGatewayPorts, oExitOnForwardFailure, |
150 | oPasswordAuthentication, oRSAAuthentication, | 150 | oPasswordAuthentication, oRSAAuthentication, |
151 | oChallengeResponseAuthentication, oXAuthLocation, | 151 | oChallengeResponseAuthentication, oXAuthLocation, |
152 | oIdentityFile, oHostName, oPort, oCipher, oRemoteForward, oLocalForward, | 152 | oIdentityFile, oHostname, oPort, oCipher, oRemoteForward, oLocalForward, |
153 | oCertificateFile, oAddKeysToAgent, oIdentityAgent, | 153 | oCertificateFile, oAddKeysToAgent, oIdentityAgent, |
154 | oUser, oEscapeChar, oRhostsRSAAuthentication, oProxyCommand, | 154 | oUser, oEscapeChar, oRhostsRSAAuthentication, oProxyCommand, |
155 | oGlobalKnownHostsFile, oUserKnownHostsFile, oConnectionAttempts, | 155 | oGlobalKnownHostsFile, oUserKnownHostsFile, oConnectionAttempts, |
@@ -257,7 +257,7 @@ static struct { | |||
257 | { "certificatefile", oCertificateFile }, | 257 | { "certificatefile", oCertificateFile }, |
258 | { "addkeystoagent", oAddKeysToAgent }, | 258 | { "addkeystoagent", oAddKeysToAgent }, |
259 | { "identityagent", oIdentityAgent }, | 259 | { "identityagent", oIdentityAgent }, |
260 | { "hostname", oHostName }, | 260 | { "hostname", oHostname }, |
261 | { "hostkeyalias", oHostKeyAlias }, | 261 | { "hostkeyalias", oHostKeyAlias }, |
262 | { "proxycommand", oProxyCommand }, | 262 | { "proxycommand", oProxyCommand }, |
263 | { "port", oPort }, | 263 | { "port", oPort }, |
@@ -505,6 +505,11 @@ execute_in_shell(const char *cmd) | |||
505 | if ((shell = getenv("SHELL")) == NULL) | 505 | if ((shell = getenv("SHELL")) == NULL) |
506 | shell = _PATH_BSHELL; | 506 | shell = _PATH_BSHELL; |
507 | 507 | ||
508 | if (access(shell, X_OK) == -1) { | ||
509 | fatal("Shell \"%s\" is not executable: %s", | ||
510 | shell, strerror(errno)); | ||
511 | } | ||
512 | |||
508 | /* Need this to redirect subprocess stdin/out */ | 513 | /* Need this to redirect subprocess stdin/out */ |
509 | if ((devnull = open(_PATH_DEVNULL, O_RDWR)) == -1) | 514 | if ((devnull = open(_PATH_DEVNULL, O_RDWR)) == -1) |
510 | fatal("open(/dev/null): %s", strerror(errno)); | 515 | fatal("open(/dev/null): %s", strerror(errno)); |
@@ -537,7 +542,7 @@ execute_in_shell(const char *cmd) | |||
537 | _exit(1); | 542 | _exit(1); |
538 | } | 543 | } |
539 | /* Parent. */ | 544 | /* Parent. */ |
540 | if (pid < 0) | 545 | if (pid == -1) |
541 | fatal("%s: fork: %.100s", __func__, strerror(errno)); | 546 | fatal("%s: fork: %.100s", __func__, strerror(errno)); |
542 | 547 | ||
543 | close(devnull); | 548 | close(devnull); |
@@ -1168,7 +1173,7 @@ parse_char_array: | |||
1168 | max_entries = SSH_MAX_HOSTS_FILES; | 1173 | max_entries = SSH_MAX_HOSTS_FILES; |
1169 | goto parse_char_array; | 1174 | goto parse_char_array; |
1170 | 1175 | ||
1171 | case oHostName: | 1176 | case oHostname: |
1172 | charptr = &options->hostname; | 1177 | charptr = &options->hostname; |
1173 | goto parse_string; | 1178 | goto parse_string; |
1174 | 1179 | ||
@@ -1245,7 +1250,8 @@ parse_int: | |||
1245 | arg = strdelim(&s); | 1250 | arg = strdelim(&s); |
1246 | if (!arg || *arg == '\0') | 1251 | if (!arg || *arg == '\0') |
1247 | fatal("%.200s line %d: Missing argument.", filename, linenum); | 1252 | fatal("%.200s line %d: Missing argument.", filename, linenum); |
1248 | if (*arg != '-' && !ciphers_valid(*arg == '+' ? arg + 1 : arg)) | 1253 | if (*arg != '-' && |
1254 | !ciphers_valid(*arg == '+' || *arg == '^' ? arg + 1 : arg)) | ||
1249 | fatal("%.200s line %d: Bad SSH2 cipher spec '%s'.", | 1255 | fatal("%.200s line %d: Bad SSH2 cipher spec '%s'.", |
1250 | filename, linenum, arg ? arg : "<NONE>"); | 1256 | filename, linenum, arg ? arg : "<NONE>"); |
1251 | if (*activep && options->ciphers == NULL) | 1257 | if (*activep && options->ciphers == NULL) |
@@ -1256,8 +1262,9 @@ parse_int: | |||
1256 | arg = strdelim(&s); | 1262 | arg = strdelim(&s); |
1257 | if (!arg || *arg == '\0') | 1263 | if (!arg || *arg == '\0') |
1258 | fatal("%.200s line %d: Missing argument.", filename, linenum); | 1264 | fatal("%.200s line %d: Missing argument.", filename, linenum); |
1259 | if (*arg != '-' && !mac_valid(*arg == '+' ? arg + 1 : arg)) | 1265 | if (*arg != '-' && |
1260 | fatal("%.200s line %d: Bad SSH2 Mac spec '%s'.", | 1266 | !mac_valid(*arg == '+' || *arg == '^' ? arg + 1 : arg)) |
1267 | fatal("%.200s line %d: Bad SSH2 MAC spec '%s'.", | ||
1261 | filename, linenum, arg ? arg : "<NONE>"); | 1268 | filename, linenum, arg ? arg : "<NONE>"); |
1262 | if (*activep && options->macs == NULL) | 1269 | if (*activep && options->macs == NULL) |
1263 | options->macs = xstrdup(arg); | 1270 | options->macs = xstrdup(arg); |
@@ -1269,7 +1276,8 @@ parse_int: | |||
1269 | fatal("%.200s line %d: Missing argument.", | 1276 | fatal("%.200s line %d: Missing argument.", |
1270 | filename, linenum); | 1277 | filename, linenum); |
1271 | if (*arg != '-' && | 1278 | if (*arg != '-' && |
1272 | !kex_names_valid(*arg == '+' ? arg + 1 : arg)) | 1279 | !kex_names_valid(*arg == '+' || *arg == '^' ? |
1280 | arg + 1 : arg)) | ||
1273 | fatal("%.200s line %d: Bad SSH2 KexAlgorithms '%s'.", | 1281 | fatal("%.200s line %d: Bad SSH2 KexAlgorithms '%s'.", |
1274 | filename, linenum, arg ? arg : "<NONE>"); | 1282 | filename, linenum, arg ? arg : "<NONE>"); |
1275 | if (*activep && options->kex_algorithms == NULL) | 1283 | if (*activep && options->kex_algorithms == NULL) |
@@ -1284,7 +1292,8 @@ parse_keytypes: | |||
1284 | fatal("%.200s line %d: Missing argument.", | 1292 | fatal("%.200s line %d: Missing argument.", |
1285 | filename, linenum); | 1293 | filename, linenum); |
1286 | if (*arg != '-' && | 1294 | if (*arg != '-' && |
1287 | !sshkey_names_valid2(*arg == '+' ? arg + 1 : arg, 1)) | 1295 | !sshkey_names_valid2(*arg == '+' || *arg == '^' ? |
1296 | arg + 1 : arg, 1)) | ||
1288 | fatal("%s line %d: Bad key types '%s'.", | 1297 | fatal("%s line %d: Bad key types '%s'.", |
1289 | filename, linenum, arg ? arg : "<NONE>"); | 1298 | filename, linenum, arg ? arg : "<NONE>"); |
1290 | if (*activep && *charptr == NULL) | 1299 | if (*activep && *charptr == NULL) |
@@ -2666,7 +2675,7 @@ dump_client_config(Options *o, const char *host) | |||
2666 | 2675 | ||
2667 | /* Most interesting options first: user, host, port */ | 2676 | /* Most interesting options first: user, host, port */ |
2668 | dump_cfg_string(oUser, o->user); | 2677 | dump_cfg_string(oUser, o->user); |
2669 | dump_cfg_string(oHostName, host); | 2678 | dump_cfg_string(oHostname, host); |
2670 | dump_cfg_int(oPort, o->port); | 2679 | dump_cfg_int(oPort, o->port); |
2671 | 2680 | ||
2672 | /* Flag options */ | 2681 | /* Flag options */ |