summaryrefslogtreecommitdiff
path: root/ssh-sk-client.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2020-01-21 07:07:31 +0000
committerDamien Miller <djm@mindrot.org>2020-01-21 18:09:25 +1100
commitb5fcb0ac1cc0ef01aeec1c089146298654ab3ae0 (patch)
tree51a92a833a7c39892f7d383e4f1aac39b6b766e2 /ssh-sk-client.c
parent56bced43c14dc6fa2bfa1816007e441644105609 (diff)
upstream: check access(ssh-sk-helper, X_OK) to provide friendly
error message for misconfigured helper paths OpenBSD-Commit-ID: 061bcc262155d12e726305c91394ac0aaf1f8341
Diffstat (limited to 'ssh-sk-client.c')
-rw-r--r--ssh-sk-client.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/ssh-sk-client.c b/ssh-sk-client.c
index 9121570dc..359327b68 100644
--- a/ssh-sk-client.c
+++ b/ssh-sk-client.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-sk-client.c,v 1.5 2020/01/10 23:43:26 djm Exp $ */ 1/* $OpenBSD: ssh-sk-client.c,v 1.6 2020/01/21 07:07:31 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2019 Google LLC 3 * Copyright (c) 2019 Google LLC
4 * 4 *
@@ -21,6 +21,7 @@
21#include <sys/socket.h> 21#include <sys/socket.h>
22#include <sys/wait.h> 22#include <sys/wait.h>
23 23
24#include <fcntl.h>
24#include <limits.h> 25#include <limits.h>
25#include <errno.h> 26#include <errno.h>
26#include <signal.h> 27#include <signal.h>
@@ -56,6 +57,13 @@ start_helper(int *fdp, pid_t *pidp, void (**osigchldp)(int))
56 helper = getenv("SSH_SK_HELPER"); 57 helper = getenv("SSH_SK_HELPER");
57 if (helper == NULL || strlen(helper) == 0) 58 if (helper == NULL || strlen(helper) == 0)
58 helper = _PATH_SSH_SK_HELPER; 59 helper = _PATH_SSH_SK_HELPER;
60 if (access(helper, X_OK) != 0) {
61 oerrno = errno;
62 error("%s: helper \"%s\" unusable: %s", __func__, helper,
63 strerror(errno));
64 errno = oerrno;
65 return SSH_ERR_SYSTEM_ERROR;
66 }
59#ifdef DEBUG_SK 67#ifdef DEBUG_SK
60 verbosity = "-vvv"; 68 verbosity = "-vvv";
61#endif 69#endif