diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2020-01-21 07:07:32 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2020-01-21 07:07:32 +0000 |
commit | be7de4fbeb5ccf55ef1da0fa46a6d099eb470e39 (patch) | |
tree | da471669f762fcef1fe778f6367391165a5cc7e4 /usr.bin | |
parent | 4f6e6b1de8d169ccfd83f6301c1866cfc80fe197 (diff) |
check access(ssh-sk-helper, X_OK) to provide friendly error message
for misconfigured helper paths
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ssh/ssh-sk-client.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.bin/ssh/ssh-sk-client.c b/usr.bin/ssh/ssh-sk-client.c index bd93937c868..6ca85aaeba1 100644 --- a/usr.bin/ssh/ssh-sk-client.c +++ b/usr.bin/ssh/ssh-sk-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh-sk-client.c,v 1.5 2020/01/10 23:43:26 djm Exp $ */ +/* $OpenBSD: ssh-sk-client.c,v 1.6 2020/01/21 07:07:31 djm Exp $ */ /* * Copyright (c) 2019 Google LLC * @@ -19,6 +19,7 @@ #include <sys/socket.h> #include <sys/wait.h> +#include <fcntl.h> #include <limits.h> #include <errno.h> #include <signal.h> @@ -54,6 +55,13 @@ start_helper(int *fdp, pid_t *pidp, void (**osigchldp)(int)) helper = getenv("SSH_SK_HELPER"); if (helper == NULL || strlen(helper) == 0) helper = _PATH_SSH_SK_HELPER; + if (access(helper, X_OK) != 0) { + oerrno = errno; + error("%s: helper \"%s\" unusable: %s", __func__, helper, + strerror(errno)); + errno = oerrno; + return SSH_ERR_SYSTEM_ERROR; + } #ifdef DEBUG_SK verbosity = "-vvv"; #endif |