diff options
author | djm@openbsd.org <djm@openbsd.org> | 2019-01-21 13:53:35 +0100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2019-01-21 13:56:52 +0100 |
commit | c7670b091a7174760d619ef6738b4f26b2093301 (patch) | |
tree | 2955001e5574431487f93bf70a9c2e6733bae619 /ssh-pkcs11-helper.c | |
parent | upstream: adapt to changes in KEX APIs and file removals (diff) | |
download | openssh-c7670b091a7174760d619ef6738b4f26b2093301.tar.xz openssh-c7670b091a7174760d619ef6738b4f26b2093301.zip |
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-helper.c')
-rw-r--r-- | ssh-pkcs11-helper.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/ssh-pkcs11-helper.c b/ssh-pkcs11-helper.c index 92c6728ba..c7dfea279 100644 --- a/ssh-pkcs11-helper.c +++ b/ssh-pkcs11-helper.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh-pkcs11-helper.c,v 1.15 2019/01/20 22:51:37 djm Exp $ */ +/* $OpenBSD: ssh-pkcs11-helper.c,v 1.16 2019/01/21 12:53:35 djm Exp $ */ /* * Copyright (c) 2010 Markus Friedl. All rights reserved. * @@ -307,11 +307,12 @@ cleanup_exit(int i) _exit(i); } + int main(int argc, char **argv) { fd_set *rset, *wset; - int r, in, out, max, log_stderr = 0; + int r, ch, in, out, max, log_stderr = 0; ssize_t len, olen, set_size; SyslogFacility log_facility = SYSLOG_FACILITY_AUTH; LogLevel log_level = SYSLOG_LEVEL_ERROR; @@ -320,14 +321,31 @@ main(int argc, char **argv) extern char *__progname; ssh_malloc_init(); /* must be called before any mallocs */ + __progname = ssh_get_progname(argv[0]); + seed_rng(); TAILQ_INIT(&pkcs11_keylist); - pkcs11_init(0); - seed_rng(); - __progname = ssh_get_progname(argv[0]); + log_init(__progname, log_level, log_facility, log_stderr); + + while ((ch = getopt(argc, argv, "v")) != -1) { + switch (ch) { + case 'v': + log_stderr = 1; + if (log_level == SYSLOG_LEVEL_ERROR) + log_level = SYSLOG_LEVEL_DEBUG1; + else if (log_level < SYSLOG_LEVEL_DEBUG3) + log_level++; + break; + default: + fprintf(stderr, "usage: %s [-v]\n", __progname); + exit(1); + } + } log_init(__progname, log_level, log_facility, log_stderr); + pkcs11_init(0); + in = STDIN_FILENO; out = STDOUT_FILENO; |