summaryrefslogtreecommitdiff
path: root/ssh-pkcs11-client.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-pkcs11-client.c')
-rw-r--r--ssh-pkcs11-client.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/ssh-pkcs11-client.c b/ssh-pkcs11-client.c
index 6e16b2f9a..de5aa8305 100644
--- a/ssh-pkcs11-client.c
+++ b/ssh-pkcs11-client.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-pkcs11-client.c,v 1.12 2019/01/20 22:51:37 djm Exp $ */ 1/* $OpenBSD: ssh-pkcs11-client.c,v 1.13 2019/01/20 22:54:30 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2010 Markus Friedl. All rights reserved. 3 * Copyright (c) 2010 Markus Friedl. All rights reserved.
4 * Copyright (c) 2014 Pedro Martelletto. All rights reserved. 4 * Copyright (c) 2014 Pedro Martelletto. All rights reserved.
@@ -245,6 +245,7 @@ static int
245pkcs11_start_helper(void) 245pkcs11_start_helper(void)
246{ 246{
247 int pair[2]; 247 int pair[2];
248 char *helper;
248 249
249 if (pkcs11_start_helper_methods() == -1) { 250 if (pkcs11_start_helper_methods() == -1) {
250 error("pkcs11_start_helper_methods failed"); 251 error("pkcs11_start_helper_methods failed");
@@ -266,10 +267,11 @@ pkcs11_start_helper(void)
266 } 267 }
267 close(pair[0]); 268 close(pair[0]);
268 close(pair[1]); 269 close(pair[1]);
269 execlp(_PATH_SSH_PKCS11_HELPER, _PATH_SSH_PKCS11_HELPER, 270 helper = getenv("SSH_PKCS11_HELPER");
270 (char *)NULL); 271 if (helper == NULL || strlen(helper) == 0)
271 fprintf(stderr, "exec: %s: %s\n", _PATH_SSH_PKCS11_HELPER, 272 helper = _PATH_SSH_PKCS11_HELPER;
272 strerror(errno)); 273 execlp(helper, helper, (char *)NULL);
274 fprintf(stderr, "exec: %s: %s\n", helper, strerror(errno));
273 _exit(1); 275 _exit(1);
274 } 276 }
275 close(pair[1]); 277 close(pair[1]);