[svn] gpgme - r1312 - in trunk: . doc gpgme
svn author wk
cvs at cvs.gnupg.org
Wed May 7 17:41:17 CEST 2008
Author: wk
Date: 2008-05-07 17:41:14 +0200 (Wed, 07 May 2008)
New Revision: 1312
Modified:
trunk/NEWS
trunk/TODO
trunk/doc/gpgme.texi
trunk/gpgme/ChangeLog
trunk/gpgme/engine-gpgconf.c
trunk/gpgme/gpgme.h
trunk/gpgme/rungpg.c
Log:
Support --locate-keys feature of gpg.
Modified: trunk/gpgme/ChangeLog
===================================================================
--- trunk/gpgme/ChangeLog 2008-05-06 08:13:39 UTC (rev 1311)
+++ trunk/gpgme/ChangeLog 2008-05-07 15:41:14 UTC (rev 1312)
@@ -1,3 +1,14 @@
+2008-05-07 Werner Koch <wk at g10code.com>
+
+ * engine-gpgconf.c (gpgconf_write): Change argv[0] to a
+ self-explaining string. Needs a proper fix, though.
+
+ * rungpg.c (gpg_keylist, gpg_keylist_ext): Factor common code out
+ to ..
+ (gpg_build_keylist_options): .. new. Allow combination of extern
+ and intern mode.
+ (gpg_new): DFT_TTYNAME is an array, thus check the first character.
+
2008-05-06 Werner Koch <wk at g10code.com>
* version.c (extract_version_string): New.
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2008-05-06 08:13:39 UTC (rev 1311)
+++ trunk/NEWS 2008-05-07 15:41:14 UTC (rev 1312)
@@ -1,6 +1,10 @@
Noteworthy changes in version 1.1.7 (unreleased)
------------------------------------------------
+ * Using GPGME_KEYLIST_MODE_LOCAL combined with
+ GPGME_KEYLIST_MODE_EXTERN is now supported; it uses the
+ --locate-keys feature of gpg (>= 2.0.10).
+
* The encoding of gpgme_data_t objects can affect the output encoding
of export, sign and encrypt operations now (the same operations
that are also affected by the ASCII mode switch). We believe this
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2008-05-06 08:13:39 UTC (rev 1311)
+++ trunk/TODO 2008-05-07 15:41:14 UTC (rev 1312)
@@ -148,7 +148,11 @@
** Map ASSUAN/GpgSM ERR error values in a better way than is done now. !!
** Some error values should identify the source more correctly (mostly error
values derived from status messages).
+** In rungpg.c we need to check the version of the engine
+ This requires a way to get the cached version number from the
+ engine layer.
+
* Tests
** Write a fake gpg-agent so that we can supply known passphrases to
gpgsm and setup the configuration files to use the agent. Without
Modified: trunk/doc/gpgme.texi
===================================================================
--- trunk/doc/gpgme.texi 2008-05-06 08:13:39 UTC (rev 1311)
+++ trunk/doc/gpgme.texi 2008-05-07 15:41:14 UTC (rev 1312)
@@ -2180,10 +2180,10 @@
@item GPGME_KEYLIST_MODE_EXTERN
The @code{GPGME_KEYLIST_MODE_EXTERN} symbol specifies that an external
-source should be searched for keys in the keylisting
-operation. The type of external source is dependant on the crypto
-engine used. For example, it can be a remote keyserver or LDAP
-certificate server.
+source should be searched for keys in the keylisting operation. The
+type of external source is dependant on the crypto engine used and
+whether it is combined with @code{GPGME_KEYLIST_MODE_LOCAL}. For
+example, it can be a remote keyserver or LDAP certificate server.
@item GPGME_KEYLIST_MODE_SIGS
The @code{GPGME_KEYLIST_MODE_SIGS} symbol specifies that the key
@@ -2208,7 +2208,7 @@
@code{GPGME_KEYLIST_MODE_EXTERN} must be specified. For future binary
compatibility, you should get the current mode with
@code{gpgme_get_keylist_mode} and modify it by setting or clearing the
-appropriate bits, and then using that calulcated value in the
+appropriate bits, and then using that calculated value in the
@code{gpgme_set_keylisting_mode} operation. This will leave all other
bits in the mode value intact (in particular those that are not used
in the current version of the library).
Modified: trunk/gpgme/engine-gpgconf.c
===================================================================
--- trunk/gpgme/engine-gpgconf.c 2008-05-06 08:13:39 UTC (rev 1311)
+++ trunk/gpgme/engine-gpgconf.c 2008-05-07 15:41:14 UTC (rev 1312)
@@ -628,7 +628,7 @@
/* _gpgme_engine_new guarantees that this is not NULL. */
argv[0] = gpgconf->file_name;
- argv[0] = "/home/marcus/g10/install/bin/gpgconf";
+ argv[0] = "/nowhere/path-needs-to-be-fixed/gpgconf";
if (_gpgme_io_pipe (rp, 0) < 0)
return gpg_error_from_syserror ();
Modified: trunk/gpgme/gpgme.h
===================================================================
--- trunk/gpgme/gpgme.h 2008-05-06 08:13:39 UTC (rev 1311)
+++ trunk/gpgme/gpgme.h 2008-05-07 15:41:14 UTC (rev 1312)
@@ -72,7 +72,7 @@
AM_PATH_GPGME macro) check that this header matches the installed
library. Warning: Do not edit the next line. configure will do
that for you! */
-#define GPGME_VERSION "1.1.7-svn1307"
+#define GPGME_VERSION "1.1.7-svn1311"
Modified: trunk/gpgme/rungpg.c
===================================================================
--- trunk/gpgme/rungpg.c 2008-05-06 08:13:39 UTC (rev 1311)
+++ trunk/gpgme/rungpg.c 2008-05-07 15:41:14 UTC (rev 1312)
@@ -486,7 +486,7 @@
rc = gpg_error_from_errno (errno);
else
{
- if (dft_ttyname)
+ if (*dft_ttyname)
{
rc = add_arg (gpg, "--ttyname");
if (!rc)
@@ -1872,20 +1872,12 @@
}
-static gpgme_error_t
-gpg_keylist (void *engine, const char *pattern, int secret_only,
- gpgme_keylist_mode_t mode)
+static gpg_error_t
+gpg_keylist_build_options (engine_gpg_t gpg, int secret_only,
+ gpgme_keylist_mode_t mode)
{
- engine_gpg_t gpg = engine;
- gpgme_error_t err;
+ gpg_error_t err;
- if (mode & GPGME_KEYLIST_MODE_EXTERN)
- {
- if ((mode & GPGME_KEYLIST_MODE_LOCAL)
- || secret_only)
- return gpg_error (GPG_ERR_NOT_SUPPORTED);
- }
-
err = add_arg (gpg, "--with-colons");
if (!err)
err = add_arg (gpg, "--fixed-list-mode");
@@ -1893,7 +1885,8 @@
err = add_arg (gpg, "--with-fingerprint");
if (!err)
err = add_arg (gpg, "--with-fingerprint");
- if (!err && (mode & GPGME_KEYLIST_MODE_SIGS)
+ if (!err
+ && (mode & GPGME_KEYLIST_MODE_SIGS)
&& (mode & GPGME_KEYLIST_MODE_SIG_NOTATIONS))
{
err = add_arg (gpg, "--list-options");
@@ -1902,22 +1895,51 @@
}
if (!err)
{
- if (mode & GPGME_KEYLIST_MODE_EXTERN)
+ if ( (mode & GPGME_KEYLIST_MODE_EXTERN) )
{
- err = add_arg (gpg, "--search-keys");
- gpg->colon.preprocess_fnc = gpg_keylist_preprocess;
+ if (secret_only)
+ err = gpg_error (GPG_ERR_NOT_SUPPORTED);
+ else if ( (mode & GPGME_KEYLIST_MODE_LOCAL))
+ {
+ /* The local+extern mode is special. It works only with
+ gpg >= 2.0.10. FIXME: We should check that we have
+ such a version to that we can return a proper error
+ code. The problem is that we don't know the context
+ here and thus can't accesses the cached version
+ number for the engine info structure. */
+ err = add_arg (gpg, "--locate-keys");
+ if ((mode & GPGME_KEYLIST_MODE_SIGS))
+ err = add_arg (gpg, "--with-sig-check");
+ }
+ else
+ {
+ err = add_arg (gpg, "--search-keys");
+ gpg->colon.preprocess_fnc = gpg_keylist_preprocess;
+ }
}
else
- {
- err = add_arg (gpg, secret_only ? "--list-secret-keys"
- : ((mode & GPGME_KEYLIST_MODE_SIGS)
- ? "--check-sigs" : "--list-keys"));
- }
+ {
+ err = add_arg (gpg, secret_only ? "--list-secret-keys"
+ : ((mode & GPGME_KEYLIST_MODE_SIGS)
+ ? "--check-sigs" : "--list-keys"));
+ }
}
-
- /* Tell the gpg object about the data. */
if (!err)
err = add_arg (gpg, "--");
+
+ return err;
+}
+
+
+static gpgme_error_t
+gpg_keylist (void *engine, const char *pattern, int secret_only,
+ gpgme_keylist_mode_t mode)
+{
+ engine_gpg_t gpg = engine;
+ gpgme_error_t err;
+
+ err = gpg_keylist_build_options (gpg, secret_only, mode);
+
if (!err && pattern && *pattern)
err = add_arg (gpg, pattern);
@@ -1938,26 +1960,7 @@
if (reserved)
return gpg_error (GPG_ERR_INV_VALUE);
- err = add_arg (gpg, "--with-colons");
- if (!err)
- err = add_arg (gpg, "--fixed-list-mode");
- if (!err)
- err = add_arg (gpg, "--with-fingerprint");
- if (!err)
- err = add_arg (gpg, "--with-fingerprint");
- if (!err && (mode & GPGME_KEYLIST_MODE_SIGS)
- && (mode & GPGME_KEYLIST_MODE_SIG_NOTATIONS))
- {
- err = add_arg (gpg, "--list-options");
- if (!err)
- err = add_arg (gpg, "show-sig-subpackets=\"20,26\"");
- }
- if (!err)
- err = add_arg (gpg, secret_only ? "--list-secret-keys"
- : ((mode & GPGME_KEYLIST_MODE_SIGS)
- ? "--check-sigs" : "--list-keys"));
- if (!err)
- err = add_arg (gpg, "--");
+ err = gpg_keylist_build_options (gpg, secret_only, mode);
if (pattern)
{
More information about the Gnupg-commits
mailing list