Add new types to the gpgconf interface.

Fix a parsing bug in gpgconf interface.
This commit is contained in:
Werner Koch 2008-06-19 17:37:31 +00:00
parent 1358096083
commit 9e4169fcec
7 changed files with 86 additions and 23 deletions

View File

@ -2,7 +2,8 @@ Package: gpgme
Maintainer: Marcus Brinkmann <marcus@g10code.com>
Bug reports: bug-gpgme@gnupg.org
Security related bug reports: security@gnupg.org
License: LGPLv2.1+
License (software): LGPLv2.1+
License (manual): GPLv3+
FSF <gnu@gnu.org>

2
TODO
View File

@ -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

View File

@ -1,3 +1,8 @@
2008-06-05 Werner Koch <wk@g10code.com>
* uiserver.texi (Miscellaneous UI Server Commands): Describe
START_CONFDIALOG.
2008-06-04 Werner Koch <wk@g10code.com>
* gpgme.texi: Use @copying command. Change license to

View File

@ -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

View File

@ -1,3 +1,15 @@
2008-06-19 Werner Koch <wk@g10code.com>
* 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 <marcus@g10code.de>
* engine-gpgconf.c (gpgconf_parse_option): Fix comma detection.
2008-05-09 Werner Koch <wk@g10code.com>
* engine-gpgconf.c (gpgconf_read): Do not pass empty lines to the

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#if HAVE_CONFIG_H
#include <config.h>
@ -338,13 +337,15 @@ gpgconf_parse_option (gpgme_conf_opt_t opt,
if (!line[0])
return 0;
while (line)
{
gpgme_conf_arg_t arg;
mark = strchr (line, ',');
if (mark)
*mark = '\0';
while (line)
{
gpgme_conf_arg_t arg = calloc (1, sizeof (*arg));
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:
/* 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;
}
@ -719,9 +737,16 @@ arg_to_data (gpgme_data_t conf, gpgme_conf_opt_t option, gpgme_conf_arg_t arg)
amt = gpgme_data_write (conf, buf, strlen (buf));
break;
case GPGME_CONF_STRING:
case GPGME_CONF_PATHNAME:
/* 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. */
{

View File

@ -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.