From 9e4169fcec45a7c53d421f9a25566b0f849d7f48 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 19 Jun 2008 17:37:31 +0000 Subject: [PATCH] Add new types to the gpgconf interface. Fix a parsing bug in gpgconf interface. --- AUTHORS | 3 ++- TODO | 2 ++ doc/ChangeLog | 5 ++++ doc/uiserver.texi | 15 ++++++++++-- gpgme/ChangeLog | 12 +++++++++ gpgme/engine-gpgconf.c | 55 ++++++++++++++++++++++++++++++------------ gpgme/gpgme.h | 17 +++++++++---- 7 files changed, 86 insertions(+), 23 deletions(-) diff --git a/AUTHORS b/AUTHORS index 188792d1..142b81a9 100644 --- a/AUTHORS +++ b/AUTHORS @@ -2,7 +2,8 @@ Package: gpgme Maintainer: Marcus Brinkmann Bug reports: bug-gpgme@gnupg.org Security related bug reports: security@gnupg.org -License: LGPLv2.1+ +License (software): LGPLv2.1+ +License (manual): GPLv3+ FSF diff --git a/TODO b/TODO index bd961a5a..6cff25dd 100644 --- a/TODO +++ b/TODO @@ -9,6 +9,8 @@ Hey Emacs, this is -*- outline -*- mode! The test is currently disabled there and in gpg/t-import. ** When gpg supports it, write binary subpackets directly, and parse SUBPACKET status lines. +** A few months after 1.1.7: + Remove GPGME_CONF_PATHNAME macro. * ABI's to break: ** gpgme_edit_cb_t: Add "processed" return argument diff --git a/doc/ChangeLog b/doc/ChangeLog index 9481a52e..e7f113d6 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2008-06-05 Werner Koch + + * uiserver.texi (Miscellaneous UI Server Commands): Describe + START_CONFDIALOG. + 2008-06-04 Werner Koch * gpgme.texi: Use @copying command. Change license to diff --git a/doc/uiserver.texi b/doc/uiserver.texi index c372750c..14a249a1 100644 --- a/doc/uiserver.texi +++ b/doc/uiserver.texi @@ -542,8 +542,8 @@ values (e.g. @code{HWND}). @noindent -GpgOL features a button to invoke the certificate manager. To do this -it uses the Assuan command: +A client may want to fire up the certificate manager of the server. To +do this it uses the Assuan command: @deffn Command START_KEYMANAGER The server shall pop up the main window of the key manager (aka @@ -552,6 +552,17 @@ into the foregound and that this command immediatley returns (does not wait until the key manager has been fully brought up). @end deffn +@noindent +A client may want to fire up the configuration dialog of the server. To +do this it uses the Assuan command: + +@deffn Command START_CONFDIALOG +The server shall pop up its configuration dialog. The client expects +that this dialog is brought into the foregound and that this command +immediatley returns (i.e. it does not wait until the dialog has been +fully brought up). +@end deffn + @anchor{command SENDER} @noindent When doing an operation on a mail, it is useful to let the server know diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index 2111ebbd..f527ba96 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,3 +1,15 @@ +2008-06-19 Werner Koch + + * gpgme.h (GPGME_CONF_PATHNAME): Replace by GPGME_CONF_FILENAME, + change all callers and provide compatibilty macro. + (gpgme_conf_type_t): Add complex types 34..37. + * engine-gpgconf.c (gpgconf_parse_option, arg_to_data) + (_gpgme_conf_arg_new, _gpgme_conf_arg_release): Add new types. + +2008-06-19 Marcus Brinkmann + + * engine-gpgconf.c (gpgconf_parse_option): Fix comma detection. + 2008-05-09 Werner Koch * engine-gpgconf.c (gpgconf_read): Do not pass empty lines to the diff --git a/gpgme/engine-gpgconf.c b/gpgme/engine-gpgconf.c index 38a293e4..c894dea9 100644 --- a/gpgme/engine-gpgconf.c +++ b/gpgme/engine-gpgconf.c @@ -15,9 +15,8 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + License along with this program; if not, see . + */ #if HAVE_CONFIG_H #include @@ -338,13 +337,15 @@ gpgconf_parse_option (gpgme_conf_opt_t opt, if (!line[0]) return 0; - mark = strchr (line, ','); - if (mark) - *mark = '\0'; - while (line) { - gpgme_conf_arg_t arg = calloc (1, sizeof (*arg)); + gpgme_conf_arg_t arg; + + mark = strchr (line, ','); + if (mark) + *mark = '\0'; + + arg = calloc (1, sizeof (*arg)); if (!arg) return gpg_error_from_syserror (); *arg_p = arg; @@ -367,8 +368,14 @@ gpgconf_parse_option (gpgme_conf_opt_t opt, break; case GPGME_CONF_STRING: - case GPGME_CONF_PATHNAME: - case GPGME_CONF_LDAP_SERVER: + /* The complex types below are only here to silent the + compiler warning. */ + case GPGME_CONF_FILENAME: + case GPGME_CONF_LDAP_SERVER: + case GPGME_CONF_KEY_FPR: + case GPGME_CONF_PUB_KEY: + case GPGME_CONF_SEC_KEY: + case GPGME_CONF_ALIAS_LIST: /* Skip quote character. */ line++; @@ -535,6 +542,8 @@ _gpgme_conf_arg_new (gpgme_conf_arg_t *arg_p, arg->no_arg = 1; else { + /* We need to switch on type here because the alt-type is not + yet known. */ switch (type) { case GPGME_CONF_NONE: @@ -547,8 +556,12 @@ _gpgme_conf_arg_new (gpgme_conf_arg_t *arg_p, break; case GPGME_CONF_STRING: - case GPGME_CONF_PATHNAME: + case GPGME_CONF_FILENAME: case GPGME_CONF_LDAP_SERVER: + case GPGME_CONF_KEY_FPR: + case GPGME_CONF_PUB_KEY: + case GPGME_CONF_SEC_KEY: + case GPGME_CONF_ALIAS_LIST: arg->value.string = strdup (value); if (!arg->value.string) { @@ -571,6 +584,7 @@ _gpgme_conf_arg_new (gpgme_conf_arg_t *arg_p, void _gpgme_conf_arg_release (gpgme_conf_arg_t arg, gpgme_conf_type_t type) { + /* Lacking the alt_type we need to switch on type here. */ switch (type) { case GPGME_CONF_NONE: @@ -580,8 +594,12 @@ _gpgme_conf_arg_release (gpgme_conf_arg_t arg, gpgme_conf_type_t type) default: break; - case GPGME_CONF_PATHNAME: + case GPGME_CONF_FILENAME: case GPGME_CONF_LDAP_SERVER: + case GPGME_CONF_KEY_FPR: + case GPGME_CONF_PUB_KEY: + case GPGME_CONF_SEC_KEY: + case GPGME_CONF_ALIAS_LIST: type = GPGME_CONF_STRING; break; } @@ -718,10 +736,17 @@ arg_to_data (gpgme_data_t conf, gpgme_conf_opt_t option, gpgme_conf_arg_t arg) buf[sizeof (buf) - 1] = '\0'; amt = gpgme_data_write (conf, buf, strlen (buf)); break; - + + case GPGME_CONF_STRING: - case GPGME_CONF_PATHNAME: - case GPGME_CONF_LDAP_SERVER: + /* The complex types below are only here to silent the + compiler warning. */ + case GPGME_CONF_FILENAME: + case GPGME_CONF_LDAP_SERVER: + case GPGME_CONF_KEY_FPR: + case GPGME_CONF_PUB_KEY: + case GPGME_CONF_SEC_KEY: + case GPGME_CONF_ALIAS_LIST: /* One quote character, and three times to allow for percent escaping. */ { diff --git a/gpgme/gpgme.h b/gpgme/gpgme.h index a9f2b2e4..778932f4 100644 --- a/gpgme/gpgme.h +++ b/gpgme/gpgme.h @@ -1654,10 +1654,10 @@ gpgme_error_t gpgme_op_getauditlog (gpgme_ctx_t ctx, gpgme_data_t output, unsigned int flags); -/* Interface to gpg-conf. */ +/* Interface to gpgconf(1). */ /* The expert level at which a configuration option or group of - options should be displayed. See the gpg-conf documentation for + options should be displayed. See the gpgconf(1) documentation for more details. */ typedef enum { @@ -1670,7 +1670,7 @@ typedef enum gpgme_conf_level_t; -/* The data type of a configuration option argument. See the gpg-conf +/* The data type of a configuration option argument. See the gpgconf(1) documentation for more details. */ typedef enum { @@ -1681,10 +1681,17 @@ typedef enum GPGME_CONF_UINT32 = 3, /* Complex types. */ - GPGME_CONF_PATHNAME = 32, - GPGME_CONF_LDAP_SERVER = 33 + GPGME_CONF_FILENAME = 32, + GPGME_CONF_LDAP_SERVER = 33, + GPGME_CONF_KEY_FPR = 34, + GPGME_CONF_PUB_KEY = 35, + GPGME_CONF_SEC_KEY = 36, + GPGME_CONF_ALIAS_LIST = 37 } gpgme_conf_type_t; +/* Macro for backward compatibility (even though it was undocumented + and marked as experimental in 1.1.6 - will be removed after 1.1.7): */ +#define GPGME_CONF_PATHNAME GPGME_CONF_FILENAME /* This represents a single argument for a configuration option.