summaryrefslogtreecommitdiff
path: root/ssh-pkcs11-client.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2019-01-21 12:53:35 +0000
committerDamien Miller <djm@mindrot.org>2019-01-21 23:56:52 +1100
commitc7670b091a7174760d619ef6738b4f26b2093301 (patch)
tree2955001e5574431487f93bf70a9c2e6733bae619 /ssh-pkcs11-client.c
parent49d8c8e214d39acf752903566b105d06c565442a (diff)
downloadopenssh-git-c7670b091a7174760d619ef6738b4f26b2093301.tar.gz
upstream: add "-v" flags to ssh-add and ssh-pkcs11-helper to turn up
debug verbosity. Make ssh-agent turn on ssh-pkcs11-helper's verbosity when it is run in debug mode ("ssh-agent -d"), so we get to see errors from the PKCS#11 code. ok markus@ OpenBSD-Commit-ID: 0a798643c6a92a508df6bd121253ba1c8bee659d
Diffstat (limited to 'ssh-pkcs11-client.c')
-rw-r--r--ssh-pkcs11-client.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/ssh-pkcs11-client.c b/ssh-pkcs11-client.c
index 5ba33332..e7860de8 100644
--- a/ssh-pkcs11-client.c
+++ b/ssh-pkcs11-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-pkcs11-client.c,v 1.14 2019/01/20 22:57:45 djm Exp $ */
+/* $OpenBSD: ssh-pkcs11-client.c,v 1.15 2019/01/21 12:53:35 djm Exp $ */
/*
* Copyright (c) 2010 Markus Friedl. All rights reserved.
* Copyright (c) 2014 Pedro Martelletto. All rights reserved.
@@ -49,8 +49,8 @@
/* borrows code from sftp-server and ssh-agent */
-int fd = -1;
-pid_t pid = -1;
+static int fd = -1;
+static pid_t pid = -1;
static void
send_msg(struct sshbuf *m)
@@ -272,7 +272,10 @@ static int
pkcs11_start_helper(void)
{
int pair[2];
- char *helper;
+ char *helper, *verbosity = NULL;
+
+ if (log_level_get() >= SYSLOG_LEVEL_DEBUG1)
+ verbosity = "-vvv";
if (pkcs11_start_helper_methods() == -1) {
error("pkcs11_start_helper_methods failed");
@@ -297,7 +300,9 @@ pkcs11_start_helper(void)
helper = getenv("SSH_PKCS11_HELPER");
if (helper == NULL || strlen(helper) == 0)
helper = _PATH_SSH_PKCS11_HELPER;
- execlp(helper, helper, (char *)NULL);
+ debug("%s: starting %s %s", __func__, helper,
+ verbosity == NULL ? "" : verbosity);
+ execlp(helper, helper, verbosity, (char *)NULL);
fprintf(stderr, "exec: %s: %s\n", helper, strerror(errno));
_exit(1);
}