[git] Pinentry - branch, master, updated. pinentry-0.9.1-20-g1a8af55
by Neal H. Walfield
cvs at cvs.gnupg.org
Thu May 7 15:42:58 CEST 2015
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The standard pinentry collection".
The branch, master has been updated
via 1a8af55b76d8235ce891f44808064e7f846e193c (commit)
via 09203147bef487c9a85f55f8cc96d265197b0bf5 (commit)
from 3a8daef81c49dc3c04b6703a0384381cb43eb91b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 1a8af55b76d8235ce891f44808064e7f846e193c
Author: Neal H. Walfield <neal at gnu.org>
Date: Thu May 7 15:42:50 2015 +0200
Don't use asprintf.
* pinentry/password-cache.c (keygrip_to_label): Don't use asprintf.
diff --git a/pinentry/password-cache.c b/pinentry/password-cache.c
index 53bb39f..3548cdf 100644
--- a/pinentry/password-cache.c
+++ b/pinentry/password-cache.c
@@ -40,7 +40,7 @@ gpg_schema (void)
"org.gnupg.Passphrase", SECRET_SCHEMA_NONE,
{
{ "stored-by", SECRET_SCHEMA_ATTRIBUTE_STRING },
- { "key-grip", SECRET_SCHEMA_ATTRIBUTE_STRING },
+ { "keygrip", SECRET_SCHEMA_ATTRIBUTE_STRING },
{ "NULL", 0 },
}
};
@@ -48,26 +48,32 @@ gpg_schema (void)
}
static char *
-key_grip_to_label (const char *key_grip)
+keygrip_to_label (const char *keygrip)
{
- char *label = NULL;
- if (asprintf(&label, "GnuPG: %s", key_grip) < 0)
- return NULL;
+ char const prefix[] = "GnuPG: ";
+ char *label;
+
+ label = malloc (sizeof (prefix) + strlen (keygrip));
+ if (label)
+ {
+ memcpy (label, prefix, sizeof (prefix) - 1);
+ strcpy (&label[sizeof (prefix) - 1], keygrip);
+ }
return label;
}
#endif
void
-password_cache_save (const char *key_grip, const char *password)
+password_cache_save (const char *keygrip, const char *password)
{
#ifdef HAVE_LIBSECRET
char *label;
GError *error = NULL;
- if (! *key_grip)
+ if (! *keygrip)
return;
- label = key_grip_to_label (key_grip);
+ label = keygrip_to_label (keygrip);
if (! label)
return;
@@ -75,10 +81,10 @@ password_cache_save (const char *key_grip, const char *password)
SECRET_COLLECTION_DEFAULT,
label, password, NULL, &error,
"stored-by", "GnuPG Pinentry",
- "key-grip", key_grip, NULL))
+ "keygrip", keygrip, NULL))
{
printf("Failed to cache password for key %s with secret service: %s\n",
- key_grip, error->message);
+ keygrip, error->message);
g_error_free (error);
}
@@ -90,24 +96,24 @@ password_cache_save (const char *key_grip, const char *password)
}
char *
-password_cache_lookup (const char *key_grip)
+password_cache_lookup (const char *keygrip)
{
#ifdef HAVE_LIBSECRET
GError *error = NULL;
char *password;
char *password2;
- if (! *key_grip)
+ if (! *keygrip)
return NULL;
password = secret_password_lookup_nonpageable_sync
(gpg_schema (), NULL, &error,
- "key-grip", key_grip, NULL);
+ "keygrip", keygrip, NULL);
if (error != NULL)
{
printf("Failed to lookup password for key %s with secret service: %s\n",
- key_grip, error->message);
+ keygrip, error->message);
g_error_free (error);
return NULL;
}
commit 09203147bef487c9a85f55f8cc96d265197b0bf5
Author: Neal H. Walfield <neal at gnu.org>
Date: Thu May 7 15:42:19 2015 +0200
Improve documentation.
* doc/pinentry.texi: Improve description of SETKEYINFO's format.
diff --git a/doc/pinentry.texi b/doc/pinentry.texi
index 2c8aae1..ec6cc4f 100644
--- a/doc/pinentry.texi
+++ b/doc/pinentry.texi
@@ -448,16 +448,20 @@ Note: it is strongly recommended that a pinentry supporting this
feature provide the user an option to enable it manually. That is,
saving a passphrase in an external password manager should be opt-in.
-The key identifier provided by SETKEYINFO is the key grip, which is
-not the OpenPGP Key ID. To map the key grip to a key, you can use the
-following:
+The key identifier provided SETKEYINFO must be considered opaque and
+may change in the future. It currently has the form
+ at code{X/HEXSTRING} where @code{X} is either @code{n}, @code{s}, or
+ at code{u}. In the former two cases, the HEXSTRING corresponds to the
+key grip. The key grip is not the OpenPGP Key ID, but it can be
+mapped to the key using the following:
@example
# gpg2 --with-keygrip --list-secret-keys
@end example
@noindent
-and search for the key grip.
+and searching the output for the key grip. The same command-line
+options can also be used with gpgsm.
@end table
-----------------------------------------------------------------------
Summary of changes:
doc/pinentry.texi | 12 ++++++++----
pinentry/password-cache.c | 34 ++++++++++++++++++++--------------
2 files changed, 28 insertions(+), 18 deletions(-)
hooks/post-receive
--
The standard pinentry collection
http://git.gnupg.org
More information about the Gnupg-commits
mailing list