diff --git a/agent/ChangeLog b/agent/ChangeLog index a6885ea34..e23cd99a9 100644 --- a/agent/ChangeLog +++ b/agent/ChangeLog @@ -1,3 +1,8 @@ +2007-06-18 Marcus Brinkmann + + * gpg-agent.c (main): Percent escape pathname in --gpgconf-list + output. + 2007-06-18 Werner Koch * command.c (cmd_killagent) [W32]: New. diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c index 0e6381972..419f3769a 100644 --- a/agent/gpg-agent.c +++ b/agent/gpg-agent.c @@ -693,6 +693,7 @@ main (int argc, char **argv ) if (gpgconf_list) { char *filename; + char *filename_esc; /* List options and default values in the GPG Conf format. */ @@ -714,9 +715,12 @@ main (int argc, char **argv ) #define GC_OPT_FLAG_NO_ARG_DESC (1UL << 6) filename = make_filename (opt.homedir, "gpg-agent.conf", NULL ); + filename_esc = percent_escape (filename); + printf ("gpgconf-gpg-agent.conf:%lu:\"%s\n", - GC_OPT_FLAG_DEFAULT, filename); + GC_OPT_FLAG_DEFAULT, filename_esc); xfree (filename); + xfree (filename_esc); printf ("verbose:%lu:\n" "quiet:%lu:\n" diff --git a/g10/ChangeLog b/g10/ChangeLog index d87d98ec3..5e0a29062 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,7 @@ +2007-06-18 Marcus Brinkmann + + * gpg.c (gpgconf_list): Percent escape output of --gpgconf-list. + 2007-06-14 Werner Koch * call-agent.c (start_agent): Use gnupg_module_name. diff --git a/g10/gpg.c b/g10/gpg.c index b6776de59..1e202f681 100644 --- a/g10/gpg.c +++ b/g10/gpg.c @@ -1456,16 +1456,20 @@ list_config(char *items) static void gpgconf_list (const char *configfile) { + char *configfile_esc = percent_escape (configfile); + /* The following definitions are taken from gnupg/tools/gpgconf-comp.c. */ #define GC_OPT_FLAG_NONE 0UL #define GC_OPT_FLAG_DEFAULT (1UL << 4) printf ("gpgconf-gpg.conf:%lu:\"%s\n", - GC_OPT_FLAG_DEFAULT,configfile?configfile:"/dev/null"); + GC_OPT_FLAG_DEFAULT, configfile_esc ? configfile_esc : "/dev/null"); printf ("verbose:%lu:\n", GC_OPT_FLAG_NONE); printf ("quiet:%lu:\n", GC_OPT_FLAG_NONE); printf ("keyserver:%lu:\n", GC_OPT_FLAG_NONE); printf ("reader-port:%lu:\n", GC_OPT_FLAG_NONE); + + xfree (configfile_esc); } diff --git a/jnlib/ChangeLog b/jnlib/ChangeLog index 81f250791..f98b1a282 100644 --- a/jnlib/ChangeLog +++ b/jnlib/ChangeLog @@ -1,3 +1,8 @@ +2007-06-18 Marcus Brinkmann + + * stringhelp.h (percent_escape): New prototype. + * stringhelp.c (percent_escape): New function. + 2007-06-11 Werner Koch * utf8conv.c (jnlib_iconv_open, jnlib_iconv, jnlib_iconv_close): New. @@ -470,7 +475,7 @@ Mon Jan 24 13:04:28 CET 2000 Werner Koch *********************************************************** Copyright 2000, 2001, 2002, 2003, 2004, - 2005, 2006 Free Software Foundation, Inc. + 2005, 2006, 2007 Free Software Foundation, Inc. This file is free software; as a special exception the author gives unlimited permission to copy and/or distribute it, with or without diff --git a/jnlib/stringhelp.c b/jnlib/stringhelp.c index b7f8b28db..49d91c075 100644 --- a/jnlib/stringhelp.c +++ b/jnlib/stringhelp.c @@ -1,6 +1,6 @@ /* stringhelp.c - standard string helper functions * Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005, - * 2006 Free Software Foundation, Inc. + * 2006, 2007 Free Software Foundation, Inc. * * This file is part of JNLIB. * @@ -825,3 +825,37 @@ memrchr (const void *buffer, int c, size_t n) return NULL; } #endif /*HAVE_MEMRCHR*/ + + +/* Percent-escape the string STR by replacing colons with '%3a'. */ +char * +percent_escape (const char *str) +{ + int i = 0; + int j = 0; + char *ptr; + + if (!str) + return NULL; + + while (str[i]) + if (str[i++] == ':') + j++; + ptr = jnlib_xmalloc (i + 2 * j + 1); + i = 0; + while (*str) + { + if (*str == ':') + { + ptr[i++] = '%'; + ptr[i++] = '3'; + ptr[i++] = 'a'; + } + else + ptr[i++] = *str; + str++; + } + ptr[i] = '\0'; + + return ptr; +} diff --git a/jnlib/stringhelp.h b/jnlib/stringhelp.h index 869b0f00e..fdd887bf2 100644 --- a/jnlib/stringhelp.h +++ b/jnlib/stringhelp.h @@ -1,6 +1,6 @@ /* stringhelp.h * Copyright (C) 1998, 1999, 2000, 2001, 2003, - * 2006 Free Software Foundation, Inc. + * 2006, 2007 Free Software Foundation, Inc. * * This file is part of JNLIB. * @@ -117,5 +117,8 @@ isascii (int c) #endif #define STR2(v) STR(v) +/* Percent-escape the string STR by replacing colons with '%3a'. */ +char *percent_escape (const char *str); + #endif /*LIBJNLIB_STRINGHELP_H*/ diff --git a/scd/ChangeLog b/scd/ChangeLog index ad517f12a..0f2b59696 100644 --- a/scd/ChangeLog +++ b/scd/ChangeLog @@ -1,3 +1,7 @@ +2007-06-18 Marcus Brinkmann + + * scdaemon.c (main): Percent escape output of --gpgconf-list. + 2007-06-12 Werner Koch * scdaemon.c (main): Replace some calls by init_common_subsystems. @@ -1635,7 +1639,7 @@ the gpg-agent. - Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. This file is free software; as a special exception the author gives unlimited permission to copy and/or distribute it, with or without diff --git a/scd/scdaemon.c b/scd/scdaemon.c index 4fe0918b6..4e45907db 100644 --- a/scd/scdaemon.c +++ b/scd/scdaemon.c @@ -1,5 +1,5 @@ /* scdaemon.c - The GnuPG Smartcard Daemon - * Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc. + * Copyright (C) 2001, 2002, 2004, 2005, 2007 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -530,6 +530,8 @@ main (int argc, char **argv ) if (gpgconf_list) { /* List options and default values in the GPG Conf format. */ + char *filename = NULL; + char *filename_esc; /* The following list is taken from gnupg/tools/gpgconf-comp.c. */ /* Option flags. YOU MUST NOT CHANGE THE NUMBERS OF THE EXISTING @@ -548,11 +550,14 @@ main (int argc, char **argv ) a default, which is described by the value of the ARGDEF field. */ #define GC_OPT_FLAG_NO_ARG_DESC (1UL << 6) if (!config_filename) - config_filename = make_filename (opt.homedir, "scdaemon.conf", NULL ); + filename = make_filename (opt.homedir, "scdaemon.conf", NULL ); + filename_esc = percent_escape (filename); printf ("gpgconf-scdaemon.conf:%lu:\"%s\n", - GC_OPT_FLAG_DEFAULT, config_filename); - + GC_OPT_FLAG_DEFAULT, filename_esc); + xfree (filename_esc); + xfree (filename); + printf ("verbose:%lu:\n" "quiet:%lu:\n" "debug-level:%lu:\"none:\n" diff --git a/sm/ChangeLog b/sm/ChangeLog index 2833c9f6b..c5d342bd2 100644 --- a/sm/ChangeLog +++ b/sm/ChangeLog @@ -1,3 +1,7 @@ +2007-06-18 Marcus Brinkmann + + * gpgsm.c (main): Percent escape output of --gpgconf-list. + 2007-06-14 Werner Koch * call-agent.c (start_agent): Use gnupg_module_name. @@ -1931,7 +1935,7 @@ Copyright 2001, 2002, 2003, 2004, 2005, - 2006 Free Software Foundation, Inc. + 2006, 2007 Free Software Foundation, Inc. This file is free software; as a special exception the author gives unlimited permission to copy and/or distribute it, with or without diff --git a/sm/gpgsm.c b/sm/gpgsm.c index 0136680a8..11b759b65 100644 --- a/sm/gpgsm.c +++ b/sm/gpgsm.c @@ -1,6 +1,6 @@ /* gpgsm.c - GnuPG for S/MIME * Copyright (C) 2001, 2002, 2003, 2004, 2005, - * 2006 Free Software Foundation, Inc. + * 2006, 2007 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -1393,9 +1393,12 @@ main ( int argc, char **argv) a default, which is described by the value of the ARGDEF field. */ #define GC_OPT_FLAG_NO_ARG_DESC (1UL << 6) + char *config_filename_esc = percent_escape (opt.config_filename); + printf ("gpgconf-gpgsm.conf:%lu:\"%s\n", - GC_OPT_FLAG_DEFAULT, opt.config_filename); - + GC_OPT_FLAG_DEFAULT, config_filename_esc); + xfree (config_filename_esc); + printf ("verbose:%lu:\n" "quiet:%lu:\n" "debug-level:%lu:\"none:\n"