diff options
author | djm@openbsd.org <djm@openbsd.org> | 2019-01-21 12:53:35 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2019-01-21 23:56:52 +1100 |
commit | c7670b091a7174760d619ef6738b4f26b2093301 (patch) | |
tree | 2955001e5574431487f93bf70a9c2e6733bae619 /ssh-add.c | |
parent | 49d8c8e214d39acf752903566b105d06c565442a (diff) |
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.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-add.c,v 1.137 2019/01/20 22:03:29 djm Exp $ */ | 1 | /* $OpenBSD: ssh-add.c,v 1.138 2019/01/21 12:53:35 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -560,6 +560,7 @@ usage(void) | |||
560 | fprintf(stderr, " -e pkcs11 Remove keys provided by PKCS#11 provider.\n"); | 560 | fprintf(stderr, " -e pkcs11 Remove keys provided by PKCS#11 provider.\n"); |
561 | fprintf(stderr, " -T pubkey Test if ssh-agent can access matching private key.\n"); | 561 | fprintf(stderr, " -T pubkey Test if ssh-agent can access matching private key.\n"); |
562 | fprintf(stderr, " -q Be quiet after a successful operation.\n"); | 562 | fprintf(stderr, " -q Be quiet after a successful operation.\n"); |
563 | fprintf(stderr, " -v Be more verbose.\n"); | ||
563 | } | 564 | } |
564 | 565 | ||
565 | int | 566 | int |
@@ -571,6 +572,8 @@ main(int argc, char **argv) | |||
571 | char *pkcs11provider = NULL; | 572 | char *pkcs11provider = NULL; |
572 | int r, i, ch, deleting = 0, ret = 0, key_only = 0; | 573 | int r, i, ch, deleting = 0, ret = 0, key_only = 0; |
573 | int xflag = 0, lflag = 0, Dflag = 0, qflag = 0, Tflag = 0; | 574 | int xflag = 0, lflag = 0, Dflag = 0, qflag = 0, Tflag = 0; |
575 | SyslogFacility log_facility = SYSLOG_FACILITY_AUTH; | ||
576 | LogLevel log_level = SYSLOG_LEVEL_INFO; | ||
574 | 577 | ||
575 | ssh_malloc_init(); /* must be called before any mallocs */ | 578 | ssh_malloc_init(); /* must be called before any mallocs */ |
576 | /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ | 579 | /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ |
@@ -579,6 +582,8 @@ main(int argc, char **argv) | |||
579 | __progname = ssh_get_progname(argv[0]); | 582 | __progname = ssh_get_progname(argv[0]); |
580 | seed_rng(); | 583 | seed_rng(); |
581 | 584 | ||
585 | log_init(__progname, log_level, log_facility, 1); | ||
586 | |||
582 | setvbuf(stdout, NULL, _IOLBF, 0); | 587 | setvbuf(stdout, NULL, _IOLBF, 0); |
583 | 588 | ||
584 | /* First, get a connection to the authentication agent. */ | 589 | /* First, get a connection to the authentication agent. */ |
@@ -594,8 +599,14 @@ main(int argc, char **argv) | |||
594 | exit(2); | 599 | exit(2); |
595 | } | 600 | } |
596 | 601 | ||
597 | while ((ch = getopt(argc, argv, "klLcdDTxXE:e:M:m:qs:t:")) != -1) { | 602 | while ((ch = getopt(argc, argv, "vklLcdDTxXE:e:M:m:qs:t:")) != -1) { |
598 | switch (ch) { | 603 | switch (ch) { |
604 | case 'v': | ||
605 | if (log_level == SYSLOG_LEVEL_INFO) | ||
606 | log_level = SYSLOG_LEVEL_DEBUG1; | ||
607 | else if (log_level < SYSLOG_LEVEL_DEBUG3) | ||
608 | log_level++; | ||
609 | break; | ||
599 | case 'E': | 610 | case 'E': |
600 | fingerprint_hash = ssh_digest_alg_by_name(optarg); | 611 | fingerprint_hash = ssh_digest_alg_by_name(optarg); |
601 | if (fingerprint_hash == -1) | 612 | if (fingerprint_hash == -1) |
@@ -667,6 +678,7 @@ main(int argc, char **argv) | |||
667 | goto done; | 678 | goto done; |
668 | } | 679 | } |
669 | } | 680 | } |
681 | log_init(__progname, log_level, log_facility, 1); | ||
670 | 682 | ||
671 | if ((xflag != 0) + (lflag != 0) + (Dflag != 0) > 1) | 683 | if ((xflag != 0) + (lflag != 0) + (Dflag != 0) > 1) |
672 | fatal("Invalid combination of actions"); | 684 | fatal("Invalid combination of actions"); |