1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-03-11 22:52:47 +01:00

Add comment to last patch.

This commit is contained in:
Werner Koch 2011-03-02 09:50:12 +01:00
parent cb803a4b27
commit b7f74f5b46
2 changed files with 23 additions and 14 deletions

View File

@ -1,6 +1,8 @@
2011-03-02 Ben Kibbey <bjk@luxsci.net> (wk) 2011-03-02 Ben Kibbey <bjk@luxsci.net> (wk)
* command.c (cmd_clear_passphrase): Add option --mode=normal. * command.c (cmd_clear_passphrase): Add option --mode=normal.
(cmd_keyinfo): Add option --data.
(do_one_keyinfo): Return CACHED status. Add arg DATA.
2011-02-07 Werner Koch <wk@g10code.com> 2011-02-07 Werner Koch <wk@g10code.com>
@ -2928,7 +2930,7 @@ Fri Aug 18 14:27:14 CEST 2000 Werner Koch <wk@openit.de>
Copyright 2001, 2002, 2003, 2004, 2005, Copyright 2001, 2002, 2003, 2004, 2005,
2007, 2008, 2009, 2010 Free Software Foundation, Inc. 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
This file is free software; as a special exception the author gives This file is free software; as a special exception the author gives
unlimited permission to copy and/or distribute it, with or without unlimited permission to copy and/or distribute it, with or without

View File

@ -954,13 +954,13 @@ static const char hlp_keyinfo[] =
"IDSTR is the IDSTR used to distinguish keys on a smartcard. If it\n" "IDSTR is the IDSTR used to distinguish keys on a smartcard. If it\n"
" is not known a dash is used instead.\n" " is not known a dash is used instead.\n"
"\n" "\n"
"CACHED is 1 if the key was found in the key cache. If not, a '-'\n" "CACHED is 1 if the passphrase for the key was found in the key cache.\n"
"is used instead.\n" " If not, a '-' is used instead.\n"
"\n" "\n"
"More information may be added in the future."; "More information may be added in the future.";
static gpg_error_t static gpg_error_t
do_one_keyinfo (ctrl_t ctrl, const unsigned char *grip, assuan_context_t ctx, do_one_keyinfo (ctrl_t ctrl, const unsigned char *grip, assuan_context_t ctx,
int data) int data)
{ {
gpg_error_t err; gpg_error_t err;
char hexgrip[40+1]; char hexgrip[40+1];
@ -969,7 +969,7 @@ do_one_keyinfo (ctrl_t ctrl, const unsigned char *grip, assuan_context_t ctx,
char *serialno = NULL; char *serialno = NULL;
char *idstr = NULL; char *idstr = NULL;
const char *keytypestr; const char *keytypestr;
char *cached; const char *cached;
char *pw; char *pw;
err = agent_key_info_from_file (ctrl, grip, &keytype, &shadow_info); err = agent_key_info_from_file (ctrl, grip, &keytype, &shadow_info);
@ -987,6 +987,9 @@ do_one_keyinfo (ctrl_t ctrl, const unsigned char *grip, assuan_context_t ctx,
else else
keytypestr = "-"; keytypestr = "-";
/* Here we have a little race by doing the cache check separately
from the retrieval function. Given that the cache flag is only a
hint, it should not really matter. */
pw = agent_get_cache (hexgrip, CACHE_MODE_NORMAL); pw = agent_get_cache (hexgrip, CACHE_MODE_NORMAL);
cached = pw ? "1" : "-"; cached = pw ? "1" : "-";
xfree (pw); xfree (pw);
@ -1006,16 +1009,20 @@ do_one_keyinfo (ctrl_t ctrl, const unsigned char *grip, assuan_context_t ctx,
idstr? idstr : "-", idstr? idstr : "-",
cached, cached,
NULL); NULL);
else { else
char *string = xtryasprintf ("%s %s %s %s %s\n", hexgrip, keytypestr, {
serialno? serialno : "-", idstr? idstr : "-", cached); char *string;
if (!string) string = xtryasprintf ("%s %s %s %s %s\n",
err = gpg_error_from_syserror (); hexgrip, keytypestr,
serialno? serialno : "-",
err = assuan_send_data(ctx, string, strlen(string)); idstr? idstr : "-", cached);
xfree(string); if (!string)
} err = gpg_error_from_syserror ();
else
err = assuan_send_data (ctx, string, strlen(string));
xfree (string);
}
leave: leave:
xfree (shadow_info); xfree (shadow_info);