summaryrefslogtreecommitdiffstats
path: root/ssh-add.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2019-01-21 13:53:35 +0100
committerDamien Miller <djm@mindrot.org>2019-01-21 13:56:52 +0100
commitc7670b091a7174760d619ef6738b4f26b2093301 (patch)
tree2955001e5574431487f93bf70a9c2e6733bae619 /ssh-add.c
parentupstream: adapt to changes in KEX APIs and file removals (diff)
downloadopenssh-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-add.c')
-rw-r--r--ssh-add.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/ssh-add.c b/ssh-add.c
index eb2552ad5..ac9c808dd 100644
--- a/ssh-add.c
+++ b/ssh-add.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-add.c,v 1.137 2019/01/20 22:03:29 djm Exp $ */
+/* $OpenBSD: ssh-add.c,v 1.138 2019/01/21 12:53:35 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -560,6 +560,7 @@ usage(void)
fprintf(stderr, " -e pkcs11 Remove keys provided by PKCS#11 provider.\n");
fprintf(stderr, " -T pubkey Test if ssh-agent can access matching private key.\n");
fprintf(stderr, " -q Be quiet after a successful operation.\n");
+ fprintf(stderr, " -v Be more verbose.\n");
}
int
@@ -571,6 +572,8 @@ main(int argc, char **argv)
char *pkcs11provider = NULL;
int r, i, ch, deleting = 0, ret = 0, key_only = 0;
int xflag = 0, lflag = 0, Dflag = 0, qflag = 0, Tflag = 0;
+ SyslogFacility log_facility = SYSLOG_FACILITY_AUTH;
+ LogLevel log_level = SYSLOG_LEVEL_INFO;
ssh_malloc_init(); /* must be called before any mallocs */
/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
@@ -579,6 +582,8 @@ main(int argc, char **argv)
__progname = ssh_get_progname(argv[0]);
seed_rng();
+ log_init(__progname, log_level, log_facility, 1);
+
setvbuf(stdout, NULL, _IOLBF, 0);
/* First, get a connection to the authentication agent. */
@@ -594,8 +599,14 @@ main(int argc, char **argv)
exit(2);
}
- while ((ch = getopt(argc, argv, "klLcdDTxXE:e:M:m:qs:t:")) != -1) {
+ while ((ch = getopt(argc, argv, "vklLcdDTxXE:e:M:m:qs:t:")) != -1) {
switch (ch) {
+ case 'v':
+ if (log_level == SYSLOG_LEVEL_INFO)
+ log_level = SYSLOG_LEVEL_DEBUG1;
+ else if (log_level < SYSLOG_LEVEL_DEBUG3)
+ log_level++;
+ break;
case 'E':
fingerprint_hash = ssh_digest_alg_by_name(optarg);
if (fingerprint_hash == -1)
@@ -667,6 +678,7 @@ main(int argc, char **argv)
goto done;
}
}
+ log_init(__progname, log_level, log_facility, 1);
if ((xflag != 0) + (lflag != 0) + (Dflag != 0) > 1)
fatal("Invalid combination of actions");