summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2019-01-20 22:54:31 +0000
committerDamien Miller <djm@cvs.openbsd.org>2019-01-20 22:54:31 +0000
commitbc41ea1347c3597d32efc1ac08e569d77902fe95 (patch)
treea5c10adeb0fdd8e455e3478f86f77d683781dda9
parent4eef135bb617d428d12d72212d67e9e91c68caef (diff)
allow override of the pkcs#11 helper binary via $SSH_PKCS11_HELPER;
needed for regress tests. work by markus@, ok me
-rw-r--r--usr.bin/ssh/ssh-pkcs11-client.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.bin/ssh/ssh-pkcs11-client.c b/usr.bin/ssh/ssh-pkcs11-client.c
index b43fdfa1827..b78a950b8d1 100644
--- a/usr.bin/ssh/ssh-pkcs11-client.c
+++ b/usr.bin/ssh/ssh-pkcs11-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-pkcs11-client.c,v 1.12 2019/01/20 22:51:37 djm Exp $ */
+/* $OpenBSD: ssh-pkcs11-client.c,v 1.13 2019/01/20 22:54:30 djm Exp $ */
/*
* Copyright (c) 2010 Markus Friedl. All rights reserved.
* Copyright (c) 2014 Pedro Martelletto. All rights reserved.
@@ -237,6 +237,7 @@ static int
pkcs11_start_helper(void)
{
int pair[2];
+ char *helper;
if (pkcs11_start_helper_methods() == -1) {
error("pkcs11_start_helper_methods failed");
@@ -258,10 +259,11 @@ pkcs11_start_helper(void)
}
close(pair[0]);
close(pair[1]);
- execlp(_PATH_SSH_PKCS11_HELPER, _PATH_SSH_PKCS11_HELPER,
- (char *)NULL);
- fprintf(stderr, "exec: %s: %s\n", _PATH_SSH_PKCS11_HELPER,
- strerror(errno));
+ helper = getenv("SSH_PKCS11_HELPER");
+ if (helper == NULL || strlen(helper) == 0)
+ helper = _PATH_SSH_PKCS11_HELPER;
+ execlp(helper, helper, (char *)NULL);
+ fprintf(stderr, "exec: %s: %s\n", helper, strerror(errno));
_exit(1);
}
close(pair[1]);