From cvs at cvs.gnupg.org Fri May 2 20:37:48 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Fri, 02 May 2008 20:37:48 +0200 Subject: [svn] GpgOL - r249 - trunk/src Message-ID: Author: wk Date: 2008-05-02 20:37:47 +0200 (Fri, 02 May 2008) New Revision: 249 Modified: trunk/src/ChangeLog trunk/src/display.cpp trunk/src/main.c trunk/src/message-events.cpp trunk/src/mimeparser.c trunk/src/rfc822parse.c Log: Distinguish inline and attachment dispositions. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2008-04-16 18:24:36 UTC (rev 248) +++ trunk/src/ChangeLog 2008-05-02 18:37:47 UTC (rev 249) @@ -1,3 +1,9 @@ +2008-05-02 Werner Koch + + * mimeparser.c (t2body): Detect non-inline text parts. + * rfc822parse.c (rfc822parse_query_parameter): Add special mode + for an ATTR of NULL. + 2008-04-16 Werner Koch * message-events.h (class GpgolMessageEvents): Add M_GOTINSPECTOR. Modified: trunk/src/display.cpp =================================================================== --- trunk/src/display.cpp 2008-04-16 18:24:36 UTC (rev 248) +++ trunk/src/display.cpp 2008-05-02 18:37:47 UTC (rev 249) @@ -201,9 +201,14 @@ is_inspector_display (HWND hwnd) { struct find_message_window_state findstate; + int rc; memset (&findstate, 0, sizeof findstate); - return !!find_message_window (hwnd, &findstate); + rc = !!find_message_window (hwnd, &findstate); + if (!rc) + log_window_hierarchy (hwnd, "The windows blow hwnd %p", hwnd); + + return rc; } Modified: trunk/src/main.c =================================================================== --- trunk/src/main.c 2008-04-16 18:24:36 UTC (rev 248) +++ trunk/src/main.c 2008-05-02 18:37:47 UTC (rev 249) @@ -1,5 +1,5 @@ /* main.c - DLL entry point - * Copyright (C) 2005, 2007 g10 Code GmbH + * Copyright (C) 2005, 2007, 2008 g10 Code GmbH * * This file is part of GpgOL. * Modified: trunk/src/message-events.cpp =================================================================== --- trunk/src/message-events.cpp 2008-04-16 18:24:36 UTC (rev 248) +++ trunk/src/message-events.cpp 2008-05-02 18:37:47 UTC (rev 249) @@ -127,6 +127,11 @@ shows a grey window with a notice that the message can't be shown due to active content. */ + /* The is_inspector_display function is not reliable enough. + Missing another solution we set it to true for now with the + result that the preview decryption can't be disabled. */ + m_gotinspector = 1; + if (m_gotinspector || opt.preview_decrypt) { eecb->GetObject (&mdb, (LPMAPIPROP *)&message); Modified: trunk/src/mimeparser.c =================================================================== --- trunk/src/mimeparser.c 2008-04-16 18:24:36 UTC (rev 248) +++ trunk/src/mimeparser.c 2008-05-02 18:37:47 UTC (rev 249) @@ -704,6 +704,7 @@ size_t off; char *p; int is_text = 0; + int not_inline_text = 0; char *filename = NULL; char *charset = NULL; @@ -731,6 +732,9 @@ s = rfc822parse_query_parameter (field, "filename", 0); if (s) filename = xstrdup (s); + s = rfc822parse_query_parameter (field, NULL, 1); + if (s && !strcmp (s, "inline")) + not_inline_text = 1; rfc822parse_release_field (field); } @@ -838,6 +842,11 @@ rfc822parse_release_field (field); /* (Content-type) */ ctx->in_data = 1; + /* Need to start an attachment if we have seen a content disposition + other then the inline type. */ + if (is_text && not_inline_text) + ctx->collect_attachment = 1; + if (debug_mime_parser) log_debug ("%s:%s: this body: nesting=%d partno=%d is_text=%d, is_opq=%d" " charset=\"%s\"\n", @@ -847,7 +856,7 @@ ctx->mimestruct_cur->charset?ctx->mimestruct_cur->charset:""); /* If this is a text part, decide whether we treat it as our body. */ - if (is_text) + if (is_text && !not_inline_text) { ctx->collect_attachment = 1; Modified: trunk/src/rfc822parse.c =================================================================== --- trunk/src/rfc822parse.c 2008-04-16 18:24:36 UTC (rev 248) +++ trunk/src/rfc822parse.c 2008-05-02 18:37:47 UTC (rev 249) @@ -1012,8 +1012,9 @@ With LOWER_VALUE set to true, a matching field value will be lowercased. - Note, that ATTR should be lowercase. A CTX of NULL is allowed and - will return NULL. + Note, that ATTR should be lowercase. If ATTR is NULL the fucntion + returns the first token of the field; i.e. not the parameter but + the actual value. A CTX of NULL is allowed and will return NULL. */ const char * rfc822parse_query_parameter (rfc822parse_field_t ctx, const char *attr, @@ -1021,6 +1022,22 @@ { TOKEN t, a; + if (!attr) + { + t = ctx; + if (t + && (t->type == tATOM || t->type == tQUOTED || t->type == tDOMAINLIT)) + { + if ( lower_value && !t->flags.lowered ) + { + lowercase_string (t->data); + t->flags.lowered = 1; + } + return t->data; + } + return NULL; + } + for (t = ctx; t; t = t->next) { /* skip to the next semicolon */ @@ -1213,7 +1230,22 @@ } else printf ("*** media: text/plain [assumed]\n"); - + + ctx = rfc822parse_parse_field (msg, "Content-Disposition", -1); + if (ctx) + { + const char *s1; + TOKEN t; + + s1 = rfc822parse_query_parameter (ctx, NULL, 1); + if (s1) + printf ("*** disp: type=`%s'\n", s1); + s1 = rfc822parse_query_parameter (ctx, "filename", 0); + if (s1) + printf ("*** disp: fname=`%s'\n", s1); + + rfc822parse_release_field (ctx); + } } From cvs at cvs.gnupg.org Sat May 3 00:54:30 2008 From: cvs at cvs.gnupg.org (svn author mo) Date: Sat, 03 May 2008 00:54:30 +0200 Subject: [svn] GnuPG - r4755 - / Message-ID: Author: mo Date: 2008-05-03 00:54:30 +0200 (Sat, 03 May 2008) New Revision: 4755 Added: 2.0-mo-scd/ Log: New branch for hacking on the "scdaemon as a service" concept. From cvs at cvs.gnupg.org Mon May 5 01:24:29 2008 From: cvs at cvs.gnupg.org (svn author marcus) Date: Mon, 05 May 2008 01:24:29 +0200 Subject: [svn] pinentry - r182 - in trunk: . gtk+-2 Message-ID: Author: marcus Date: 2008-05-05 01:24:28 +0200 (Mon, 05 May 2008) New Revision: 182 Modified: trunk/ChangeLog trunk/gtk+-2/gtksecentry.c Log: 2008-05-05 Marcus Brinkmann * gtk+-2/gtksecentry.c (GMALLOC_SIZE): New symbol. (g_malloc, g_malloc0, g_realloc): Use GMALLOC_SIZE instead of gulong for size attribute. Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-03-03 14:20:29 UTC (rev 181) +++ trunk/ChangeLog 2008-05-04 23:24:28 UTC (rev 182) @@ -1,3 +1,9 @@ +2008-05-05 Marcus Brinkmann + + * gtk+-2/gtksecentry.c (GMALLOC_SIZE): New symbol. + (g_malloc, g_malloc0, g_realloc): Use GMALLOC_SIZE instead of + gulong for size attribute. + 2008-03-03 Marcus Brinkmann * gtk+-2/pinentry-gtk-2.c (create_window): Install realize callback. Modified: trunk/gtk+-2/gtksecentry.c =================================================================== --- trunk/gtk+-2/gtksecentry.c 2008-03-03 14:20:29 UTC (rev 181) +++ trunk/gtk+-2/gtksecentry.c 2008-05-04 23:24:28 UTC (rev 182) @@ -269,8 +269,14 @@ } while(0) +#if GLIB_CHECK_VERSION (2,15,5) +GMALLOC_SIZE gsize +#else +GMALLOC_SIZE gulong +#endif + gpointer -g_malloc(gulong size) +g_malloc (GMALLOC_SIZE size) { gpointer p; @@ -288,7 +294,7 @@ } gpointer -g_malloc0(gulong size) +g_malloc0 (GMALLOC_SIZE size) { gpointer p; @@ -308,7 +314,7 @@ } gpointer -g_realloc(gpointer mem, gulong size) +g_realloc (gpointer mem, GMALLOC_SIZE size) { gpointer p; From cvs at cvs.gnupg.org Mon May 5 01:38:13 2008 From: cvs at cvs.gnupg.org (svn author marcus) Date: Mon, 05 May 2008 01:38:13 +0200 Subject: [svn] pinentry - r183 - trunk/gtk+-2 Message-ID: Author: marcus Date: 2008-05-05 01:38:13 +0200 (Mon, 05 May 2008) New Revision: 183 Modified: trunk/gtk+-2/gtksecentry.c Log: Fix last change. Modified: trunk/gtk+-2/gtksecentry.c =================================================================== --- trunk/gtk+-2/gtksecentry.c 2008-05-04 23:24:28 UTC (rev 182) +++ trunk/gtk+-2/gtksecentry.c 2008-05-04 23:38:13 UTC (rev 183) @@ -270,9 +270,9 @@ #if GLIB_CHECK_VERSION (2,15,5) -GMALLOC_SIZE gsize +#define GMALLOC_SIZE gsize #else -GMALLOC_SIZE gulong +#define GMALLOC_SIZE gulong #endif gpointer From cvs at cvs.gnupg.org Tue May 6 10:13:40 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue, 06 May 2008 10:13:40 +0200 Subject: [svn] gpgme - r1311 - trunk/gpgme Message-ID: Author: wk Date: 2008-05-06 10:13:39 +0200 (Tue, 06 May 2008) New Revision: 1311 Modified: trunk/gpgme/ChangeLog trunk/gpgme/version.c Log: Allow for engine version lines with a suffix. Modified: trunk/gpgme/ChangeLog =================================================================== --- trunk/gpgme/ChangeLog 2008-04-28 18:42:56 UTC (rev 1310) +++ trunk/gpgme/ChangeLog 2008-05-06 08:13:39 UTC (rev 1311) @@ -1,3 +1,9 @@ +2008-05-06 Werner Koch + + * version.c (extract_version_string): New. + (_gpgme_get_program_version): Use it to allow for suffixes in the + version line. + 2008-04-28 Werner Koch * engine-gpgconf.c (gpgconf_read): Fixed segv. Avoid memmove for Modified: trunk/gpgme/version.c =================================================================== --- trunk/gpgme/version.c 2008-04-28 18:42:56 UTC (rev 1310) +++ trunk/gpgme/version.c 2008-05-06 08:13:39 UTC (rev 1311) @@ -1,6 +1,6 @@ /* version.c - Version check routines. Copyright (C) 2000 Werner Koch (dd9jn) - Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007 g10 Code GmbH + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2008 g10 Code GmbH This file is part of GPGME. @@ -187,6 +187,55 @@ #define LINELENGTH 80 +/* Extract the version string of a program from STRING. The version + number is expected to be in GNU style format: + + foo 1.2.3 + foo (bar system) 1.2.3 + foo 1.2.3 cruft + foo (bar system) 1.2.3 cruft. + + Spaces and tabs are skipped and used as delimiters, a term in + (nested) parenthesis before the version string is skipped, the + version string may consist of any non-space and non-tab characters + but needs to bstart with a digit. +*/ +static const char * +extract_version_string (const char *string, size_t *r_len) +{ + const char *s; + int count, len; + + for (s=string; *s; s++) + if (*s == ' ' || *s == '\t') + break; + while (*s == ' ' || *s == '\t') + s++; + if (*s == '(') + { + for (count=1, s++; count && *s; s++) + if (*s == '(') + count++; + else if (*s == ')') + count--; + } + /* For robustness we look for a digit. */ + while ( *s && !(*s >= '0' && *s <= '9') ) + s++; + if (*s >= '0' && *s <= '9') + { + for (len=0; s[len]; len++) + if (s[len] == ' ' || s[len] == '\t') + break; + } + else + len = 0; + + *r_len = len; + return s; +} + + /* Retrieve the version number from the --version output of the program FILE_NAME. */ char * @@ -243,10 +292,18 @@ if (mark) { - mark = strrchr (line, ' '); + size_t len; + const char *s; + + s = extract_version_string (line, &len); + if (!len) + return NULL; + mark = malloc (len + 1); if (!mark) return NULL; - return strdup (mark + 1); + memcpy (mark, s, len); + mark[len] = 0; + return mark; } return NULL; From cvs at cvs.gnupg.org Tue May 6 11:07:16 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue, 06 May 2008 11:07:16 +0200 Subject: [svn] GpgOL - r250 - in trunk: . doc src Message-ID: Author: wk Date: 2008-05-06 11:07:15 +0200 (Tue, 06 May 2008) New Revision: 250 Modified: trunk/ChangeLog trunk/NEWS trunk/configure.ac trunk/doc/gpgol.texi trunk/src/display.cpp Log: Remove debug stuff. Update specs. Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-05-02 18:37:47 UTC (rev 249) +++ trunk/ChangeLog 2008-05-06 09:07:15 UTC (rev 250) @@ -1,3 +1,7 @@ +2008-05-06 Werner Koch + + * Release 0.10.13. + 2008-04-16 Werner Koch * Release 0.10.12. Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2008-05-02 18:37:47 UTC (rev 249) +++ trunk/NEWS 2008-05-06 09:07:15 UTC (rev 250) @@ -1,3 +1,9 @@ +Noteworthy changes for version 0.10.13 (2008-05-06) +=================================================== + + * Properly handle the disposition of text attachments. + + Noteworthy changes for version 0.10.12 (2008-04-16) =================================================== Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2008-05-02 18:37:47 UTC (rev 249) +++ trunk/configure.ac 2008-05-06 09:07:15 UTC (rev 250) @@ -16,7 +16,7 @@ # Remember to change the version number immediately *after* a release. # Set my_issvn to "yes" for non-released code. Remember to run an # "svn up" and "autogen.sh" right before creating a distribution. -m4_define([my_version], [0.10.12]) +m4_define([my_version], [0.10.13]) m4_define([my_issvn], [no]) m4_define([svn_revision], m4_esyscmd([echo -n $( (svn info 2>/dev/null \ Modified: trunk/doc/gpgol.texi =================================================================== --- trunk/doc/gpgol.texi 2008-05-02 18:37:47 UTC (rev 249) +++ trunk/doc/gpgol.texi 2008-05-06 09:07:15 UTC (rev 250) @@ -312,19 +312,9 @@ @noindent To allow the server the selection of a non-default signing key the -client may optionally use the command: +client may optionally use the @code{SENDER} command, see @ref{command +SENDER}. - at deffn Command SENDER @var{email} - at var{email} is the plain ASCII encoded address ("addr-spec" as per -RFC-2822) enclosed in angle brackets. The address set with this command -is valid until a successful @code{SIGN} command or until a @code{RESET} -command. A second command overrides the effect of the first one; if - at var{email} is not given the server shall use the default signing key. -The server shall also suggest a protocol to use for signing. The client -may use this suggested protocol on its own discretion. The same status -line as with PREP_ENCRYPT is used for this. - at end deffn - @noindent The signing operation is then initiated by: @@ -526,6 +516,44 @@ wait until the key manager has been fully brought up). @end deffn + at anchor{command SENDER} + at noindent +When doing an operation on a mail, it is useful to let the server know +the address of the sender: + + at deffn Command SENDER [- at w{}-info] @var{email} + at var{email} is the plain ASCII encoded address ("addr-spec" as per +RFC-2822) enclosed in angle brackets. The address set with this command +is valid until a successful completion of the operation or until a + at code{RESET} command. A second command overrides the effect of the +first one; if @var{email} is not given and @option{--info} is not used, +the server shall use the default signing key. + +If option @option{--info} is not given, the server shall also suggest a +protocol to use for signing. The client may use this suggested protocol +on its own discretion. The same status line as with PREP_ENCRYPT is +used for this. + at end deffn + + at noindent +To allow the UI-server to visually identify a running operation or to +associate operations the server MAY support the command: + + at deffn Command SESSION @var{number} [@var{string}] +The @var{number} is an arbitrary value, a server may use to associate +simultaneous running sessions. It is a 32 bit unsigned integer with + at code{0} as a special value indicating that no session association shall +be done. + +If @var{string} is given, the server may use this as the title of a +window or, in the case of an email operation, to extract the sender's +address. The string may contain spaces; thus no plus-escaping is used. + +This command may be used at any time and overrides the effect of the +last command. A @code{RESET} undoes the effect of this command. + + at end deffn + @c xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx @c @c M A P I P r o p e r t i e s @@ -749,7 +777,7 @@ apply its own S/MIME handler to the message but leaves it unchanged in the message store. -* For ease of implementarion the same thing applies to PGP messgaes, +* For ease of implementation the same thing applies to PGP messgaes, although OL would not touch these messages. * When reading a message GpgOL quickly checks the message class and if @@ -757,7 +785,7 @@ decrypt/verify the message. * Messages already in the message store before GpgOL was installed are - handled diffwerently: Here an Outlook specific event is used to change + handled differently: Here an Outlook specific event is used to change the message class when browsing the messages folder. This code path is not fully ready as it requires the installation of an ECF(ile) which has to be done manually as of now. @@ -771,7 +799,6 @@ - @c Local Variables: @c coding: latin-1 @c End: Modified: trunk/src/display.cpp =================================================================== --- trunk/src/display.cpp 2008-05-02 18:37:47 UTC (rev 249) +++ trunk/src/display.cpp 2008-05-06 09:07:15 UTC (rev 250) @@ -205,8 +205,8 @@ memset (&findstate, 0, sizeof findstate); rc = !!find_message_window (hwnd, &findstate); - if (!rc) - log_window_hierarchy (hwnd, "The windows blow hwnd %p", hwnd); +// if (!rc) +// log_window_hierarchy (hwnd, "The windows below hwnd %p", hwnd); return rc; } From cvs at cvs.gnupg.org Tue May 6 11:11:42 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue, 06 May 2008 11:11:42 +0200 Subject: [svn] GpgOL - r251 - tags Message-ID: Author: wk Date: 2008-05-06 11:11:41 +0200 (Tue, 06 May 2008) New Revision: 251 Added: tags/gpgol-0.10.13/ Log: From cvs at cvs.gnupg.org Tue May 6 13:05:56 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue, 06 May 2008 13:05:56 +0200 Subject: [svn] GnuPG - r4756 - in trunk: . doc Message-ID: Author: wk Date: 2008-05-06 13:05:52 +0200 (Tue, 06 May 2008) New Revision: 4756 Modified: trunk/AUTHORS trunk/THANKS trunk/doc/ChangeLog trunk/doc/Makefile.am trunk/doc/tools.texi Log: add gpg-zip man page. Modified: trunk/doc/ChangeLog =================================================================== --- trunk/doc/ChangeLog 2008-05-02 22:54:30 UTC (rev 4755) +++ trunk/doc/ChangeLog 2008-05-06 11:05:52 UTC (rev 4756) @@ -1,3 +1,9 @@ +2008-05-06 Werner Koch + + * Makefile.am (myman_pages): Add gpg-zip.1. + + * tools.texi (gpg-zip): Add new section. + 2008-04-08 Werner Koch * gpg.texi (GPG Configuration Options): Change subkeys.pgp.net to Modified: trunk/AUTHORS =================================================================== --- trunk/AUTHORS 2008-05-02 22:54:30 UTC (rev 4755) +++ trunk/AUTHORS 2008-05-06 11:05:52 UTC (rev 4756) @@ -133,7 +133,10 @@ The function build_argv in agent/w32main.c is based on code from Alexandre Julliard. +The gpg-zip documentation is based on the manpage for gpg-zip, written +by Colin Tuckley and Daniel Leidert for the GNU/Debian distribution. + Copyright ========= @@ -160,7 +163,7 @@ ========= Copyright 1998, 1999, 2000, 2001, 2002, 2004, 2005, - 2006, 2007 Free Software Foundation, Inc. + 2006, 2007, 2008 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 Modified: trunk/THANKS =================================================================== --- trunk/THANKS 2008-05-02 22:54:30 UTC (rev 4755) +++ trunk/THANKS 2008-05-06 11:05:52 UTC (rev 4756) @@ -44,10 +44,12 @@ Christian von Roques roques at pond.sub.org Christopher Oliver oliver at fritz.traverse.net Christian Recktenwald chris at citecs.de +Colin Tuckley colin at tuckley.org Daiki Ueno ueno at unixuser.org Dan Winship danw at helixcode.com Daniel Eisenbud eisenbud at cs.swarthmore.edu Daniel Koening dan at chaosdorf.de +Daniel Leidert daniel leidert at wgdd.de Daniel Resare daniel at resare.com Dany Nativel dany at natzo.com Dave Dykstra dwd at bell-labs.com Modified: trunk/doc/Makefile.am =================================================================== --- trunk/doc/Makefile.am 2008-05-02 22:54:30 UTC (rev 4755) +++ trunk/doc/Makefile.am 2008-05-06 11:05:52 UTC (rev 4756) @@ -67,7 +67,7 @@ myman_pages = gpg2.1 gpgsm.1 gpg-agent.1 scdaemon.1 gpgv2.1 \ watchgnupg.1 gpgconf.1 addgnupghome.8 gpg-preset-passphrase.1 \ gpg-connect-agent.1 gpgparsemail.1 symcryptrun.1 \ - gpgsm-gencert.sh.1 applygnupgdefaults.8 + gpgsm-gencert.sh.1 applygnupgdefaults.8 gpg-zip.1 man_MANS = $(myman_pages) noinst_MANS = gnupg.7 Modified: trunk/doc/tools.texi =================================================================== --- trunk/doc/tools.texi 2008-05-02 22:54:30 UTC (rev 4755) +++ trunk/doc/tools.texi 2008-05-06 11:05:52 UTC (rev 4756) @@ -18,6 +18,7 @@ * gpg-connect-agent:: Communicate with a running agent. * gpgparsemail:: Parse a mail message into an annotated format * symcryptrun:: Call a simple symmetric encryption tool. +* gpg-zip:: Encrypt or sign files into an archive. @end menu @c @@ -74,11 +75,11 @@ @item --version @opindex version -print version of the program and exit +Print version of the program and exit. @item --help @opindex help -Display a brief help page and exit +Display a brief help page and exit. @end table @@ -1485,3 +1486,145 @@ @end ifset @include see-also-note.texi + + at c + at c GPG-ZIP + at c + at c The original manpage on which this section is based was written + at c by Colin Tuckley and Daniel Leidert + at c for the Debian distribution (but may be used by + at c others). + at manpage gpg-zip.1 + at node gpg-zip + at section Encrypt or sign files into an archive + at ifset manverb +.B gpg-zip \- Encrypt or sign files into an archive + at end ifset + + at mansect synopsis + at ifset manverb +.B gpg-zip +.RI [ options ] +.I filename1 +.I [ filename2, ... ] +.I directory1 +.I [ directory2, ... ] + at end ifset + + at mansect description + at command{gpg-zip} encrypts or signs files into an archive. It is an +gpg-ized tar using the same format as used by PGP's PGP Zip. + + at manpause + at noindent + at command{gpg-zip} is invoked this way: + + at example +gpg-zip [options] @var{filename1} [@var{filename2}, ...] @var{directory} [@var{directory2}, ...] + at end example + + at mansect options + at noindent + at command{gpg-zip} understands these options: + + at table @gnupgtabopt + + at item --encrypt + at itemx -e + at opindex encrypt +Encrypt data. This option may be combined with @option{--symmetric} (for output that may be decrypted via a secret key or a passphrase). + + at item --decrypt + at itemx -d + at opindex decrypt +Decrypt data. + + at item --symmetric + at itemx -c +Encrypt with a symmetric cipher using a passphrase. The default +symmetric cipher used is CAST5, but may be chosen with the + at option{--cipher-algo} option to @command{gpg}. + + at item --sign + at itemx -s +Make a signature. See @command{gpg}. + + at item --recipient @var{user} + at itemx -r @var{user} + at opindex recipient +Encrypt for user id @var{user}. See @command{gpg}. + + at item --local-user @var{user} + at itemx -u @var{user} + at opindex local-user +Use @var{user} as the key to sign with. See @command{gpg}. + + at item --list-archive + at opindex list-archive +List the contents of the specified archive. + + at item --output @var{file} + at itemx -o @var{file} + at opindex output +Write output to specified file @var{file}. + + at item --gpg @var{gpgcmd} + at opindex gpg +Use the specified command @var{gpgcmd} instead of @command{gpg}. + + at item --gpg-args @var{args} + at opindex gpg-args +Pass the specified options to @command{gpg}. + + at item --tar @var{tarcmd} + at opindex tar +Use the specified command @var{tarcmd} instead of @command{tar}. + + at item --tar-args @var{args} + at opindex tar-args +Pass the specified options to @command{tar}. + + at item --version + at opindex version +Print version of the program and exit. + + at item --help + at opindex help +Display a brief help page and exit. + + at end table + + at mansect diagnostics + at noindent +The program returns 0 if everything was fine, 1 otherwise. + + + at mansect examples + at ifclear isman + at noindent +Some examples: + + at end ifclear + at noindent +Encrypt the contents of directory @file{mydocs} for user Bob to file + at file{test1}: + + at example +gpg-zip --encrypt --output test1 --gpg-args -r Bob mydocs + at end example + + at noindent +List the contents of archive @file{test1}: + + at example +gpg-zip --list-archive test1 + at end example + + + at mansect see also + at ifset isman + at command{gpg}(1), + at command{tar}(1), + at end ifset + at include see-also-note.texi + From cvs at cvs.gnupg.org Tue May 6 16:03:56 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue, 06 May 2008 16:03:56 +0200 Subject: [svn] GnuPG - r4757 - in trunk: . kbx keyserver po sm Message-ID: Author: wk Date: 2008-05-06 16:03:36 +0200 (Tue, 06 May 2008) New Revision: 4757 Modified: trunk/TODO trunk/autogen.sh trunk/configure.ac trunk/kbx/ChangeLog trunk/kbx/keybox-blob.c trunk/kbx/keybox-file.c trunk/kbx/keybox-search.c trunk/kbx/keybox-update.c trunk/keyserver/gpgkeys_kdns.c trunk/po/ChangeLog trunk/po/be.po trunk/po/ca.po trunk/po/cs.po trunk/po/da.po trunk/po/de.po trunk/po/el.po trunk/po/eo.po trunk/po/es.po trunk/po/et.po trunk/po/fi.po trunk/po/fr.po trunk/po/gl.po trunk/po/hu.po trunk/po/id.po trunk/po/it.po trunk/po/ja.po trunk/po/nb.po trunk/po/pl.po trunk/po/pt.po trunk/po/pt_BR.po trunk/po/ro.po trunk/po/ru.po trunk/po/sk.po trunk/po/sv.po trunk/po/tr.po trunk/po/zh_CN.po trunk/po/zh_TW.po trunk/sm/ChangeLog trunk/sm/keylist.c Log: Fixed bug#907. Fixed a segv in keybox and made it more robust. [The diff below has been truncated] Modified: trunk/kbx/ChangeLog =================================================================== --- trunk/kbx/ChangeLog 2008-05-06 11:05:52 UTC (rev 4756) +++ trunk/kbx/ChangeLog 2008-05-06 14:03:36 UTC (rev 4757) @@ -1,3 +1,12 @@ +2008-05-06 Werner Koch + + * keybox-file.c (_keybox_read_blob2): Return GPG_ERR_TOO_SHORT if + we get an EOF for 2nd to 5th byte as a better error message. + + Always use gpg_error_from_syserror and gpg_err_code_from_syserror. + This is to avoid cases where we expect an error but due to an + errno set to 0 we get back a success status. + 2008-04-01 Werner Koch * keybox-init.c (keybox_new, keybox_release): Track used handles. Modified: trunk/po/ChangeLog =================================================================== --- trunk/po/ChangeLog 2008-05-06 11:05:52 UTC (rev 4756) +++ trunk/po/ChangeLog 2008-05-06 14:03:36 UTC (rev 4757) @@ -1,3 +1,7 @@ +2008-05-01 Werner Koch + + * de.po: Typo fix. + 2008-03-26 Jedi Lin (wk) * zh_TW.po: Update. Modified: trunk/sm/ChangeLog =================================================================== --- trunk/sm/ChangeLog 2008-05-06 11:05:52 UTC (rev 4756) +++ trunk/sm/ChangeLog 2008-05-06 14:03:36 UTC (rev 4757) @@ -1,3 +1,8 @@ +2008-05-06 Werner Koch + + * keylist.c (list_external_keys): Ignore NOT FOUND error code. + This is bug#907. + 2008-04-23 Werner Koch * certchain.c (find_up): Make correct C89 code. Declare variable Modified: trunk/TODO =================================================================== --- trunk/TODO 2008-05-06 11:05:52 UTC (rev 4756) +++ trunk/TODO 2008-05-06 14:03:36 UTC (rev 4757) @@ -131,4 +131,6 @@ our design goal to allow changing the locale without changing gpg-agent's default locale (e.g. by the command updatestartuptty). +* RFC 4387: Operational Protocols: Certificate Store Access via HTTP + Do we support this? Modified: trunk/autogen.sh =================================================================== --- trunk/autogen.sh 2008-05-06 11:05:52 UTC (rev 4756) +++ trunk/autogen.sh 2008-05-06 14:03:36 UTC (rev 4757) @@ -93,6 +93,7 @@ --with-zlib=${w32root} \ --with-regex=${w32root} \ --with-pth-prefix=${w32root} \ + --with-adns=${w32root} --without-included-gettext "$@" rc=$? exit $rc Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2008-05-06 11:05:52 UTC (rev 4756) +++ trunk/configure.ac 2008-05-06 14:03:36 UTC (rev 4757) @@ -847,6 +847,8 @@ ADNSLIBS="-ladns" fi AC_SUBST(ADNSLIBS) +# Newer adns versions feature a free function to be used under W32. +AC_CHECK_FUNCS(adns_free) # Modified: trunk/kbx/keybox-blob.c =================================================================== --- trunk/kbx/keybox-blob.c 2008-05-06 11:05:52 UTC (rev 4756) +++ trunk/kbx/keybox-blob.c 2008-05-06 14:03:36 UTC (rev 4757) @@ -685,7 +685,7 @@ pp = xtrymalloc (n); if ( !pp ) - return gpg_error (gpg_err_code_from_errno (errno)); + return gpg_error_from_syserror (); memcpy (pp , p, n); blob->blob = pp; blob->bloblen = n; @@ -706,7 +706,7 @@ *r_blob = NULL; blob = xtrycalloc (1, sizeof *blob); if (!blob) - return gpg_error (gpg_err_code_from_errno (errno)); + return gpg_error_from_syserror (); /* fixme: Do some sanity checks on the keyblock */ @@ -838,7 +838,7 @@ *r_blob = NULL; blob = xtrycalloc (1, sizeof *blob); if( !blob ) - return gpg_error (gpg_err_code_from_errno (errno)); + return gpg_error_from_syserror (); sn = ksba_cert_get_serial (cert); if (sn) @@ -873,7 +873,7 @@ names = xtrymalloc (max_names * sizeof *names); if (!names) { - rc = gpg_error (gpg_err_code_from_errno (errno)); + rc = gpg_error_from_syserror (); goto leave; } @@ -894,7 +894,7 @@ tmp = xtryrealloc (names, max_names * sizeof *names); if (!tmp) { - rc = gpg_error (gpg_err_code_from_errno (errno)); + rc = gpg_error_from_syserror (); goto leave; } } @@ -985,7 +985,7 @@ *r_blob = NULL; blob = xtrycalloc (1, sizeof *blob); if (!blob) - return gpg_error (gpg_err_code_from_errno (errno)); + return gpg_error_from_syserror (); blob->blob = image; blob->bloblen = imagelen; Modified: trunk/kbx/keybox-file.c =================================================================== --- trunk/kbx/keybox-file.c 2008-05-06 11:05:52 UTC (rev 4756) +++ trunk/kbx/keybox-file.c 2008-05-06 14:03:36 UTC (rev 4757) @@ -58,7 +58,7 @@ *r_blob = NULL; off = ftello (fp); if (off == (off_t)-1) - return gpg_error (gpg_err_code_from_errno (errno)); + return gpg_error_from_syserror (); if ((c1 = getc (fp)) == EOF || (c2 = getc (fp)) == EOF @@ -68,7 +68,9 @@ { if ( c1 == EOF && !ferror (fp) ) return -1; /* eof */ - return gpg_error (gpg_err_code_from_errno (errno)); + if (!ferror (fp)) + return gpg_error (GPG_ERR_TOO_SHORT); + return gpg_error_from_syserror (); } imagelen = (c1 << 24) | (c2 << 16) | (c3 << 8 ) | c4; @@ -82,26 +84,26 @@ { /* Special treatment for empty blobs. */ if (fseek (fp, imagelen-5, SEEK_CUR)) - return gpg_error (gpg_err_code_from_errno (errno)); + return gpg_error_from_syserror (); *skipped_deleted = 1; goto again; } image = xtrymalloc (imagelen); if (!image) - return gpg_error (gpg_err_code_from_errno (errno)); + return gpg_error_from_syserror (); image[0] = c1; image[1] = c2; image[2] = c3; image[3] = c4; image[4] = type; if (fread (image+5, imagelen-5, 1, fp) != 1) { - gpg_error_t tmperr = gpg_error (gpg_err_code_from_errno (errno)); + gpg_error_t tmperr = gpg_error_from_syserror (); xfree (image); return tmperr; } rc = r_blob? _keybox_new_blob (r_blob, image, imagelen, off) : 0; if (rc || !r_blob) - xfree (image); + xfree (image); return rc; } @@ -122,7 +124,7 @@ image = _keybox_get_blob_image (blob, &length); if (fwrite (image, length, 1, fp) != 1) - return gpg_error (gpg_err_code_from_errno (errno)); + return gpg_error_from_syserror (); return 0; } @@ -154,7 +156,7 @@ image[20+3] = (val ); if (fwrite (image, 32, 1, fp) != 1) - return gpg_error (gpg_err_code_from_errno (errno)); + return gpg_error_from_syserror (); return 0; } Modified: trunk/kbx/keybox-search.c =================================================================== --- trunk/kbx/keybox-search.c 2008-05-06 11:05:52 UTC (rev 4756) +++ trunk/kbx/keybox-search.c 2008-05-06 14:03:36 UTC (rev 4757) @@ -735,7 +735,7 @@ { sn_array = xtrycalloc (ndesc, sizeof *sn_array); if (!sn_array) - return (hd->error = gpg_error (gpg_err_code_from_errno (errno))); + return (hd->error = gpg_error_from_syserror ()); } } @@ -744,7 +744,7 @@ hd->fp = fopen (hd->kb->fname, "rb"); if (!hd->fp) { - hd->error = gpg_error (gpg_err_code_from_errno (errno)); + hd->error = gpg_error_from_syserror (); xfree (sn_array); return hd->error; } @@ -776,7 +776,7 @@ sn_array[n].sn = xtrymalloc (snlen); if (!sn_array[n].sn) { - hd->error = gpg_error (gpg_err_code_from_errno (errno)); + hd->error = gpg_error_from_syserror (); release_sn_array (sn_array, n); return hd->error; } @@ -800,7 +800,7 @@ sn_array[n].sn = xtrymalloc (snlen); if (!sn_array[n].sn) { - hd->error = gpg_error (gpg_err_code_from_errno (errno)); + hd->error = gpg_error_from_syserror (); release_sn_array (sn_array, n); return hd->error; } Modified: trunk/kbx/keybox-update.c =================================================================== --- trunk/kbx/keybox-update.c 2008-05-06 11:05:52 UTC (rev 4756) +++ trunk/kbx/keybox-update.c 2008-05-06 14:03:36 UTC (rev 4757) @@ -82,14 +82,14 @@ { bakfname = xtrymalloc (strlen (template) + 1); if (!bakfname) - return gpg_error (gpg_err_code_from_errno (errno)); + return gpg_error_from_syserror (); strcpy (bakfname, template); strcpy (bakfname+strlen(template)-4, EXTSEP_S "bak"); tmpfname = xtrymalloc (strlen (template) + 1); if (!tmpfname) { - gpg_error_t tmperr = gpg_error (gpg_err_code_from_errno (errno)); + gpg_error_t tmperr = gpg_error_from_syserror (); xfree (bakfname); return tmperr; } @@ -100,13 +100,13 @@ { /* File does not end with kbx; hmmm. */ bakfname = xtrymalloc ( strlen (template) + 5); if (!bakfname) - return gpg_error (gpg_err_code_from_errno (errno)); + return gpg_error_from_syserror (); strcpy (stpcpy (bakfname, template), EXTSEP_S "bak"); tmpfname = xtrymalloc ( strlen (template) + 5); if (!tmpfname) { - gpg_error_t tmperr = gpg_error (gpg_err_code_from_errno (errno)); + gpg_error_t tmperr = gpg_error_from_syserror (); xfree (bakfname); return tmperr; } @@ -115,13 +115,13 @@ # else /* Posix file names */ bakfname = xtrymalloc (strlen (template) + 2); if (!bakfname) - return gpg_error (gpg_err_code_from_errno (errno)); + return gpg_error_from_syserror (); strcpy (stpcpy (bakfname,template),"~"); tmpfname = xtrymalloc ( strlen (template) + 5); if (!tmpfname) { - gpg_error_t tmperr = gpg_error (gpg_err_code_from_errno (errno)); + gpg_error_t tmperr = gpg_error_from_syserror (); xfree (bakfname); return tmperr; } @@ -131,7 +131,7 @@ *r_fp = fopen (tmpfname, "wb"); if (!*r_fp) { - gpg_error_t tmperr = gpg_error (gpg_err_code_from_errno (errno)); + gpg_error_t tmperr = gpg_error_from_syserror (); xfree (tmpfname); xfree (bakfname); return tmperr; @@ -175,7 +175,7 @@ #endif if (rename (fname, bakfname) ) { - return gpg_error (gpg_err_code_from_errno (errno)); + return gpg_error_from_syserror (); } } @@ -185,7 +185,7 @@ #endif if (rename (tmpfname, fname) ) { - rc = gpg_error (gpg_err_code_from_errno (errno)); + rc = gpg_error_from_syserror (); if (secret) { /* log_info ("WARNING: 2 files with confidential" */ @@ -221,7 +221,7 @@ /* Open the source file. Because we do a rename, we have to check the permissions of the file */ if (access (fname, W_OK)) - return gpg_error (gpg_err_code_from_errno (errno)); + return gpg_error_from_syserror (); fp = fopen (fname, "rb"); if (mode == 1 && !fp && errno == ENOENT) @@ -230,7 +230,7 @@ Create a new keybox file. */ newfp = fopen (fname, "wb"); if (!newfp ) - return gpg_error (gpg_err_code_from_errno (errno)); + return gpg_error_from_syserror (); rc = _keybox_write_header_blob (newfp); if (rc) @@ -241,7 +241,7 @@ return rc; if ( fclose (newfp) ) - return gpg_error (gpg_err_code_from_errno (errno)); + return gpg_error_from_syserror (); /* if (chmod( fname, S_IRUSR | S_IWUSR )) */ /* { */ @@ -253,7 +253,7 @@ if (!fp) { - rc = gpg_error (gpg_err_code_from_errno (errno)); + rc = gpg_error_from_syserror (); goto leave; } @@ -273,13 +273,13 @@ { if (fwrite (buffer, nread, 1, newfp) != 1) { - rc = gpg_error (gpg_err_code_from_errno (errno)); + rc = gpg_error_from_syserror (); goto leave; } } if (ferror (fp)) { - rc = gpg_error (gpg_err_code_from_errno (errno)); + rc = gpg_error_from_syserror (); goto leave; } } @@ -302,13 +302,13 @@ if (fwrite (buffer, nread, 1, newfp) != 1) { - rc = gpg_error (gpg_err_code_from_errno (errno)); + rc = gpg_error_from_syserror (); goto leave; } } if (ferror (fp)) { - rc = gpg_error (gpg_err_code_from_errno (errno)); + rc = gpg_error_from_syserror (); goto leave; } @@ -333,13 +333,13 @@ { if (fwrite (buffer, nread, 1, newfp) != 1) { - rc = gpg_error (gpg_err_code_from_errno (errno)); + rc = gpg_error_from_syserror (); goto leave; } } if (ferror (fp)) { - rc = gpg_error (gpg_err_code_from_errno (errno)); + rc = gpg_error_from_syserror (); goto leave; } } @@ -347,13 +347,13 @@ /* Close both files. */ if (fclose(fp)) { - rc = gpg_error (gpg_err_code_from_errno (errno)); + rc = gpg_error_from_syserror (); fclose (newfp); goto leave; } if (fclose(newfp)) { - rc = gpg_error (gpg_err_code_from_errno (errno)); + rc = gpg_error_from_syserror (); goto leave; } @@ -452,11 +452,11 @@ _keybox_close_file (hd); fp = fopen (hd->kb->fname, "r+b"); if (!fp) - return gpg_error (gpg_err_code_from_errno (errno)); + return gpg_error_from_syserror (); ec = 0; if (fseeko (fp, off, SEEK_SET)) - ec = gpg_error (gpg_err_code_from_errno (errno)); + ec = gpg_error_from_syserror (); else { unsigned char tmp[4]; @@ -472,7 +472,7 @@ case 2: case 4: if (fwrite (tmp+4-flag_size, flag_size, 1, fp) != 1) - ec = gpg_err_code_from_errno (errno); + ec = gpg_err_code_from_syserror (); break; default: ec = GPG_ERR_BUG; @@ -483,7 +483,7 @@ if (fclose (fp)) { if (!ec) - ec = gpg_err_code_from_errno (errno); + ec = gpg_err_code_from_syserror (); } return gpg_error (ec); @@ -517,19 +517,19 @@ _keybox_close_file (hd); fp = fopen (hd->kb->fname, "r+b"); if (!fp) - return gpg_error (gpg_err_code_from_errno (errno)); + return gpg_error_from_syserror (); if (fseeko (fp, off, SEEK_SET)) - rc = gpg_error (gpg_err_code_from_errno (errno)); + rc = gpg_error_from_syserror (); else if (putc (0, fp) == EOF) - rc = gpg_error (gpg_err_code_from_errno (errno)); + rc = gpg_error_from_syserror (); else rc = 0; if (fclose (fp)) { if (!rc) - rc = gpg_error (gpg_err_code_from_errno (errno)); + rc = gpg_error_from_syserror (); } return rc; @@ -567,14 +567,14 @@ /* Open the source file. Because we do a rename, we have to check the permissions of the file */ if (access (fname, W_OK)) - return gpg_error (gpg_err_code_from_errno (errno)); + return gpg_error_from_syserror (); fp = fopen (fname, "rb"); if (!fp && errno == ENOENT) return 0; /* Ready. File has been deleted right after the access above. */ if (!fp) { - rc = gpg_error (gpg_err_code_from_errno (errno)); + rc = gpg_error_from_syserror (); return rc; } @@ -695,9 +695,9 @@ /* Close both files. */ if (fclose(fp) && !rc) - rc = gpg_error (gpg_err_code_from_errno (errno)); + rc = gpg_error_from_syserror (); if (fclose(newfp) && !rc) - rc = gpg_error (gpg_err_code_from_errno (errno)); + rc = gpg_error_from_syserror (); /* Rename or remove the temporary file. */ if (rc || !any_changes) Modified: trunk/keyserver/gpgkeys_kdns.c =================================================================== --- trunk/keyserver/gpgkeys_kdns.c 2008-05-06 11:05:52 UTC (rev 4756) +++ trunk/keyserver/gpgkeys_kdns.c 2008-05-06 14:03:36 UTC (rev 4757) @@ -29,6 +29,9 @@ #include #ifdef HAVE_ADNS_H # include +# ifndef HAVE_ADNS_FREE +# define adns_free free +# endif #endif #define INCLUDED_BY_MAIN_MODULE 1 @@ -175,7 +178,7 @@ fprintf (output, "\nNAME %s FAILED %d\n", address, ret); else fprintf (output, "\nNAME %s END\n", address); - free (answer); /* (Right, this is free and not xfree.) */ + adns_free (answer); xfree (name); From cvs at cvs.gnupg.org Wed May 7 17:40:39 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 07 May 2008 17:40:39 +0200 Subject: [svn] GnuPG - r4758 - in trunk: . doc g10 Message-ID: Author: wk Date: 2008-05-07 17:40:36 +0200 (Wed, 07 May 2008) New Revision: 4758 Modified: trunk/NEWS trunk/doc/gpg.texi trunk/g10/ChangeLog trunk/g10/getkey.c trunk/g10/gpg.c trunk/g10/keylist.c trunk/g10/main.h Log: Add command --locate-key. Fix auto-key-locate processing of "nodefault". Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2008-05-06 14:03:36 UTC (rev 4757) +++ trunk/g10/ChangeLog 2008-05-07 15:40:36 UTC (rev 4758) @@ -1,3 +1,12 @@ +2008-05-07 Werner Koch + + * getkey.c (get_pubkey_byname): Fix nodefault case. + + * gpg.c: New command --locate-keys. New options --with-sig-list + and --with-sig-check. + * keylist.c (locate_one): New. + (public_key_list): Add arg LOCATE_MODE and use locate_one. + 2008-04-18 Werner Koch * misc.c (map_cipher_openpgp_to_gcry, map_cipher_gcry_to_openpgp) Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2008-05-06 14:03:36 UTC (rev 4757) +++ trunk/NEWS 2008-05-07 15:40:36 UTC (rev 4758) @@ -9,7 +9,11 @@ * [W32] Initialize the socket subsystem for all keyserver helpers. + * New gpg2 command --locate-keys. + * New gpg2 options --with-sig-list and --with-sig-check. + + Noteworthy changes in version 2.0.9 (2008-03-26) ------------------------------------------------ Modified: trunk/doc/gpg.texi =================================================================== --- trunk/doc/gpg.texi 2008-05-06 14:03:36 UTC (rev 4757) +++ trunk/doc/gpg.texi 2008-05-07 15:40:36 UTC (rev 4758) @@ -291,6 +291,10 @@ @item --list-sigs @opindex list-sigs Same as @option{--list-keys}, but the signatures are listed too. + at ifclear gpgone +This command has the same effect as +using @option{--list-keys} with @option{--with-sig-list}. + at end ifclear For each signature listed, there are several flags in between the "sig" tag and keyid. These flags give additional information about each @@ -308,6 +312,10 @@ @item --check-sigs @opindex check-sigs Same as @option{--list-sigs}, but the signatures are verified. + at ifclear gpgone +This command has the same effect as +using @option{--list-keys} with @option{--with-sig-check}. + at end ifclear The status of the verification is indicated by a flag directly following the "sig" tag (and thus before the flags described above for @@ -316,7 +324,17 @@ if an error occured while checking the signature (e.g. a non supported algorithm). + at ifclear gpgone + at item --locate-keys + at opindex locate-keys +Locate the keys given as arguments. This command basically uses the +same algorithm as used when locating keys for encryption or signing and +may thus be used to see what keys @command{@gpgname} might use. In +particular external methods as defined by @option{--auto-key-locate} may +be used to locate a key. Only public keys are listed. + at end ifclear + @item --fingerprint @opindex fingerprint List all keys (or the specified ones) along with their Modified: trunk/g10/getkey.c =================================================================== --- trunk/g10/getkey.c 2008-05-06 14:03:36 UTC (rev 4757) +++ trunk/g10/getkey.c 2008-05-07 15:40:36 UTC (rev 4758) @@ -925,8 +925,11 @@ int rc; strlist_t namelist = NULL; struct akl *akl; + int is_mbox; int nodefault = 0; + is_mbox = is_valid_mailbox (name); + /* Check whether we the default local search has been disabled. This is the case if either the "nodefault" or the "local" keyword are in the list of auto key locate mechanisms. */ @@ -940,8 +943,11 @@ } } - if (nodefault) - rc = G10ERR_NO_PUBKEY; + if (nodefault && is_mbox) + { + /* Nodefault but a mailbox - let the AKL locate the key. */ + rc = G10ERR_NO_PUBKEY; + } else { add_to_strlist (&namelist, name); @@ -951,8 +957,7 @@ /* If the requested name resembles a valid mailbox and automatic retrieval has been enabled, we try to import the key. */ - - if (rc == G10ERR_NO_PUBKEY && !no_akl && is_valid_mailbox(name)) + if (gpg_err_code (rc) == G10ERR_NO_PUBKEY && !no_akl && is_mbox) { for (akl=opt.auto_key_locate; akl; akl=akl->next) { Modified: trunk/g10/gpg.c =================================================================== --- trunk/g10/gpg.c 2008-05-06 14:03:36 UTC (rev 4757) +++ trunk/g10/gpg.c 2008-05-07 15:40:36 UTC (rev 4758) @@ -119,6 +119,7 @@ aListSigs, aSendKeys, aRecvKeys, + aLocateKeys, aSearchKeys, aRefreshKeys, aFetchKeys, @@ -229,6 +230,8 @@ oHomedir, oWithColons, oWithKeyData, + oWithSigList, + oWithSigCheck, oSkipVerify, oCompressKeys, oCompressSigs, @@ -399,6 +402,7 @@ N_("search for keys on a key server") }, { aRefreshKeys, "refresh-keys", 256, N_("update all keys from a keyserver")}, + { aLocateKeys, "locate-keys", 256, "@"}, { aFetchKeys, "fetch-keys" , 256, "@" }, { aExportSecret, "export-secret-keys" , 256, "@" }, { aExportSecretSub, "export-secret-subkeys" , 256, "@" }, @@ -588,6 +592,8 @@ { oNoBatch, "no-batch", 0, "@" }, { oWithColons, "with-colons", 0, "@"}, { oWithKeyData,"with-key-data", 0, "@"}, + { oWithSigList,"with-sig-list", 0, "@"}, + { oWithSigCheck,"with-sig-check", 0, "@"}, { aListKeys, "list-key", 0, "@" }, /* alias */ { aListSigs, "list-sig", 0, "@" }, /* alias */ { aCheckKeys, "check-sig",0, "@" }, /* alias */ @@ -2099,6 +2105,7 @@ case aChangePIN: #endif /* ENABLE_CARD_SUPPORT*/ case aListKeys: + case aLocateKeys: case aListSigs: case aExportSecret: case aExportSecretSub: @@ -2264,9 +2271,13 @@ case oNoOptions: opt.no_homedir_creation = 1; break; /* no-options */ case oHomedir: break; case oNoBatch: opt.batch = 0; break; - case oWithKeyData: opt.with_key_data=1; /* fall thru */ + + case oWithKeyData: opt.with_key_data=1; /*FALLTHRU*/ case oWithColons: opt.with_colons=':'; break; + case oWithSigCheck: opt.check_sigs = 1; /*FALLTHRU*/ + case oWithSigList: opt.list_sigs = 1; break; + case oSkipVerify: opt.skip_verify=1; break; case oCompressKeys: opt.compress_keys = 1; break; case aListSecretKeys: set_cmd( &cmd, aListSecretKeys); break; @@ -3300,7 +3311,7 @@ { if (ALWAYS_ADD_KEYRINGS || (cmd != aCheckKeys && cmd != aListSigs && cmd != aListKeys - && cmd != aVerify && cmd != aSym)) + && cmd != aVerify && cmd != aSym && cmd != aLocateKeys)) { if (!sec_nrings || default_keyring) /* add default secret rings */ keydb_add_resource ("secring" EXTSEP_S "gpg", 4, 1); @@ -3583,7 +3594,7 @@ sl = NULL; for( ; argc; argc--, argv++ ) add_to_strlist2( &sl, *argv, utf8_strings ); - public_key_list( sl ); + public_key_list( sl, 0 ); free_strlist(sl); break; case aListSecretKeys: @@ -3593,6 +3604,13 @@ secret_key_list( sl ); free_strlist(sl); break; + case aLocateKeys: + sl = NULL; + for (; argc; argc--, argv++) + add_to_strlist2( &sl, *argv, utf8_strings ); + public_key_list (sl, 1); + free_strlist (sl); + break; case aKeygen: /* generate a key */ if( opt.batch ) { Modified: trunk/g10/keylist.c =================================================================== --- trunk/g10/keylist.c 2008-05-06 14:03:36 UTC (rev 4757) +++ trunk/g10/keylist.c 2008-05-07 15:40:36 UTC (rev 4758) @@ -40,6 +40,7 @@ static void list_all(int); static void list_one( strlist_t names, int secret); +static void locate_one (strlist_t names); static void print_card_serialno (PKT_secret_key *sk); struct sig_stats @@ -56,9 +57,9 @@ * If list is NULL, all available keys are listed */ void -public_key_list( strlist_t list ) +public_key_list( strlist_t list, int locate_mode ) { - if(opt.with_colons) + if (opt.with_colons) { byte trust_model,marginals,completes,cert_depth; ulong created,nextcheck; @@ -101,12 +102,15 @@ which is associated with the inode of a deleted file. */ check_trustdb_stale (); - if( !list ) - list_all(0); + if (locate_mode) + locate_one (list); + else if (!list) + list_all (0); else - list_one( list, 0 ); + list_one (list, 0); } + void secret_key_list( strlist_t list ) { @@ -527,7 +531,39 @@ print_signature_stats(&stats); } + static void +locate_one (strlist_t names) +{ + int rc = 0; + strlist_t sl; + KBNODE keyblock = NULL; + struct sig_stats stats; + + memset(&stats,0,sizeof(stats)); + + for (sl=names; sl; sl = sl->next) + { + rc = get_pubkey_byname (NULL, sl->d, &keyblock, NULL, 1, 0); + if (rc) + { + if (gpg_err_code (rc) != GPG_ERR_NO_PUBKEY) + log_error ("error reading key: %s\n", g10_errstr(rc) ); + } + else + { + list_keyblock (keyblock, 0, opt.fingerprint, + opt.check_sigs? &stats : NULL ); + release_kbnode (keyblock); + } + } + + if (opt.check_sigs && !opt.with_colons) + print_signature_stats (&stats); +} + + +static void print_key_data( PKT_public_key *pk ) { int n = pk ? pubkey_get_npkey( pk->pubkey_algo ) : 0; Modified: trunk/g10/main.h =================================================================== --- trunk/g10/main.h 2008-05-06 14:03:36 UTC (rev 4757) +++ trunk/g10/main.h 2008-05-07 15:40:36 UTC (rev 4758) @@ -286,7 +286,7 @@ void release_revocation_reason_info( struct revocation_reason_info *reason ); /*-- keylist.c --*/ -void public_key_list( strlist_t list ); +void public_key_list( strlist_t list, int locate_mode ); void secret_key_list( strlist_t list ); void print_subpackets_colon(PKT_signature *sig); void reorder_keyblock (KBNODE keyblock); From cvs at cvs.gnupg.org Wed May 7 17:41:17 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 07 May 2008 17:41:17 +0200 Subject: [svn] gpgme - r1312 - in trunk: . doc gpgme Message-ID: 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 + + * 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 * 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) { From cvs at cvs.gnupg.org Wed May 7 20:19:43 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 07 May 2008 20:19:43 +0200 Subject: [svn] GnuPG - r4759 - trunk/g10 Message-ID: Author: wk Date: 2008-05-07 20:19:41 +0200 (Wed, 07 May 2008) New Revision: 4759 Modified: trunk/g10/ChangeLog trunk/g10/getkey.c trunk/g10/keydb.h trunk/g10/keyedit.c trunk/g10/keylist.c trunk/g10/pkclist.c Log: --locate-key now returns several keys if they all match. Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2008-05-07 15:40:36 UTC (rev 4758) +++ trunk/g10/ChangeLog 2008-05-07 18:19:41 UTC (rev 4759) @@ -1,11 +1,13 @@ 2008-05-07 Werner Koch - * getkey.c (get_pubkey_byname): Fix nodefault case. - * gpg.c: New command --locate-keys. New options --with-sig-list and --with-sig-check. * keylist.c (locate_one): New. (public_key_list): Add arg LOCATE_MODE and use locate_one. + * getkey.c (get_pubkey_byname): Fix nodefault case. Add option + RETCTX, change all callers. + (struct getkey_ctx_s): Add field extra_ptr; + (get_pubkey_end): Free it. 2008-04-18 Werner Koch Modified: trunk/g10/getkey.c =================================================================== --- trunk/g10/getkey.c 2008-05-07 15:40:36 UTC (rev 4758) +++ trunk/g10/getkey.c 2008-05-07 18:19:41 UTC (rev 4759) @@ -47,7 +47,8 @@ int exact; KBNODE keyblock; KBPOS kbpos; - KBNODE found_key; /* pointer into some keyblock */ + KBNODE found_key; /* Pointer into some keyblock. */ + strlist_t *extra_list; /* Will be freed when releasing the context. */ int last_rc; int req_usage; int req_algo; @@ -917,7 +918,7 @@ to import the key via the online mechanisms defined by --auto-key-locate. */ int -get_pubkey_byname (PKT_public_key *pk, +get_pubkey_byname (GETKEY_CTX *retctx, PKT_public_key *pk, const char *name, KBNODE *ret_keyblock, KEYDB_HANDLE *ret_kdbhd, int include_unusable, int no_akl) @@ -927,12 +928,22 @@ struct akl *akl; int is_mbox; int nodefault = 0; + int anylocalfirst = 0; + if (retctx) + *retctx = NULL; + is_mbox = is_valid_mailbox (name); /* Check whether we the default local search has been disabled. This is the case if either the "nodefault" or the "local" keyword - are in the list of auto key locate mechanisms. */ + are in the list of auto key locate mechanisms. + + ANYLOCALFIRST is set if the search order has the local method + before any other or if "local" is used first by default. This + makes sure that if a RETCTX is used it gets only set if a local + search has precedence over the other search methods and only then + a followup call to get_pubkey_next shall succeed. */ if (!no_akl) { for (akl=opt.auto_key_locate; akl; akl=akl->next) @@ -941,8 +952,18 @@ nodefault = 1; break; } + for (akl=opt.auto_key_locate; akl; akl=akl->next) + if (akl->type != AKL_NODEFAULT) + { + if (akl->type == AKL_LOCAL) + anylocalfirst = 1; + break; + } } + if (!nodefault) + anylocalfirst = 1; + if (nodefault && is_mbox) { /* Nodefault but a mailbox - let the AKL locate the key. */ @@ -951,7 +972,7 @@ else { add_to_strlist (&namelist, name); - rc = key_byname (NULL, namelist, pk, NULL, 0, + rc = key_byname (retctx, namelist, pk, NULL, 0, include_unusable, ret_keyblock, ret_kdbhd); } @@ -967,7 +988,7 @@ int no_fingerprint = 0; const char *mechanism = "?"; - switch(akl->type) + switch(akl->type) { case AKL_NODEFAULT: /* This is a dummy mechanism. */ @@ -978,8 +999,14 @@ case AKL_LOCAL: mechanism = "Local"; did_key_byname = 1; + if (retctx) + { + get_pubkey_end (*retctx); + *retctx = NULL; + } add_to_strlist (&namelist, name); - rc = key_byname (NULL, namelist, pk, NULL, 0, + rc = key_byname (anylocalfirst? retctx:NULL, + namelist, pk, NULL, 0, include_unusable, ret_keyblock, ret_kdbhd); break; @@ -1068,8 +1095,16 @@ fpr = NULL; if (!rc && !did_key_byname) - rc = key_byname (NULL, namelist, pk, NULL, 0, - include_unusable, ret_keyblock, ret_kdbhd); + { + if (retctx) + { + get_pubkey_end (*retctx); + *retctx = NULL; + } + rc = key_byname (anylocalfirst?retctx:NULL, + namelist, pk, NULL, 0, + include_unusable, ret_keyblock, ret_kdbhd); + } if (!rc) { /* Key found. */ @@ -1084,10 +1119,24 @@ } } - free_strlist( namelist ); + + if (rc && retctx) + { + get_pubkey_end (*retctx); + *retctx = NULL; + } + + if (retctx && *retctx) + { + assert (!(*retctx)->extra_list); + (*retctx)->extra_list = namelist; + } + else + free_strlist (namelist); return rc; } + int get_pubkey_bynames( GETKEY_CTX *retctx, PKT_public_key *pk, strlist_t names, KBNODE *ret_keyblock ) @@ -1113,6 +1162,7 @@ if( ctx ) { memset (&ctx->kbpos, 0, sizeof ctx->kbpos); keydb_release (ctx->kr_handle); + free_strlist (ctx->extra_list); if( !ctx->not_allocated ) xfree( ctx ); } Modified: trunk/g10/keydb.h =================================================================== --- trunk/g10/keydb.h 2008-05-07 15:40:36 UTC (rev 4758) +++ trunk/g10/keydb.h 2008-05-07 18:19:41 UTC (rev 4759) @@ -221,7 +221,7 @@ int get_pubkey( PKT_public_key *pk, u32 *keyid ); int get_pubkey_fast ( PKT_public_key *pk, u32 *keyid ); KBNODE get_pubkeyblock( u32 *keyid ); -int get_pubkey_byname( PKT_public_key *pk, const char *name, +int get_pubkey_byname (GETKEY_CTX *rx, PKT_public_key *pk, const char *name, KBNODE *ret_keyblock, KEYDB_HANDLE *ret_kdbhd, int include_unusable, int no_akl ); int get_pubkey_bynames( GETKEY_CTX *rx, PKT_public_key *pk, Modified: trunk/g10/keyedit.c =================================================================== --- trunk/g10/keyedit.c 2008-05-07 15:40:36 UTC (rev 4758) +++ trunk/g10/keyedit.c 2008-05-07 18:19:41 UTC (rev 4759) @@ -1544,7 +1544,7 @@ #endif /* Get the public key */ - rc = get_pubkey_byname (NULL, username, &keyblock, &kdbhd, 1, 1); + rc = get_pubkey_byname (NULL, NULL, username, &keyblock, &kdbhd, 1, 1); if( rc ) goto leave; if( fix_keyblock( keyblock ) ) @@ -3396,7 +3396,7 @@ GnuPG both can handle a designated revokation from a subkey. */ revoker_pk->req_usage=PUBKEY_USAGE_CERT; - rc=get_pubkey_byname(revoker_pk,answer,NULL,NULL,1, 1); + rc=get_pubkey_byname (NULL, revoker_pk,answer,NULL,NULL,1, 1); if(rc) { log_error (_("key \"%s\" not found: %s\n"),answer,g10_errstr(rc)); Modified: trunk/g10/keylist.c =================================================================== --- trunk/g10/keylist.c 2008-05-07 15:40:36 UTC (rev 4758) +++ trunk/g10/keylist.c 2008-05-07 18:19:41 UTC (rev 4759) @@ -537,14 +537,15 @@ { int rc = 0; strlist_t sl; + GETKEY_CTX ctx = NULL; KBNODE keyblock = NULL; struct sig_stats stats; - memset(&stats,0,sizeof(stats)); + memset (&stats,0,sizeof(stats)); for (sl=names; sl; sl = sl->next) { - rc = get_pubkey_byname (NULL, sl->d, &keyblock, NULL, 1, 0); + rc = get_pubkey_byname (&ctx, NULL, sl->d, &keyblock, NULL, 1, 0); if (rc) { if (gpg_err_code (rc) != GPG_ERR_NO_PUBKEY) @@ -552,9 +553,15 @@ } else { - list_keyblock (keyblock, 0, opt.fingerprint, - opt.check_sigs? &stats : NULL ); - release_kbnode (keyblock); + do + { + list_keyblock (keyblock, 0, opt.fingerprint, + opt.check_sigs? &stats : NULL ); + release_kbnode (keyblock); + } + while ( ctx && !get_pubkey_next (ctx, NULL, &keyblock)); + get_pubkey_end (ctx); + ctx = NULL; } } Modified: trunk/g10/pkclist.c =================================================================== --- trunk/g10/pkclist.c 2008-05-07 15:40:36 UTC (rev 4758) +++ trunk/g10/pkclist.c 2008-05-07 18:19:41 UTC (rev 4759) @@ -826,7 +826,7 @@ /* We explicitly allow encrypt-to to an disabled key; thus we pass 1for the second last argument and 1 as the last argument to disable AKL. */ - if ( (rc = get_pubkey_byname (pk, rov->d, NULL, NULL, 1, 1)) ) + if ( (rc = get_pubkey_byname (NULL, pk, rov->d, NULL, NULL, 1, 1)) ) { free_public_key ( pk ); pk = NULL; log_error (_("%s: skipped: %s\n"), rov->d, g10_errstr(rc) ); @@ -965,7 +965,7 @@ free_public_key (pk); pk = xmalloc_clear( sizeof *pk ); pk->req_usage = use; - rc = get_pubkey_byname( pk, answer, NULL, NULL, 0, 0 ); + rc = get_pubkey_byname (NULL, pk, answer, NULL, NULL, 0, 0 ); if (rc) tty_printf(_("No such user ID.\n")); else if ( !(rc=openpgp_pk_test_algo2 (pk->pubkey_algo, use)) ) @@ -1039,7 +1039,7 @@ /* The default recipient is allowed to be disabled; thus pass 1 as second last argument. We also don't want an AKL. */ - rc = get_pubkey_byname (pk, def_rec, NULL, NULL, 1, 1); + rc = get_pubkey_byname (NULL, pk, def_rec, NULL, NULL, 1, 1); if (rc) log_error(_("unknown default recipient \"%s\"\n"), def_rec ); else if ( !(rc=openpgp_pk_test_algo2(pk->pubkey_algo, use)) ) @@ -1079,7 +1079,7 @@ pk = xmalloc_clear( sizeof *pk ); pk->req_usage = use; - if ( (rc = get_pubkey_byname( pk, remusr->d, NULL, NULL, 0, 0 )) ) + if ((rc = get_pubkey_byname (NULL, pk, remusr->d, NULL, NULL, 0, 0))) { /* Key not found or other error. */ free_public_key( pk ); pk = NULL; From cvs at cvs.gnupg.org Thu May 8 12:10:29 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Thu, 08 May 2008 12:10:29 +0200 Subject: [svn] GnuPG - r4760 - trunk/g10 Message-ID: Author: wk Date: 2008-05-08 12:10:27 +0200 (Thu, 08 May 2008) New Revision: 4760 Modified: trunk/g10/ChangeLog trunk/g10/sig-check.c Log: Print a note for revoked signing keys. Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2008-05-07 18:19:41 UTC (rev 4759) +++ trunk/g10/ChangeLog 2008-05-08 10:10:27 UTC (rev 4760) @@ -1,3 +1,8 @@ +2008-05-08 Werner Koch + + * sig-check.c (do_check_messages): Print a revocation diagnostic + in verbose mode. + 2008-05-07 Werner Koch * gpg.c: New command --locate-keys. New options --with-sig-list Modified: trunk/g10/sig-check.c =================================================================== --- trunk/g10/sig-check.c 2008-05-07 18:19:41 UTC (rev 4759) +++ trunk/g10/sig-check.c 2008-05-08 10:10:27 UTC (rev 4760) @@ -220,8 +220,14 @@ *r_expired = 1; } - if(pk->is_revoked && r_revoked) - *r_revoked=1; + if (pk->is_revoked) + { + if (opt.verbose) + log_info (_("NOTE: signature key %s has been revoked\n"), + keystr_from_pk(pk)); + if (r_revoked) + *r_revoked=1; + } return 0; } From cvs at cvs.gnupg.org Fri May 9 10:26:29 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Fri, 09 May 2008 10:26:29 +0200 Subject: [svn] gpgme - r1313 - trunk/gpgme Message-ID: Author: wk Date: 2008-05-09 10:26:28 +0200 (Fri, 09 May 2008) New Revision: 1313 Modified: trunk/gpgme/ChangeLog trunk/gpgme/engine-gpgconf.c trunk/gpgme/gpgme.h Log: Fixed a gpgconf problem under Windows. Modified: trunk/gpgme/ChangeLog =================================================================== --- trunk/gpgme/ChangeLog 2008-05-07 15:41:14 UTC (rev 1312) +++ trunk/gpgme/ChangeLog 2008-05-09 08:26:28 UTC (rev 1313) @@ -1,3 +1,8 @@ +2008-05-09 Werner Koch + + * engine-gpgconf.c (gpgconf_read): Do not pass empty lines to the + callback. + 2008-05-07 Werner Koch * engine-gpgconf.c (gpgconf_write): Change argv[0] to a Modified: trunk/gpgme/engine-gpgconf.c =================================================================== --- trunk/gpgme/engine-gpgconf.c 2008-05-07 15:41:14 UTC (rev 1312) +++ trunk/gpgme/engine-gpgconf.c 2008-05-09 08:26:28 UTC (rev 1313) @@ -247,8 +247,11 @@ mark--; *mark = '\0'; - /* Got a full line. */ - err = (*cb) (hook, line); + /* Got a full line. Due to the CR removal code (which + occurs only on Windows) we might be one-off and thus + would see empty lines. Don't pass them to the + callback. */ + err = *line? (*cb) (hook, line) : NULL; if (err) goto leave; } Modified: trunk/gpgme/gpgme.h =================================================================== --- trunk/gpgme/gpgme.h 2008-05-07 15:41:14 UTC (rev 1312) +++ trunk/gpgme/gpgme.h 2008-05-09 08:26:28 UTC (rev 1313) @@ -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-svn1311" +#define GPGME_VERSION "1.1.7-svn1312" From cvs at cvs.gnupg.org Fri May 9 11:54:54 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Fri, 09 May 2008 11:54:54 +0200 Subject: [svn] GnuPG - r4761 - in trunk: doc jnlib po sm tools Message-ID: Author: wk Date: 2008-05-09 11:54:35 +0200 (Fri, 09 May 2008) New Revision: 4761 Modified: trunk/doc/DETAILS trunk/doc/gpg.texi trunk/jnlib/w32-gettext.c trunk/po/ChangeLog trunk/po/be.po trunk/po/ca.po trunk/po/cs.po trunk/po/da.po trunk/po/de.po trunk/po/el.po trunk/po/eo.po trunk/po/es.po trunk/po/et.po trunk/po/fi.po trunk/po/fr.po trunk/po/gl.po trunk/po/hu.po trunk/po/id.po trunk/po/it.po trunk/po/ja.po trunk/po/nb.po trunk/po/pl.po trunk/po/pt.po trunk/po/pt_BR.po trunk/po/ro.po trunk/po/ru.po trunk/po/sk.po trunk/po/sv.po trunk/po/tr.po trunk/po/zh_CN.po trunk/po/zh_TW.po trunk/sm/gpgsm.c trunk/tools/ChangeLog trunk/tools/gpgconf-comp.c Log: Updated German translation. Fix in gpgconf for W32. Modified: trunk/po/ChangeLog =================================================================== --- trunk/po/ChangeLog 2008-05-08 10:10:27 UTC (rev 4760) +++ trunk/po/ChangeLog 2008-05-09 09:54:35 UTC (rev 4761) @@ -1,3 +1,7 @@ +2008-05-09 Werner Koch + + * de.po: Update. + 2008-05-01 Werner Koch * de.po: Typo fix. Modified: trunk/tools/ChangeLog =================================================================== --- trunk/tools/ChangeLog 2008-05-08 10:10:27 UTC (rev 4760) +++ trunk/tools/ChangeLog 2008-05-09 09:54:35 UTC (rev 4761) @@ -1,3 +1,8 @@ +2008-05-09 Werner Koch + + * gpgconf-comp.c (my_dgettext) [USE_SIMPLE_GETTEXT]: Hack to + parly support translations. + 2008-04-08 Werner Koch * gpgconf-comp.c (gc_options_gpg): Add --auto-key-locate. Modified: trunk/doc/DETAILS =================================================================== --- trunk/doc/DETAILS 2008-05-08 10:10:27 UTC (rev 4760) +++ trunk/doc/DETAILS 2008-05-09 09:54:35 UTC (rev 4761) @@ -70,7 +70,7 @@ 5. Field: KeyID 6. Field: Creation Date (in UTC). For UID and UAT records, this is the - self-signature date. Note that the dae is usally printed + self-signature date. Note that the date is usally printed in seconds since epoch, however, we are migrating to an ISO 8601 format (e.g. "19660205T091500"). This is currently only relevant for X.509, A simple way to detect the format Modified: trunk/doc/gpg.texi =================================================================== --- trunk/doc/gpg.texi 2008-05-08 10:10:27 UTC (rev 4760) +++ trunk/doc/gpg.texi 2008-05-09 09:54:35 UTC (rev 4761) @@ -311,7 +311,9 @@ @item --check-sigs @opindex check-sigs -Same as @option{--list-sigs}, but the signatures are verified. +Same as @option{--list-sigs}, but the signatures are verified. Note +that for performance reasons the revocation status of a signing key is +not shown. @ifclear gpgone This command has the same effect as using @option{--list-keys} with @option{--with-sig-check}. Modified: trunk/jnlib/w32-gettext.c =================================================================== --- trunk/jnlib/w32-gettext.c 2008-05-08 10:10:27 UTC (rev 4760) +++ trunk/jnlib/w32-gettext.c 2008-05-09 09:54:35 UTC (rev 4761) @@ -1333,6 +1333,11 @@ { struct loaded_domain *domain = NULL; + /* FIXME: To support dgettext we need to make struct loaded_doman a + linked list and search that list for loaded domains before adding + a new one. If it is loaded just switch the current doman but do + not free anything. */ + if ( filename && *filename ) { if ( filename[0] == '/' Modified: trunk/po/be.po [not shown] Modified: trunk/po/ca.po [not shown] Modified: trunk/po/cs.po [not shown] Modified: trunk/po/da.po [not shown] Modified: trunk/po/de.po [not shown] Modified: trunk/po/el.po [not shown] Modified: trunk/po/eo.po [not shown] Modified: trunk/po/es.po [not shown] Modified: trunk/po/et.po [not shown] Modified: trunk/po/fi.po [not shown] Modified: trunk/po/fr.po [not shown] Modified: trunk/po/gl.po [not shown] Modified: trunk/po/hu.po [not shown] Modified: trunk/po/id.po [not shown] Modified: trunk/po/it.po [not shown] Modified: trunk/po/ja.po [not shown] Modified: trunk/po/nb.po [not shown] Modified: trunk/po/pl.po [not shown] Modified: trunk/po/pt.po [not shown] Modified: trunk/po/pt_BR.po [not shown] Modified: trunk/po/ro.po [not shown] Modified: trunk/po/ru.po [not shown] Modified: trunk/po/sk.po [not shown] Modified: trunk/po/sv.po [not shown] Modified: trunk/po/tr.po [not shown] Modified: trunk/po/zh_CN.po [not shown] Modified: trunk/po/zh_TW.po [not shown] Modified: trunk/sm/gpgsm.c =================================================================== --- trunk/sm/gpgsm.c 2008-05-08 10:10:27 UTC (rev 4760) +++ trunk/sm/gpgsm.c 2008-05-09 09:54:35 UTC (rev 4761) @@ -1869,7 +1869,7 @@ default: - log_error ("invalid command (there is no implicit command)\n"); + log_error (_("invalid command (there is no implicit command)\n")); break; } Modified: trunk/tools/gpgconf-comp.c =================================================================== --- trunk/tools/gpgconf-comp.c 2008-05-08 10:10:27 UTC (rev 4760) +++ trunk/tools/gpgconf-comp.c 2008-05-09 09:54:35 UTC (rev 4761) @@ -1027,7 +1027,7 @@ static const char * my_dgettext (const char *domain, const char *msgid) { -#ifdef ENABLE_NLS +#ifdef USE_SIMPLE_GETTEXT if (domain) { static int switched_codeset; @@ -1036,6 +1036,26 @@ if (!switched_codeset) { switched_codeset = 1; + gettext_select_utf8 (1); + } + + if (!strcmp (domain, "gnupg")) + domain = PACKAGE_GT; + + /* FIXME: we have no dgettext, thus we can't switch. */ + + text = gettext (msgid); + return text ? text : msgid; + } +#elif defined(ENABLE_NLS) + if (domain) + { + static int switched_codeset; + char *text; + + if (!switched_codeset) + { + switched_codeset = 1; bind_textdomain_codeset (PACKAGE_GT, "utf-8"); bindtextdomain ("dirmngr", LOCALEDIR); From cvs at cvs.gnupg.org Fri May 9 12:04:07 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Fri, 09 May 2008 12:04:07 +0200 Subject: [svn] GnuPG - r4762 - in trunk: g10 po Message-ID: Author: wk Date: 2008-05-09 12:03:55 +0200 (Fri, 09 May 2008) New Revision: 4762 Modified: trunk/g10/getkey.c trunk/po/be.po trunk/po/ca.po trunk/po/cs.po trunk/po/da.po trunk/po/de.po trunk/po/el.po trunk/po/eo.po trunk/po/es.po trunk/po/et.po trunk/po/fi.po trunk/po/fr.po trunk/po/gl.po trunk/po/hu.po trunk/po/id.po trunk/po/it.po trunk/po/ja.po trunk/po/nb.po trunk/po/pl.po trunk/po/pt.po trunk/po/pt_BR.po trunk/po/ro.po trunk/po/ru.po trunk/po/sk.po trunk/po/sv.po trunk/po/tr.po trunk/po/zh_CN.po trunk/po/zh_TW.po Log: Remove a warning. Modified: trunk/g10/getkey.c =================================================================== --- trunk/g10/getkey.c 2008-05-09 09:54:35 UTC (rev 4761) +++ trunk/g10/getkey.c 2008-05-09 10:03:55 UTC (rev 4762) @@ -48,7 +48,7 @@ KBNODE keyblock; KBPOS kbpos; KBNODE found_key; /* Pointer into some keyblock. */ - strlist_t *extra_list; /* Will be freed when releasing the context. */ + strlist_t extra_list; /* Will be freed when releasing the context. */ int last_rc; int req_usage; int req_algo; Modified: trunk/po/be.po [not shown] Modified: trunk/po/ca.po [not shown] Modified: trunk/po/cs.po [not shown] Modified: trunk/po/da.po [not shown] Modified: trunk/po/de.po [not shown] Modified: trunk/po/el.po [not shown] Modified: trunk/po/eo.po [not shown] Modified: trunk/po/es.po [not shown] Modified: trunk/po/et.po [not shown] Modified: trunk/po/fi.po [not shown] Modified: trunk/po/fr.po [not shown] Modified: trunk/po/gl.po [not shown] Modified: trunk/po/hu.po [not shown] Modified: trunk/po/id.po [not shown] Modified: trunk/po/it.po [not shown] Modified: trunk/po/ja.po [not shown] Modified: trunk/po/nb.po [not shown] Modified: trunk/po/pl.po [not shown] Modified: trunk/po/pt.po [not shown] Modified: trunk/po/pt_BR.po [not shown] Modified: trunk/po/ro.po [not shown] Modified: trunk/po/ru.po [not shown] Modified: trunk/po/sk.po [not shown] Modified: trunk/po/sv.po [not shown] Modified: trunk/po/tr.po [not shown] Modified: trunk/po/zh_CN.po [not shown] Modified: trunk/po/zh_TW.po [not shown] From cvs at cvs.gnupg.org Thu May 15 12:59:36 2008 From: cvs at cvs.gnupg.org (svn author marcus) Date: Thu, 15 May 2008 12:59:36 +0200 Subject: [svn] GnuPG - r4763 - trunk/doc Message-ID: Author: marcus Date: 2008-05-15 12:59:35 +0200 (Thu, 15 May 2008) New Revision: 4763 Modified: trunk/doc/ChangeLog trunk/doc/gpg.texi Log: 2008-05-15 Marcus Brinkmann * gpg.texi (Operational GPG Commands): Mention the way to change the default signing key. Modified: trunk/doc/ChangeLog =================================================================== --- trunk/doc/ChangeLog 2008-05-09 10:03:55 UTC (rev 4762) +++ trunk/doc/ChangeLog 2008-05-15 10:59:35 UTC (rev 4763) @@ -1,3 +1,8 @@ +2008-05-15 Marcus Brinkmann + + * gpg.texi (Operational GPG Commands): Mention the way to change + the default signing key. + 2008-05-06 Werner Koch * Makefile.am (myman_pages): Add gpg-zip.1. Modified: trunk/doc/gpg.texi =================================================================== --- trunk/doc/gpg.texi 2008-05-09 10:03:55 UTC (rev 4762) +++ trunk/doc/gpg.texi 2008-05-15 10:59:35 UTC (rev 4763) @@ -175,19 +175,24 @@ @itemx -s @opindex sign Make a signature. This command may be combined with @option{--encrypt} -(for a signed and encrypted message), @option{--symmetric} (for a signed -and symmetrically encrypted message), or @option{--encrypt} and +(for a signed and encrypted message), @option{--symmetric} (for a +signed and symmetrically encrypted message), or @option{--encrypt} and @option{--symmetric} together (for a signed message that may be -decrypted via a secret key or a passphrase). +decrypted via a secret key or a passphrase). The key to be used for +signing is chosen by default or can be set with the + at option{--local-user} and @option{--default-key} options. @item --clearsign @opindex clearsign -Make a clear text signature. The content in a clear text signature is -readable without any special software. OpenPGP software is only -needed to verify the signature. Clear text signatures may modify -end-of-line whitespace for platform independence and are not intended -to be reversible. +Make a clear text signature. The content in a clear text signature is +readable without any special software. OpenPGP software is only needed +to verify the signature. Clear text signatures may modify end-of-line +whitespace for platform independence and are not intended to be +reversible. The key to be used for signing is chosen by default or +can be set with the @option{--local-user} and @option{--default-key} +options. + @item --detach-sign @itemx -b @opindex detach-sign From cvs at cvs.gnupg.org Tue May 20 00:46:42 2008 From: cvs at cvs.gnupg.org (svn author marcus) Date: Tue, 20 May 2008 00:46:42 +0200 Subject: [svn] GnuPG - r4764 - in trunk: doc tools Message-ID: Author: marcus Date: 2008-05-20 00:46:41 +0200 (Tue, 20 May 2008) New Revision: 4764 Modified: trunk/doc/ChangeLog trunk/doc/tools.texi trunk/tools/ChangeLog trunk/tools/gpgconf-comp.c trunk/tools/gpgconf.c trunk/tools/gpgconf.h Log: doc/ 2008-05-20 Marcus Brinkmann * tools.texi (Invoking gpgconf): Add --dry-run and --check-options. (Checking programs): Document --check-options. tools/ 2008-05-20 Marcus Brinkmann * gpgconf.h (gc_component_check_programs): Rename to ... (gc_check_programs): ... this. (gc_component_change_options): Add argument OUT. (gc_component_check_options): New function. * gpgconf.c (enum cmd_and_opt_values): New option aCheckOptions. (opts): Add new option aCheckOptions (aka --check-options). (main): Handle new option aCheckOptions. * gpgconf-comp.c (gc_component_check_programs): Rename to ... (gc_check_programs): ... this. Refactor core of it to ... (gc_component_check_options): ... this new function. (gc_component_change_options): Add new argument OUT. Externally verify all changes. Implement option --dry-run. Modified: trunk/doc/ChangeLog =================================================================== --- trunk/doc/ChangeLog 2008-05-15 10:59:35 UTC (rev 4763) +++ trunk/doc/ChangeLog 2008-05-19 22:46:41 UTC (rev 4764) @@ -1,3 +1,8 @@ +2008-05-20 Marcus Brinkmann + + * tools.texi (Invoking gpgconf): Add --dry-run and --check-options. + (Checking programs): Document --check-options. + 2008-05-15 Marcus Brinkmann * gpg.texi (Operational GPG Commands): Mention the way to change Modified: trunk/tools/ChangeLog =================================================================== --- trunk/tools/ChangeLog 2008-05-15 10:59:35 UTC (rev 4763) +++ trunk/tools/ChangeLog 2008-05-19 22:46:41 UTC (rev 4764) @@ -1,3 +1,18 @@ +2008-05-20 Marcus Brinkmann + + * gpgconf.h (gc_component_check_programs): Rename to ... + (gc_check_programs): ... this. + (gc_component_change_options): Add argument OUT. + (gc_component_check_options): New function. + * gpgconf.c (enum cmd_and_opt_values): New option aCheckOptions. + (opts): Add new option aCheckOptions (aka --check-options). + (main): Handle new option aCheckOptions. + * gpgconf-comp.c (gc_component_check_programs): Rename to ... + (gc_check_programs): ... this. Refactor core of it to ... + (gc_component_check_options): ... this new function. + (gc_component_change_options): Add new argument OUT. Externally + verify all changes. Implement option --dry-run. + 2008-05-09 Werner Koch * gpgconf-comp.c (my_dgettext) [USE_SIMPLE_GETTEXT]: Hack to Modified: trunk/doc/tools.texi =================================================================== --- trunk/doc/tools.texi 2008-05-15 10:59:35 UTC (rev 4763) +++ trunk/doc/tools.texi 2008-05-19 22:46:41 UTC (rev 4764) @@ -230,6 +230,9 @@ @item --change-options @var{component} Change the options of the component @var{component}. + at item --check-options @var{component} +Check the options for the component @var{component}. + @item --apply-defaults Update all configuration files with values taken from the global configuration file (usually @file{/etc/gnupg/gpgconf.conf}). @@ -260,11 +263,10 @@ Outputs additional information while running. Specifically, this extends numerical field values by human-readable descriptions. - at c FIXME: Not yet supported. - at c @item -n - at c @itemx --dry-run - at c Do not actually change anything. Useful together with - at c @code{--change-options} for testing purposes. + at item -n + at itemx --dry-run +Do not actually change anything. This is currently only implemented +for @code{--change-options} and can be used for testing purposes. @item -r @itemx --runtime @@ -531,7 +533,12 @@ dirmngr:Directory Manager:/usr/local/bin/dirmngr:0:0: @end example + at noindent +The command @w{@code{--check-options @var{component}}} will verify the +configuration file in the same manner as @code{--check-programs}, but +only for the component @var{component}. + @node Listing options @subsection Listing options @@ -769,6 +776,10 @@ option). Otherwise, the option will be set to the specified value. @end table + at noindent +The output of the command is the same as that of + at code{--check-options} for the modified configuration file. + Examples: To set the force option, which is of basic type @code{none (0)}: Modified: trunk/tools/gpgconf-comp.c =================================================================== --- trunk/tools/gpgconf-comp.c 2008-05-15 10:59:35 UTC (rev 4763) +++ trunk/tools/gpgconf-comp.c 2008-05-19 22:46:41 UTC (rev 4764) @@ -1317,121 +1317,143 @@ } - -/* Check all components that are available. */ -void -gc_component_check_programs (FILE *out) +/* Check the options of a single component. Returns 0 if everything + is OK. */ +int +gc_component_check_options (int component, FILE *out, const char *conf_file) { gpg_error_t err; - gc_component_t component; unsigned int result; int backend_seen[GC_BACKEND_NR]; gc_backend_t backend; gc_option_t *option; - const char *desc; const char *pgmname; - const char *argv[2]; + const char *argv[4]; + int i; pid_t pid; int exitcode; int filedes[2]; - error_line_t errlines, errptr; + error_line_t errlines; /* We use a temporary file to collect the error output. It would be better to use a pipe here but as of now we have no suitable fucntion to create a portable pipe outside of exechelp. Thus it is easier to use the tempfile approach. */ - for (component = 0; component < GC_COMPONENT_NR; component++) + + for (backend = 0; backend < GC_BACKEND_NR; backend++) + backend_seen[backend] = 0; + + option = gc_component[component].options; + for (; option && option->name; option++) { - if (!gc_component[component].options) - continue; + if ((option->flags & GC_OPT_FLAG_GROUP)) + continue; + backend = option->backend; + if (backend_seen[backend]) + continue; + backend_seen[backend] = 1; + assert (backend != GC_BACKEND_ANY); + if (!gc_backend[backend].program) + continue; + if (!gc_backend[backend].module_name) + continue; - for (backend = 0; backend < GC_BACKEND_NR; backend++) - backend_seen[backend] = 0; + break; + } + if (! option || ! option->name) + return 0; - option = gc_component[component].options; - for (; option && option->name; option++) - { - if ((option->flags & GC_OPT_FLAG_GROUP)) - continue; - backend = option->backend; - if (backend_seen[backend]) - continue; - backend_seen[backend] = 1; - assert (backend != GC_BACKEND_ANY); - if (!gc_backend[backend].program) - continue; - if (!gc_backend[backend].module_name) - continue; + pgmname = gnupg_module_name (gc_backend[backend].module_name); + i = 0; + if (conf_file) + { + argv[i++] = "--options"; + argv[i++] = conf_file; + } + argv[i++] = "--gpgconf-test"; + argv[i++] = NULL; + + err = gnupg_create_inbound_pipe (filedes); + if (err) + gc_error (1, 0, _("error creating a pipe: %s\n"), + gpg_strerror (err)); + + result = 0; + errlines = NULL; + if (gnupg_spawn_process_fd (pgmname, argv, -1, -1, filedes[1], &pid)) + { + close (filedes[0]); + close (filedes[1]); + result |= 1; /* Program could not be run. */ + } + else + { + close (filedes[1]); + errlines = collect_error_output (filedes[0], + gc_component[component].name); + if (gnupg_wait_process (pgmname, pid, &exitcode)) + { + if (exitcode == -1) + result |= 1; /* Program could not be run or it + terminated abnormally. */ + result |= 2; /* Program returned an error. */ + } + } + + /* If the program could not be run, we can't tell whether + the config file is good. */ + if (result & 1) + result |= 2; + + if (out) + { + const char *desc; + error_line_t errptr; - pgmname = gnupg_module_name (gc_backend[backend].module_name); - argv[0] = "--gpgconf-test"; - argv[1] = NULL; + desc = gc_component[component].desc; + desc = my_dgettext (gc_component[component].desc_domain, desc); + fprintf (out, "%s:%s:", + gc_component[component].name, my_percent_escape (desc)); + fputs (my_percent_escape (pgmname), out); + fprintf (out, ":%d:%d:", !(result & 1), !(result & 2)); + for (errptr = errlines; errptr; errptr = errptr->next) + { + if (errptr != errlines) + fputs ("\n:::::", out); /* Continuation line. */ + if (errptr->fname) + fputs (my_percent_escape (errptr->fname), out); + putc (':', out); + if (errptr->fname) + fprintf (out, "%u", errptr->lineno); + putc (':', out); + fputs (my_percent_escape (errptr->errtext), out); + putc (':', out); + } + putc ('\n', out); + } - err = gnupg_create_inbound_pipe (filedes); - if (err) - gc_error (1, 0, _("error creating a pipe: %s\n"), - gpg_strerror (err)); + while (errlines) + { + error_line_t tmp = errlines->next; + xfree (errlines); + errlines = tmp; + } - result = 0; - errlines = NULL; - if (gnupg_spawn_process_fd (pgmname, argv, -1, -1, filedes[1], &pid)) - { - close (filedes[0]); - close (filedes[1]); - result |= 1; /* Program could not be run. */ - } - else - { - close (filedes[1]); - errlines = collect_error_output (filedes[0], - gc_component[component].name); - if (gnupg_wait_process (pgmname, pid, &exitcode)) - { - if (exitcode == -1) - result |= 1; /* Program could not be run or it - terminated abnormally. */ - result |= 2; /* Program returned an error. */ - } - } - - /* If the program could not be run, we can't tell whether - the config file is good. */ - if ((result&1)) - result |= 2; - - desc = gc_component[component].desc; - desc = my_dgettext (gc_component[component].desc_domain, desc); - fprintf (out, "%s:%s:", - gc_component[component].name, my_percent_escape (desc)); - fputs (my_percent_escape (pgmname), out); - fprintf (out, ":%d:%d:", !(result & 1), !(result & 2)); - for (errptr = errlines; errptr; errptr = errptr->next) - { - if (errptr != errlines) - fputs ("\n:::::", out); /* Continuation line. */ - if (errptr->fname) - fputs (my_percent_escape (errptr->fname), out); - putc (':', out); - if (errptr->fname) - fprintf (out, "%u", errptr->lineno); - putc (':', out); - fputs (my_percent_escape (errptr->errtext), out); - putc (':', out); - } - putc ('\n', out); - - while (errlines) - { - error_line_t tmp = errlines->next; - xfree (errlines); - errlines = tmp; - } - break; /* Loop over options of this component */ - } - } + return result; } +/* Check all components that are available. */ +void +gc_check_programs (FILE *out) +{ + gc_component_t component; + + for (component = 0; component < GC_COMPONENT_NR; component++) + gc_component_check_options (component, out, NULL); +} + + /* Find the component with the name NAME. Returns -1 if not found. */ @@ -2831,7 +2853,7 @@ modifications are expected to already have been set to the global table. */ void -gc_component_change_options (int component, FILE *in) +gc_component_change_options (int component, FILE *in, FILE *out) { int err = 0; int runtime[GC_BACKEND_NR]; @@ -2935,10 +2957,26 @@ } if (gc_backend[option->backend].program) - err = change_options_program (component, option->backend, - &src_pathname[option->backend], - &dest_pathname[option->backend], - &orig_pathname[option->backend]); + { + err = change_options_program (component, option->backend, + &src_pathname[option->backend], + &dest_pathname[option->backend], + &orig_pathname[option->backend]); + if (! err) + { + /* External verification. */ + err = gc_component_check_options (component, out, + src_pathname[option->backend]); + if (err) + { + gc_error (0, 0, + _("External verification of component %s failed"), + gc_component[component].name); + errno = EINVAL; + } + } + + } else err = change_options_file (component, option->backend, &src_pathname[option->backend], @@ -2951,7 +2989,7 @@ option++; } - if (!err) + if (! err && ! opt.dry_run) { int i; @@ -2994,12 +3032,12 @@ } } - if (err) + if (err || opt.dry_run) { int i; int saved_errno = errno; - /* An error occured. */ + /* An error occured or a dry-run is requested. */ for (i = 0; i < GC_BACKEND_NR; i++) { if (src_pathname[i]) @@ -3027,7 +3065,11 @@ unlink (dest_pathname[i]); } } - gc_error (1, saved_errno, "could not commit changes"); + if (err) + gc_error (1, saved_errno, "could not commit changes"); + + /* Fall-through for dry run. */ + goto leave; } /* If it all worked, notify the daemons of the changes. */ @@ -3055,6 +3097,7 @@ rename (orig_pathname[backend], backup_pathname); } + leave: xfree (line); } @@ -3463,7 +3506,7 @@ for (component_id = 0; component_id < GC_COMPONENT_NR; component_id++) { - gc_component_change_options (component_id, NULL); + gc_component_change_options (component_id, NULL, NULL); } opt.runtime = save_opt_runtime; Modified: trunk/tools/gpgconf.c =================================================================== --- trunk/tools/gpgconf.c 2008-05-15 10:59:35 UTC (rev 4763) +++ trunk/tools/gpgconf.c 2008-05-19 22:46:41 UTC (rev 4764) @@ -43,6 +43,7 @@ aCheckPrograms, aListOptions, aChangeOptions, + aCheckOptions, aApplyDefaults, aListConfig, aCheckConfig @@ -59,6 +60,7 @@ { aCheckPrograms, "check-programs", 256, N_("check all programs") }, { aListOptions, "list-options", 256, N_("|COMPONENT|list options") }, { aChangeOptions, "change-options", 256, N_("|COMPONENT|change options") }, + { aCheckOptions, "check-options", 256, N_("|COMPONENT|check options") }, { aApplyDefaults, "apply-defaults", 256, N_("apply global default values") }, { aListConfig, "list-config", 256, @@ -167,6 +169,7 @@ case aCheckPrograms: case aListOptions: case aChangeOptions: + case aCheckOptions: case aApplyDefaults: case aListConfig: case aCheckConfig: @@ -192,11 +195,12 @@ case aCheckPrograms: /* Check all programs. */ - gc_component_check_programs (get_outfp (&outfp)); + gc_check_programs (get_outfp (&outfp)); break; case aListOptions: case aChangeOptions: + case aCheckOptions: if (!fname) { fputs (_("usage: gpgconf [options] "), stderr); @@ -219,8 +223,10 @@ exit (1); if (cmd == aListOptions) gc_component_list_options (idx, get_outfp (&outfp)); + else if (cmd == aChangeOptions) + gc_component_change_options (idx, stdin, get_outfp (&outfp)); else - gc_component_change_options (idx, stdin); + gc_component_check_options (idx, get_outfp (&outfp), NULL); } break; Modified: trunk/tools/gpgconf.h =================================================================== --- trunk/tools/gpgconf.h 2008-05-15 10:59:35 UTC (rev 4763) +++ trunk/tools/gpgconf.h 2008-05-19 22:46:41 UTC (rev 4764) @@ -43,7 +43,7 @@ void gc_component_list_components (FILE *out); /* List all programs along with their status. */ -void gc_component_check_programs (FILE *out); +void gc_check_programs (FILE *out); /* Find the component with the name NAME. Returns -1 if not found. */ @@ -57,8 +57,13 @@ void gc_component_list_options (int component, FILE *out); /* Read the modifications from IN and apply them. */ -void gc_component_change_options (int component, FILE *in); +void gc_component_change_options (int component, FILE *in, FILE *out); +/* Check the options of a single component. Returns 0 if everything + is OK. */ +int gc_component_check_options (int component, FILE *out, + const char *conf_file); + /* Process global configuration file. */ int gc_process_gpgconf_conf (const char *fname, int update, int defaults, FILE *listfp); From cvs at cvs.gnupg.org Tue May 20 10:00:41 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue, 20 May 2008 10:00:41 +0200 Subject: [svn] GnuPG - r4765 - trunk/sm Message-ID: Author: wk Date: 2008-05-20 10:00:40 +0200 (Tue, 20 May 2008) New Revision: 4765 Modified: trunk/sm/ChangeLog trunk/sm/export.c trunk/sm/gpgsm.c trunk/sm/import.c Log: Fix --output option used when with --export-secret-kety-p12. Modified: trunk/sm/ChangeLog =================================================================== --- trunk/sm/ChangeLog 2008-05-19 22:46:41 UTC (rev 4764) +++ trunk/sm/ChangeLog 2008-05-20 08:00:40 UTC (rev 4765) @@ -1,3 +1,8 @@ +2008-05-20 Werner Koch + + * gpgsm.c (main) : Pass FP and not stdout to + the export function. Reported by Marc Mutz. + 2008-05-06 Werner Koch * keylist.c (list_external_keys): Ignore NOT FOUND error code. Modified: trunk/sm/export.c =================================================================== --- trunk/sm/export.c 2008-05-19 22:46:41 UTC (rev 4764) +++ trunk/sm/export.c 2008-05-20 08:00:40 UTC (rev 4765) @@ -369,7 +369,7 @@ goto leave; } - /* Lookup the certificate an make sure that it is unique. */ + /* Lookup the certificate and make sure that it is unique. */ rc = keydb_search (hd, desc, 1); if (!rc) { Modified: trunk/sm/gpgsm.c =================================================================== --- trunk/sm/gpgsm.c 2008-05-19 22:46:41 UTC (rev 4764) +++ trunk/sm/gpgsm.c 2008-05-20 08:00:40 UTC (rev 4765) @@ -1808,7 +1808,7 @@ FILE *fp = open_fwrite (opt.outfile?opt.outfile:"-"); if (argc == 1) - gpgsm_p12_export (&ctrl, *argv, stdout); + gpgsm_p12_export (&ctrl, *argv, fp); else wrong_args ("--export-secret-key-p12 KEY-ID"); if (fp != stdout) Modified: trunk/sm/import.c =================================================================== --- trunk/sm/import.c 2008-05-19 22:46:41 UTC (rev 4764) +++ trunk/sm/import.c 2008-05-20 08:00:40 UTC (rev 4765) @@ -652,7 +652,7 @@ { /* We only write a plain error code and not direct BAD_PASSPHRASE because the pkcs12 parser might issue this - message multiple times, BAd_PASSPHRASE in general requires a + message multiple times, BAD_PASSPHRASE in general requires a keyID and parts of the import might actually succeed so that IMPORT_PROBLEM is also not appropriate. */ gpgsm_status_with_err_code (ctrl, STATUS_ERROR, From cvs at cvs.gnupg.org Mon May 26 14:00:57 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Mon, 26 May 2008 14:00:57 +0200 Subject: [svn] GnuPG - r4769 - trunk/tools Message-ID: Author: wk Date: 2008-05-26 14:00:55 +0200 (Mon, 26 May 2008) New Revision: 4769 Modified: trunk/tools/ChangeLog trunk/tools/gpg-connect-agent.c trunk/tools/gpgconf-comp.c Log: Make --runtime option of gpgconf under W32 work. Modified: trunk/tools/ChangeLog =================================================================== --- trunk/tools/ChangeLog 2008-05-26 10:39:56 UTC (rev 4768) +++ trunk/tools/ChangeLog 2008-05-26 12:00:55 UTC (rev 4769) @@ -1,3 +1,11 @@ +2008-05-26 Werner Koch + + * gpgconf-comp.c (gpg_agent_runtime_change) [W32]: Issue + "reloadagent" command to gpg-agent. + + * gpg-connect-agent.c (main): Allow server command on the command + line. + 2008-05-20 Marcus Brinkmann * gpgconf.h (gc_component_check_programs): Rename to ... Modified: trunk/tools/gpg-connect-agent.c =================================================================== --- trunk/tools/gpg-connect-agent.c 2008-05-26 10:39:56 UTC (rev 4768) +++ trunk/tools/gpg-connect-agent.c 2008-05-26 12:00:55 UTC (rev 4769) @@ -1134,6 +1134,7 @@ char *condition; } loopstack[20]; int loopidx; + char **cmdline_commands = NULL; gnupg_rl_initialize (); set_strusage (my_strusage); @@ -1191,7 +1192,7 @@ } } else if (argc) - usage (1); + cmdline_commands = argv; if (opt.exec && opt.raw_socket) log_info (_("option \"%s\" ignored due to \"%s\"\n"), @@ -1279,6 +1280,16 @@ else log_fatal ("/end command vanished\n"); } + else if (cmdline_commands && *cmdline_commands && !script_fp) + { + keep_line = 0; + xfree (line); + line = xstrdup (*cmdline_commands); + cmdline_commands++; + n = strlen (line); + if (n >= maxlength) + maxlength = 0; + } else if (use_tty && !script_fp) { keep_line = 0; Modified: trunk/tools/gpgconf-comp.c =================================================================== --- trunk/tools/gpgconf-comp.c 2008-05-26 10:39:56 UTC (rev 4768) +++ trunk/tools/gpgconf-comp.c 2008-05-26 12:00:55 UTC (rev 4769) @@ -1014,9 +1014,26 @@ /* Ignore any errors here. */ kill (pid, SIGHUP); +#else + gpg_error_t err; + const char *pgmname; + const char *argv[2]; + pid_t pid; + + pgmname = gnupg_module_name (GNUPG_MODULE_NAME_CONNECT_AGENT); + argv[0] = "reloadagent"; + argv[1] = NULL; + + err = gnupg_spawn_process_fd (pgmname, argv, -1, -1, -1, &pid); + if (!err) + err = gnupg_wait_process (pgmname, pid, NULL); + if (err) + gc_error (0, 0, "error running `%s%s': %s", + pgmname, " reloadagent", gpg_strerror (err)); #endif /*!HAVE_W32_SYSTEM*/ } + /* More or less Robust version of dgettext. It has the side effect of switching the codeset to utf-8 because this is what we want to From cvs at cvs.gnupg.org Mon May 26 15:43:21 2008 From: cvs at cvs.gnupg.org (svn author marcus) Date: Mon, 26 May 2008 15:43:21 +0200 Subject: [svn] GnuPG - r4770 - in trunk: doc tools Message-ID: Author: marcus Date: 2008-05-26 15:43:20 +0200 (Mon, 26 May 2008) New Revision: 4770 Modified: trunk/doc/ChangeLog trunk/doc/tools.texi trunk/tools/ChangeLog trunk/tools/gpgconf-comp.c trunk/tools/gpgconf.c trunk/tools/gpgconf.h Log: doc/ 2008-05-26 Marcus Brinkmann * tools.texi (Invoking gpgconf): Document --list-dirs. tools/ 2008-05-26 Marcus Brinkmann * gpgconf.c (enum cmd_and_opt_values): Add aListDirs. (opts): Add aListDirs option. (main): Handle aListDirs. * gpgconf.h (gc_percent_escape): New declaration. * gpgconf-comp.c (my_percent_escape): Make non-static and rename to ... (gc_percent_escape): ... this. Change all callers. Modified: trunk/doc/ChangeLog =================================================================== --- trunk/doc/ChangeLog 2008-05-26 12:00:55 UTC (rev 4769) +++ trunk/doc/ChangeLog 2008-05-26 13:43:20 UTC (rev 4770) @@ -1,3 +1,7 @@ +2008-05-26 Marcus Brinkmann + + * tools.texi (Invoking gpgconf): Document --list-dirs. + 2008-05-20 Marcus Brinkmann * tools.texi (Invoking gpgconf): Add --dry-run and --check-options. Modified: trunk/tools/ChangeLog =================================================================== --- trunk/tools/ChangeLog 2008-05-26 12:00:55 UTC (rev 4769) +++ trunk/tools/ChangeLog 2008-05-26 13:43:20 UTC (rev 4770) @@ -1,3 +1,13 @@ +2008-05-26 Marcus Brinkmann + + * gpgconf.c (enum cmd_and_opt_values): Add aListDirs. + (opts): Add aListDirs option. + (main): Handle aListDirs. + * gpgconf.h (gc_percent_escape): New declaration. + * gpgconf-comp.c (my_percent_escape): Make non-static and rename + to ... + (gc_percent_escape): ... this. Change all callers. + 2008-05-26 Werner Koch * gpgconf-comp.c (gpg_agent_runtime_change) [W32]: Issue Modified: trunk/doc/tools.texi =================================================================== --- trunk/doc/tools.texi 2008-05-26 12:00:55 UTC (rev 4769) +++ trunk/doc/tools.texi 2008-05-26 13:43:20 UTC (rev 4770) @@ -237,6 +237,13 @@ Update all configuration files with values taken from the global configuration file (usually @file{/etc/gnupg/gpgconf.conf}). + at item --list-dirs +Lists the directories used by @command{gpgconf}. One directory is +listed per line, and each line consists of a colon-separated list +where the first field names the directory type (for example + at code{sysconfdir}) and the second field contains the percent-escaped +directory. + @item --list-config [@var{filename}] List the global configuration file in a colon separated format. If @var{filename} is given, check that file instead. Modified: trunk/tools/gpgconf-comp.c =================================================================== --- trunk/tools/gpgconf-comp.c 2008-05-26 12:00:55 UTC (rev 4769) +++ trunk/tools/gpgconf-comp.c 2008-05-26 13:43:20 UTC (rev 4770) @@ -1097,8 +1097,8 @@ /* Percent-Escape special characters. The string is valid until the next invocation of the function. */ -static char * -my_percent_escape (const char *src) +char * +gc_percent_escape (const char *src) { static char *esc_str; static int esc_str_len; @@ -1226,8 +1226,8 @@ desc = gc_component[component].desc; desc = my_dgettext (gc_component[component].desc_domain, desc); fprintf (out, "%s:%s:", - gc_component[component].name, my_percent_escape (desc)); - fprintf (out, "%s\n", my_percent_escape (pgmname)); + gc_component[component].name, gc_percent_escape (desc)); + fprintf (out, "%s\n", gc_percent_escape (pgmname)); } } } @@ -1430,20 +1430,20 @@ desc = gc_component[component].desc; desc = my_dgettext (gc_component[component].desc_domain, desc); fprintf (out, "%s:%s:", - gc_component[component].name, my_percent_escape (desc)); - fputs (my_percent_escape (pgmname), out); + gc_component[component].name, gc_percent_escape (desc)); + fputs (gc_percent_escape (pgmname), out); fprintf (out, ":%d:%d:", !(result & 1), !(result & 2)); for (errptr = errlines; errptr; errptr = errptr->next) { if (errptr != errlines) fputs ("\n:::::", out); /* Continuation line. */ if (errptr->fname) - fputs (my_percent_escape (errptr->fname), out); + fputs (gc_percent_escape (errptr->fname), out); putc (':', out); if (errptr->fname) fprintf (out, "%u", errptr->lineno); putc (':', out); - fputs (my_percent_escape (errptr->errtext), out); + fputs (gc_percent_escape (errptr->errtext), out); putc (':', out); } putc ('\n', out); @@ -1559,7 +1559,7 @@ fprintf (out, " %s", gc_level[option->level].name); /* The description field. */ - fprintf (out, ":%s", desc ? my_percent_escape (desc) : ""); + fprintf (out, ":%s", desc ? gc_percent_escape (desc) : ""); /* The type field. */ fprintf (out, ":%u", option->arg_type); @@ -1573,7 +1573,7 @@ gc_arg_type[gc_arg_type[option->arg_type].fallback].name); /* The argument name field. */ - fprintf (out, ":%s", arg_name ? my_percent_escape (arg_name) : ""); + fprintf (out, ":%s", arg_name ? gc_percent_escape (arg_name) : ""); if (arg_name) xfree (arg_name); @@ -1892,7 +1892,7 @@ } else if (gc_arg_type[option->arg_type].fallback == GC_ARG_TYPE_STRING) - opt_value = xasprintf ("\"%s", my_percent_escape (value)); + opt_value = xasprintf ("\"%s", gc_percent_escape (value)); else { /* FIXME: Verify that the number is sane. */ @@ -1983,12 +1983,12 @@ really append. */ if (list) { - new_list = xasprintf ("%s,\"%s", list, my_percent_escape (start)); + new_list = xasprintf ("%s,\"%s", list, gc_percent_escape (start)); xfree (list); list = new_list; } else - list = xasprintf ("\"%s", my_percent_escape (start)); + list = xasprintf ("\"%s", gc_percent_escape (start)); } if (length < 0 || ferror (list_file)) gc_error (1, errno, "can not read list file %s", list_pathname); @@ -3448,8 +3448,8 @@ *p = 0; /* We better strip any extra stuff. */ } - fprintf (listfp, "k:%s:", my_percent_escape (key)); - fprintf (listfp, "%s\n", group? my_percent_escape (group):""); + fprintf (listfp, "k:%s:", gc_percent_escape (key)); + fprintf (listfp, "%s\n", group? gc_percent_escape (group):""); } /* All other lines are rule records. */ @@ -3458,7 +3458,7 @@ option_info->name? option_info->name : "", flags? flags : ""); if (value != empty) - fprintf (listfp, "\"%s", my_percent_escape (value)); + fprintf (listfp, "\"%s", gc_percent_escape (value)); putc ('\n', listfp); } Modified: trunk/tools/gpgconf.c =================================================================== --- trunk/tools/gpgconf.c 2008-05-26 12:00:55 UTC (rev 4769) +++ trunk/tools/gpgconf.c 2008-05-26 13:43:20 UTC (rev 4770) @@ -46,7 +46,8 @@ aCheckOptions, aApplyDefaults, aListConfig, - aCheckConfig + aCheckConfig, + aListDirs }; @@ -63,6 +64,8 @@ { aCheckOptions, "check-options", 256, N_("|COMPONENT|check options") }, { aApplyDefaults, "apply-defaults", 256, N_("apply global default values") }, + { aListDirs, "list-dirs", 256, + N_("get the configuration directories for gpgconf") }, { aListConfig, "list-config", 256, N_("list global configuration file") }, { aCheckConfig, "check-config", 256, @@ -165,6 +168,7 @@ case oVerbose: opt.verbose++; break; case oNoVerbose: opt.verbose = 0; break; + case aListDirs: case aListComponents: case aCheckPrograms: case aListOptions: @@ -253,6 +257,13 @@ if (gc_process_gpgconf_conf (NULL, 1, 1, NULL)) exit (1); break; + + case aListDirs: + /* Show the system configuration directory for gpgconf. */ + get_outfp (&outfp); + fprintf (outfp, "sysconfdir:%s\n", + gc_percent_escape (gnupg_sysconfdir ())); + break; } if (outfp && outfp != stdout) Modified: trunk/tools/gpgconf.h =================================================================== --- trunk/tools/gpgconf.h 2008-05-26 12:00:55 UTC (rev 4769) +++ trunk/tools/gpgconf.h 2008-05-26 13:43:20 UTC (rev 4770) @@ -37,6 +37,11 @@ /*-- gpgconf-comp.c --*/ +/* Percent-Escape special characters. The string is valid until the + next invocation of the function. */ +char *gc_percent_escape (const char *src); + + void gc_error (int status, int errnum, const char *fmt, ...); /* List all components that are available. */ From cvs at cvs.gnupg.org Mon May 26 17:05:32 2008 From: cvs at cvs.gnupg.org (svn author marcus) Date: Mon, 26 May 2008 17:05:32 +0200 Subject: [svn] GnuPG - r4771 - in trunk: doc tools Message-ID: Author: marcus Date: 2008-05-26 17:05:31 +0200 (Mon, 26 May 2008) New Revision: 4771 Modified: trunk/doc/ChangeLog trunk/tools/ChangeLog trunk/tools/gpgconf-comp.c Log: 2008-05-26 Marcus Brinkmann * gpgconf-comp.c: Replace pathname by filename everywhere. [The diff below has been truncated] Modified: trunk/doc/ChangeLog =================================================================== --- trunk/doc/ChangeLog 2008-05-26 13:43:20 UTC (rev 4770) +++ trunk/doc/ChangeLog 2008-05-26 15:05:31 UTC (rev 4771) @@ -1,4 +1,4 @@ -2008-05-26 Marcus Brinkmann +2008-05-26 Marcus Brinkmann * tools.texi (Invoking gpgconf): Document --list-dirs. Modified: trunk/tools/ChangeLog =================================================================== --- trunk/tools/ChangeLog 2008-05-26 13:43:20 UTC (rev 4770) +++ trunk/tools/ChangeLog 2008-05-26 15:05:31 UTC (rev 4771) @@ -1,5 +1,7 @@ -2008-05-26 Marcus Brinkmann +2008-05-26 Marcus Brinkmann + * gpgconf-comp.c: Replace pathname by filename everywhere. + * gpgconf.c (enum cmd_and_opt_values): Add aListDirs. (opts): Add aListDirs option. (main): Handle aListDirs. @@ -7,7 +9,7 @@ * gpgconf-comp.c (my_percent_escape): Make non-static and rename to ... (gc_percent_escape): ... this. Change all callers. - + 2008-05-26 Werner Koch * gpgconf-comp.c (gpg_agent_runtime_change) [W32]: Issue Modified: trunk/tools/gpgconf-comp.c =================================================================== --- trunk/tools/gpgconf-comp.c 2008-05-26 13:43:20 UTC (rev 4770) +++ trunk/tools/gpgconf-comp.c 2008-05-26 15:05:31 UTC (rev 4771) @@ -163,7 +163,7 @@ void (*runtime_change) (void); /* The option name for the configuration filename of this backend. - This must be an absolute pathname. It can be an option from a + This must be an absolute filename. It can be an option from a different backend (but then ordering of the options might matter). */ const char *option_config_filename; @@ -218,8 +218,8 @@ /* Complex argument types. */ - /* A complete pathname. */ - GC_ARG_TYPE_PATHNAME = 32, + /* A complete filename. */ + GC_ARG_TYPE_FILENAME = 32, /* An LDAP server in the format HOSTNAME:PORT:USERNAME:PASSWORD:BASE_DN. */ @@ -276,7 +276,7 @@ { GC_ARG_TYPE_NR, NULL }, { GC_ARG_TYPE_NR, NULL }, /* The complex argument types have a basic type as fallback. */ - { GC_ARG_TYPE_STRING, "pathname" }, + { GC_ARG_TYPE_STRING, "filename" }, { GC_ARG_TYPE_STRING, "ldap server" }, { GC_ARG_TYPE_STRING, "key fpr" }, { GC_ARG_TYPE_STRING, "pub key" }, @@ -460,7 +460,7 @@ { /* The configuration file to which we write the changes. */ { "gpgconf-gpg-agent.conf", GC_OPT_FLAG_NONE, GC_LEVEL_INTERNAL, - NULL, NULL, GC_ARG_TYPE_PATHNAME, GC_BACKEND_GPG_AGENT }, + NULL, NULL, GC_ARG_TYPE_FILENAME, GC_BACKEND_GPG_AGENT }, { "Monitor", GC_OPT_FLAG_GROUP, GC_LEVEL_BASIC, @@ -480,7 +480,7 @@ "gnupg", N_("Options controlling the configuration") }, { "options", GC_OPT_FLAG_NONE, GC_LEVEL_EXPERT, "gnupg", "|FILE|read options from FILE", - GC_ARG_TYPE_PATHNAME, GC_BACKEND_GPG_AGENT }, + GC_ARG_TYPE_FILENAME, GC_BACKEND_GPG_AGENT }, { "disable-scdaemon", GC_OPT_FLAG_NONE, GC_LEVEL_ADVANCED, "gnupg", "do not use the SCdaemon", GC_ARG_TYPE_NONE, GC_BACKEND_GPG_AGENT }, @@ -493,7 +493,7 @@ GC_ARG_TYPE_STRING, GC_BACKEND_GPG_AGENT }, { "log-file", GC_OPT_FLAG_RUNTIME, GC_LEVEL_ADVANCED, "gnupg", N_("|FILE|write server mode logs to FILE"), - GC_ARG_TYPE_PATHNAME, GC_BACKEND_GPG_AGENT }, + GC_ARG_TYPE_FILENAME, GC_BACKEND_GPG_AGENT }, { "faked-system-time", GC_OPT_FLAG_NONE, GC_LEVEL_INVISIBLE, NULL, NULL, GC_ARG_TYPE_UINT32, GC_BACKEND_GPG_AGENT }, @@ -545,7 +545,7 @@ { "check-passphrase-pattern", GC_OPT_FLAG_RUNTIME, GC_LEVEL_EXPERT, "gnupg", N_("|FILE|check new passphrases against pattern in FILE"), - GC_ARG_TYPE_PATHNAME, GC_BACKEND_GPG_AGENT }, + GC_ARG_TYPE_FILENAME, GC_BACKEND_GPG_AGENT }, { "max-passphrase-days", GC_OPT_FLAG_RUNTIME, GC_LEVEL_EXPERT, "gnupg", N_("|N|expire the passphrase after N days"), @@ -564,7 +564,7 @@ { /* The configuration file to which we write the changes. */ { "gpgconf-scdaemon.conf", GC_OPT_FLAG_NONE, GC_LEVEL_INTERNAL, - NULL, NULL, GC_ARG_TYPE_PATHNAME, GC_BACKEND_SCDAEMON }, + NULL, NULL, GC_ARG_TYPE_FILENAME, GC_BACKEND_SCDAEMON }, { "Monitor", GC_OPT_FLAG_GROUP, GC_LEVEL_BASIC, @@ -584,7 +584,7 @@ "gnupg", N_("Options controlling the configuration") }, { "options", GC_OPT_FLAG_NONE, GC_LEVEL_EXPERT, "gnupg", "|FILE|read options from FILE", - GC_ARG_TYPE_PATHNAME, GC_BACKEND_SCDAEMON }, + GC_ARG_TYPE_FILENAME, GC_BACKEND_SCDAEMON }, { "reader-port", GC_OPT_FLAG_NONE, GC_LEVEL_BASIC, "gnupg", "|N|connect to reader at port N", GC_ARG_TYPE_STRING, GC_BACKEND_SCDAEMON }, @@ -612,7 +612,7 @@ GC_ARG_TYPE_STRING, GC_BACKEND_SCDAEMON }, { "log-file", GC_OPT_FLAG_NONE, GC_LEVEL_ADVANCED, "gnupg", N_("|FILE|write server mode logs to FILE"), - GC_ARG_TYPE_PATHNAME, GC_BACKEND_SCDAEMON }, + GC_ARG_TYPE_FILENAME, GC_BACKEND_SCDAEMON }, { "Security", GC_OPT_FLAG_GROUP, GC_LEVEL_BASIC, @@ -631,7 +631,7 @@ { /* The configuration file to which we write the changes. */ { "gpgconf-gpg.conf", GC_OPT_FLAG_NONE, GC_LEVEL_INTERNAL, - NULL, NULL, GC_ARG_TYPE_PATHNAME, GC_BACKEND_GPG }, + NULL, NULL, GC_ARG_TYPE_FILENAME, GC_BACKEND_GPG }, { "Monitor", GC_OPT_FLAG_GROUP, GC_LEVEL_BASIC, @@ -657,7 +657,7 @@ GC_ARG_TYPE_STRING, GC_BACKEND_GPG }, { "options", GC_OPT_FLAG_NONE, GC_LEVEL_EXPERT, "gnupg", "|FILE|read options from FILE", - GC_ARG_TYPE_PATHNAME, GC_BACKEND_GPG }, + GC_ARG_TYPE_FILENAME, GC_BACKEND_GPG }, { "Debug", GC_OPT_FLAG_GROUP, GC_LEVEL_ADVANCED, @@ -667,7 +667,7 @@ GC_ARG_TYPE_STRING, GC_BACKEND_GPG }, { "log-file", GC_OPT_FLAG_NONE, GC_LEVEL_ADVANCED, "gnupg", N_("|FILE|write server mode logs to FILE"), - GC_ARG_TYPE_PATHNAME, GC_BACKEND_GPG }, + GC_ARG_TYPE_FILENAME, GC_BACKEND_GPG }, /* { "faked-system-time", GC_OPT_FLAG_NONE, GC_LEVEL_INVISIBLE, */ /* NULL, NULL, */ /* GC_ARG_TYPE_UINT32, GC_BACKEND_GPG }, */ @@ -696,7 +696,7 @@ { /* The configuration file to which we write the changes. */ { "gpgconf-gpgsm.conf", GC_OPT_FLAG_NONE, GC_LEVEL_INTERNAL, - NULL, NULL, GC_ARG_TYPE_PATHNAME, GC_BACKEND_GPGSM }, + NULL, NULL, GC_ARG_TYPE_FILENAME, GC_BACKEND_GPGSM }, { "Monitor", GC_OPT_FLAG_GROUP, GC_LEVEL_BASIC, @@ -722,7 +722,7 @@ GC_ARG_TYPE_STRING, GC_BACKEND_GPGSM }, { "options", GC_OPT_FLAG_NONE, GC_LEVEL_EXPERT, "gnupg", "|FILE|read options from FILE", - GC_ARG_TYPE_PATHNAME, GC_BACKEND_GPGSM }, + GC_ARG_TYPE_FILENAME, GC_BACKEND_GPGSM }, { "prefer-system-dirmngr", GC_OPT_FLAG_NONE, GC_LEVEL_ADVANCED, "gnupg", "use system's dirmngr if available", GC_ARG_TYPE_NONE, GC_BACKEND_GPGSM }, @@ -741,7 +741,7 @@ GC_ARG_TYPE_STRING, GC_BACKEND_GPGSM }, { "log-file", GC_OPT_FLAG_NONE, GC_LEVEL_ADVANCED, "gnupg", N_("|FILE|write server mode logs to FILE"), - GC_ARG_TYPE_PATHNAME, GC_BACKEND_GPGSM }, + GC_ARG_TYPE_FILENAME, GC_BACKEND_GPGSM }, { "faked-system-time", GC_OPT_FLAG_NONE, GC_LEVEL_INVISIBLE, NULL, NULL, GC_ARG_TYPE_UINT32, GC_BACKEND_GPGSM }, @@ -780,7 +780,7 @@ { /* The configuration file to which we write the changes. */ { "gpgconf-dirmngr.conf", GC_OPT_FLAG_NONE, GC_LEVEL_INTERNAL, - NULL, NULL, GC_ARG_TYPE_PATHNAME, GC_BACKEND_DIRMNGR }, + NULL, NULL, GC_ARG_TYPE_FILENAME, GC_BACKEND_DIRMNGR }, { "Monitor", GC_OPT_FLAG_GROUP, GC_LEVEL_BASIC, @@ -810,7 +810,7 @@ "gnupg", N_("Options controlling the configuration") }, { "options", GC_OPT_FLAG_NONE, GC_LEVEL_EXPERT, "dirmngr", "|FILE|read options from FILE", - GC_ARG_TYPE_PATHNAME, GC_BACKEND_DIRMNGR }, + GC_ARG_TYPE_FILENAME, GC_BACKEND_DIRMNGR }, { "Debug", GC_OPT_FLAG_GROUP, GC_LEVEL_ADVANCED, @@ -823,7 +823,7 @@ GC_ARG_TYPE_NONE, GC_BACKEND_DIRMNGR }, { "log-file", GC_OPT_FLAG_NONE, GC_LEVEL_ADVANCED, "dirmngr", N_("|FILE|write server mode logs to FILE"), - GC_ARG_TYPE_PATHNAME, GC_BACKEND_DIRMNGR }, + GC_ARG_TYPE_FILENAME, GC_BACKEND_DIRMNGR }, { "debug-wait", GC_OPT_FLAG_NONE, GC_LEVEL_INVISIBLE, NULL, NULL, GC_ARG_TYPE_UINT32, GC_BACKEND_DIRMNGR }, @@ -883,7 +883,7 @@ { "ldapserverlist-file", GC_OPT_FLAG_NONE, GC_LEVEL_INTERNAL, "dirmngr", "|FILE|read LDAP server list from FILE", - GC_ARG_TYPE_PATHNAME, GC_BACKEND_DIRMNGR }, + GC_ARG_TYPE_FILENAME, GC_BACKEND_DIRMNGR }, /* This entry must come after at least one entry for GC_BACKEND_DIRMNGR in this component, so that the entry for "ldapserverlist-file will be initialized before this one. */ @@ -1673,16 +1673,16 @@ } -/* Determine the configuration pathname for the component COMPONENT +/* Determine the configuration filename for the component COMPONENT and backend BACKEND. */ static char * -get_config_pathname (gc_component_t component, gc_backend_t backend) +get_config_filename (gc_component_t component, gc_backend_t backend) { - char *pathname = NULL; + char *filename = NULL; gc_option_t *option = find_option (component, gc_backend[backend].option_config_filename, GC_BACKEND_ANY); assert (option); - assert (option->arg_type == GC_ARG_TYPE_PATHNAME); + assert (option->arg_type == GC_ARG_TYPE_FILENAME); assert (!(option->flags & GC_OPT_FLAG_LIST)); if (!option->active || !option->default_value) @@ -1691,24 +1691,24 @@ gc_backend[backend].name); if (option->value && *option->value) - pathname = percent_deescape (&option->value[1]); + filename = percent_deescape (&option->value[1]); else if (option->default_value && *option->default_value) - pathname = percent_deescape (&option->default_value[1]); + filename = percent_deescape (&option->default_value[1]); else - pathname = ""; + filename = ""; #ifdef HAVE_DOSISH_SYSTEM - if (!(pathname[0] - && pathname[1] == ':' - && (pathname[2] == '/' || pathname[2] == '\\'))) + if (!(filename[0] + && filename[1] == ':' + && (filename[2] == '/' || filename[2] == '\\'))) #else - if (pathname[0] != '/') + if (filename[0] != '/') #endif gc_error (1, 0, "Option %s, needed by backend %s, is not absolute", gc_backend[backend].option_config_filename, gc_backend[backend].name); - return pathname; + return filename; } @@ -1727,7 +1727,7 @@ size_t line_len = 0; ssize_t length; FILE *config; - char *config_pathname; + char *config_filename; err = gnupg_create_inbound_pipe (filedes); if (err) @@ -1833,12 +1833,12 @@ /* At this point, we can parse the configuration file. */ - config_pathname = get_config_pathname (component, backend); + config_filename = get_config_filename (component, backend); - config = fopen (config_pathname, "r"); + config = fopen (config_filename, "r"); if (!config) gc_error (0, errno, "warning: can not open config file %s", - config_pathname); + config_filename); else { while ((length = read_line (config, &line, &line_len, NULL)) > 0) @@ -1923,9 +1923,9 @@ } if (length < 0 || ferror (config)) - gc_error (1, errno, "error reading from %s", config_pathname); + gc_error (1, errno, "error reading from %s", config_filename); if (fclose (config) && ferror (config)) - gc_error (1, errno, "error closing %s", config_pathname); + gc_error (1, errno, "error closing %s", config_filename); } xfree (line); @@ -1938,7 +1938,7 @@ retrieve_options_from_file (gc_component_t component, gc_backend_t backend) { gc_option_t *list_option; - char *list_pathname; + char *list_filename; FILE *list_file; char *line = NULL; size_t line_len = 0; @@ -1950,10 +1950,10 @@ assert (list_option); assert (!list_option->active); - list_pathname = get_config_pathname (component, backend); - list_file = fopen (list_pathname, "r"); + list_filename = get_config_filename (component, backend); + list_file = fopen (list_filename, "r"); if (!list_file) - gc_error (0, errno, "warning: can not open list file %s", list_pathname); + gc_error (0, errno, "warning: can not open list file %s", list_filename); else { @@ -1991,14 +1991,14 @@ list = xasprintf ("\"%s", gc_percent_escape (start)); } if (length < 0 || ferror (list_file)) - gc_error (1, errno, "can not read list file %s", list_pathname); + gc_error (1, errno, "can not read list file %s", list_filename); } list_option->active = 1; list_option->value = list; if (list_file && fclose (list_file) && ferror (list_file)) - gc_error (1, errno, "error closing %s", list_pathname); + gc_error (1, errno, "error closing %s", list_filename); xfree (line); } @@ -2259,9 +2259,9 @@ assert (gc_arg_type[option->arg_type].fallback != GC_ARG_TYPE_NONE); /* FIXME. Throughout the function, do better error reporting. */ - /* Note that get_config_pathname() calls percent_deescape(), so we + /* Note that get_config_filename() calls percent_deescape(), so we call this before processing the arguments. */ - dest_filename = xstrdup (get_config_pathname (component, backend)); + dest_filename = xstrdup (get_config_filename (component, backend)); src_filename = xasprintf ("%s.gpgconf.%i.new", dest_filename, getpid ()); orig_filename = xasprintf ("%s.gpgconf.%i.bak", dest_filename, getpid ()); @@ -2553,7 +2553,7 @@ int utf8strings_seen = 0; /* FIXME. Throughout the function, do better error reporting. */ - dest_filename = xstrdup (get_config_pathname (component, backend)); + dest_filename = xstrdup (get_config_filename (component, backend)); src_filename = xasprintf ("%s.gpgconf.%i.new", dest_filename, getpid ()); orig_filename = xasprintf ("%s.gpgconf.%i.bak", dest_filename, getpid ()); @@ -2874,9 +2874,9 @@ { int err = 0; int runtime[GC_BACKEND_NR]; - char *src_pathname[GC_BACKEND_NR]; - char *dest_pathname[GC_BACKEND_NR]; - char *orig_pathname[GC_BACKEND_NR]; + char *src_filename[GC_BACKEND_NR]; + char *dest_filename[GC_BACKEND_NR]; + char *orig_filename[GC_BACKEND_NR]; gc_backend_t backend; gc_option_t *option; char *line = NULL; @@ -2886,9 +2886,9 @@ for (backend = 0; backend < GC_BACKEND_NR; backend++) { runtime[backend] = 0; - src_pathname[backend] = NULL; - dest_pathname[backend] = NULL; - orig_pathname[backend] = NULL; + src_filename[backend] = NULL; + dest_filename[backend] = NULL; + orig_filename[backend] = NULL; } if (in) @@ -2966,7 +2966,7 @@ { /* Go on if we have already seen this backend, or if there is nothing to do. */ - if (src_pathname[option->backend] + if (src_filename[option->backend] || !(option->new_flags || option->new_value)) { option++; @@ -2976,14 +2976,14 @@ if (gc_backend[option->backend].program) { err = change_options_program (component, option->backend, - &src_pathname[option->backend], - &dest_pathname[option->backend], - &orig_pathname[option->backend]); + &src_filename[option->backend], + &dest_filename[option->backend], + &orig_filename[option->backend]); if (! err) { /* External verification. */ err = gc_component_check_options (component, out, - src_pathname[option->backend]); + src_filename[option->backend]); if (err) { gc_error (0, 0, @@ -2996,9 +2996,9 @@ } else err = change_options_file (component, option->backend, - &src_pathname[option->backend], - &dest_pathname[option->backend], - &orig_pathname[option->backend]); + &src_filename[option->backend], + &dest_filename[option->backend], + &orig_filename[option->backend]); if (err) break; @@ -3012,39 +3012,39 @@ for (i = 0; i < GC_BACKEND_NR; i++) { - if (src_pathname[i]) + if (src_filename[i]) { /* FIXME: Make a verification here. */ - assert (dest_pathname[i]); + assert (dest_filename[i]); - if (orig_pathname[i]) + if (orig_filename[i]) { #ifdef HAVE_W32_SYSTEM /* There is no atomic update on W32. */ - err = unlink (dest_pathname[i]); + err = unlink (dest_filename[i]); #endif /* HAVE_W32_SYSTEM */ if (!err) - err = rename (src_pathname[i], dest_pathname[i]); + err = rename (src_filename[i], dest_filename[i]); } else { #ifdef HAVE_W32_SYSTEM /* We skip the unlink if we expect the file not to be there. */ - err = rename (src_pathname[i], dest_pathname[i]); + err = rename (src_filename[i], dest_filename[i]); #else /* HAVE_W32_SYSTEM */ /* This is a bit safer than rename() because we - expect DEST_PATHNAME not to be there. If it + expect DEST_FILENAME not to be there. If it happens to be there, this will fail. */ - err = link (src_pathname[i], dest_pathname[i]); + err = link (src_filename[i], dest_filename[i]); if (!err) - err = unlink (src_pathname[i]); + err = unlink (src_filename[i]); #endif /* !HAVE_W32_SYSTEM */ } if (err) break; - src_pathname[i] = NULL; + src_filename[i] = NULL; } } } @@ -3057,12 +3057,12 @@ /* An error occured or a dry-run is requested. */ for (i = 0; i < GC_BACKEND_NR; i++) { - if (src_pathname[i]) + if (src_filename[i]) { /* The change was not yet committed. */ - unlink (src_pathname[i]); - if (orig_pathname[i]) - unlink (orig_pathname[i]); + unlink (src_filename[i]); + if (orig_filename[i]) + unlink (orig_filename[i]); } else { @@ -3070,16 +3070,16 @@ tad dangerous, as we don't know if we don't overwrite a version of the file that is even newer than the one we just installed. */ - if (orig_pathname[i]) + if (orig_filename[i]) { #ifdef HAVE_W32_SYSTEM /* There is no atomic update on W32. */ - unlink (dest_pathname[i]); + unlink (dest_filename[i]); #endif /* HAVE_W32_SYSTEM */ - rename (orig_pathname[i], dest_pathname[i]); + rename (orig_filename[i], dest_filename[i]); } else - unlink (dest_pathname[i]); + unlink (dest_filename[i]); } } if (err) @@ -3099,19 +3099,19 @@ /* Move the per-process backup file into its place. */ for (backend = 0; backend < GC_BACKEND_NR; backend++) - if (orig_pathname[backend]) + if (orig_filename[backend]) { From cvs at cvs.gnupg.org Mon May 26 17:07:05 2008 From: cvs at cvs.gnupg.org (svn author marcus) Date: Mon, 26 May 2008 17:07:05 +0200 Subject: [svn] dirmngr - r299 - trunk/src Message-ID: Author: marcus Date: 2008-05-26 17:07:04 +0200 (Mon, 26 May 2008) New Revision: 299 Modified: trunk/src/ChangeLog trunk/src/dirmngr.c Log: 2008-05-26 Marcus Brinkmann * dirmngr.c (main) [HAVE_W32_SYSTEM]: Switch to system configuration on gpgconf related commands, and make all options unchangeable. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2008-03-25 03:47:41 UTC (rev 298) +++ trunk/src/ChangeLog 2008-05-26 15:07:04 UTC (rev 299) @@ -1,3 +1,9 @@ +2008-05-26 Marcus Brinkmann + + * dirmngr.c (main) [HAVE_W32_SYSTEM]: Switch to system + configuration on gpgconf related commands, and make all options + unchangeable. + 2008-03-25 Marcus Brinkmann * dirmngr_ldap.c (print_ldap_entries): Add code alternative for Modified: trunk/src/dirmngr.c =================================================================== --- trunk/src/dirmngr.c 2008-03-25 03:47:41 UTC (rev 298) +++ trunk/src/dirmngr.c 2008-05-26 15:07:04 UTC (rev 299) @@ -694,6 +694,14 @@ opt.system_service = 1; opt.system_daemon = 1; } +#ifdef HAVE_W32_SYSTEM + else if (pargs.r_opt == aGPGConfList || pargs.r_opt == aGPGConfTest) + /* We set this so we switch to the system configuration + directory below. This is a crutch to solve the problem + that the user configuration is never used on Windows. Also + see below at aGPGConfList. */ + opt.system_daemon = 1; +#endif } /* If --daemon has been given on the command line but not --homedir, @@ -1142,6 +1150,7 @@ dirmngr_exit (0); else if (cmd == aGPGConfList) { + unsigned long flags = 0; char *filename; char *filename_esc; @@ -1160,7 +1169,17 @@ /* The NO_ARG_DESC flag for an option indicates that the argument has a default, which is described by the value of the ARGDEF field. */ #define GC_OPT_FLAG_NO_ARG_DESC (1UL << 6) +#define GC_OPT_FLAG_NO_CHANGE (1UL <<7) +#ifdef HAVE_W32_SYSTEM + /* On Windows systems, dirmngr always runs as system daemon, and + the per-user configuration is never used. So we short-cut + everything to use the global system configuration of dirmngr + above, and here we set the no change flag to make these + read-only. */ + flags |= GC_OPT_FLAG_NO_CHANGE; +#endif + /* First the configuration file. This is not an option, but it is vital information for GPG Conf. */ if (!opt.config_filename) @@ -1172,11 +1191,11 @@ GC_OPT_FLAG_DEFAULT, filename); xfree (filename); - printf ("verbose:%lu:\n", GC_OPT_FLAG_NONE); - printf ("quiet:%lu:\n", GC_OPT_FLAG_NONE); - printf ("debug-level:%lu:\"none\n", GC_OPT_FLAG_DEFAULT); - printf ("log-file:%lu:\n", GC_OPT_FLAG_NONE); - printf ("force:%lu:\n", GC_OPT_FLAG_NONE); + printf ("verbose:%lu:\n", flags | GC_OPT_FLAG_NONE); + printf ("quiet:%lu:\n", flags | GC_OPT_FLAG_NONE); + printf ("debug-level:%lu:\"none\n", flags | GC_OPT_FLAG_DEFAULT); + printf ("log-file:%lu:\n", flags | GC_OPT_FLAG_NONE); + printf ("force:%lu:\n", flags | GC_OPT_FLAG_NONE); /* --csh and --sh are mutually exclusive, something we can not express in GPG Conf. --options is only usable from the @@ -1195,28 +1214,28 @@ xfree (filename); printf ("ldaptimeout:%lu:%u\n", - GC_OPT_FLAG_DEFAULT, DEFAULT_LDAP_TIMEOUT); + flags | GC_OPT_FLAG_DEFAULT, DEFAULT_LDAP_TIMEOUT); printf ("max-replies:%lu:%u\n", - GC_OPT_FLAG_DEFAULT, DEFAULT_MAX_REPLIES); - printf ("allow-ocsp:%lu:\n", GC_OPT_FLAG_NONE); - printf ("ocsp-responder:%lu:\n", GC_OPT_FLAG_NONE); - printf ("ocsp-signer:%lu:\n", GC_OPT_FLAG_NONE); + flags | GC_OPT_FLAG_DEFAULT, DEFAULT_MAX_REPLIES); + printf ("allow-ocsp:%lu:\n", flags | GC_OPT_FLAG_NONE); + printf ("ocsp-responder:%lu:\n", flags | GC_OPT_FLAG_NONE); + printf ("ocsp-signer:%lu:\n", flags | GC_OPT_FLAG_NONE); - printf ("faked-system-time:%lu:\n", GC_OPT_FLAG_NONE); - printf ("no-greeting:%lu:\n", GC_OPT_FLAG_NONE); + printf ("faked-system-time:%lu:\n", flags | GC_OPT_FLAG_NONE); + printf ("no-greeting:%lu:\n", flags | GC_OPT_FLAG_NONE); - printf ("disable-http:%lu:\n", GC_OPT_FLAG_NONE); - printf ("disable-ldap:%lu:\n", GC_OPT_FLAG_NONE); - printf ("honor-http-proxy:%lu\n", GC_OPT_FLAG_NONE); - printf ("http-proxy:%lu:\n", GC_OPT_FLAG_NONE); - printf ("ldap-proxy:%lu:\n", GC_OPT_FLAG_NONE); - printf ("only-ldap-proxy:%lu:\n", GC_OPT_FLAG_NONE); - printf ("ignore-ldap-dp:%lu:\n", GC_OPT_FLAG_NONE); - printf ("ignore-http-dp:%lu:\n", GC_OPT_FLAG_NONE); - printf ("ignore-ocsp-service-url:%lu:\n", GC_OPT_FLAG_NONE); + printf ("disable-http:%lu:\n", flags | GC_OPT_FLAG_NONE); + printf ("disable-ldap:%lu:\n", flags | GC_OPT_FLAG_NONE); + printf ("honor-http-proxy:%lu\n", flags | GC_OPT_FLAG_NONE); + printf ("http-proxy:%lu:\n", flags | GC_OPT_FLAG_NONE); + printf ("ldap-proxy:%lu:\n", flags | GC_OPT_FLAG_NONE); + printf ("only-ldap-proxy:%lu:\n", flags | GC_OPT_FLAG_NONE); + printf ("ignore-ldap-dp:%lu:\n", flags | GC_OPT_FLAG_NONE); + printf ("ignore-http-dp:%lu:\n", flags | GC_OPT_FLAG_NONE); + printf ("ignore-ocsp-service-url:%lu:\n", flags | GC_OPT_FLAG_NONE); /* Note: The next one is to fix a typo in gpgconf - should be removed eventually. */ - printf ("ignore-ocsp-servic-url:%lu:\n", GC_OPT_FLAG_NONE); + printf ("ignore-ocsp-servic-url:%lu:\n", flags | GC_OPT_FLAG_NONE); } cleanup (); return !!rc; From cvs at cvs.gnupg.org Mon May 26 18:48:06 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Mon, 26 May 2008 18:48:06 +0200 Subject: [svn] GnuPG - r4772 - trunk/doc Message-ID: Author: wk Date: 2008-05-26 18:48:05 +0200 (Mon, 26 May 2008) New Revision: 4772 Modified: trunk/doc/ChangeLog trunk/doc/gpgv.texi trunk/doc/opt-homedir.texi trunk/doc/tools.texi Log: Minor bug fixes and document new gpg-connect-feature. Modified: trunk/doc/ChangeLog =================================================================== --- trunk/doc/ChangeLog 2008-05-26 15:05:31 UTC (rev 4771) +++ trunk/doc/ChangeLog 2008-05-26 16:48:05 UTC (rev 4772) @@ -1,3 +1,9 @@ +2008-05-26 Werner Koch + + * gpgv.texi: Minor fixes. Fixes bug#918. + + * opt-homedir.texi: Typo fixes. Fixes bug#917. + 2008-05-26 Marcus Brinkmann * tools.texi (Invoking gpgconf): Document --list-dirs. Modified: trunk/doc/gpgv.texi =================================================================== --- trunk/doc/gpgv.texi 2008-05-26 15:05:31 UTC (rev 4771) +++ trunk/doc/gpgv.texi 2008-05-26 16:48:05 UTC (rev 4772) @@ -55,8 +55,8 @@ @mansect description @code{@gpgvname} is an OpenPGP signature verification tool. -This program is actually a stripped down version of @code{gpg} which is -only able to check signatures. It is somewhat smaller than the fully blown +This program is actually a stripped-down version of @code{gpg} which is +only able to check signatures. It is somewhat smaller than the fully-blown @code{gpg} and uses a different (and simpler) way to check that the public keys used to make the signature are valid. There are no configuration files and only a few options are implemented. @@ -114,7 +114,7 @@ @mansect return value -The program returns 0 if everything was fine, 1 if at least +The program returns 0 if everything is fine, 1 if at least one signature was bad, and other error codes for fatal errors. @mansect examples @@ -126,7 +126,7 @@ @itemx @gpgvname @code{sigfile} Verify the signature of the file. The second form is used for detached signatures, where @code{sigfile} is the detached -signature (either ASCII armored or binary) and are the signed +signature (either ASCII-armored or binary) and are the signed data; if this is not given the name of the file holding the signed data is constructed by cutting off the extension (".asc", ".sig" or ".sign") from @code{sigfile}. @@ -152,7 +152,7 @@ @table @asis @item ~/.gnupg/trustedkeys.gpg -The default keyring with the allowed keys +The default keyring with the allowed keys. @end table Modified: trunk/doc/opt-homedir.texi =================================================================== --- trunk/doc/opt-homedir.texi 2008-05-26 15:05:31 UTC (rev 4771) +++ trunk/doc/opt-homedir.texi 2008-05-26 16:48:05 UTC (rev 4772) @@ -1,10 +1,10 @@ @c This option is included at several places. @item --homedir @var{dir} @opindex homedir -Set the name of the home directory to @var{dir}. If his option is not +Set the name of the home directory to @var{dir}. If this option is not used, the home directory defaults to @file{~/.gnupg}. It is only recognized when given on the command line. It also overrides any home directory stated through the environment variable @env{GNUPGHOME} or -(on W32 systems) by means on the Registry entry +(on W32 systems) by means of the Registry entry @var{HKCU\Software\GNU\GnuPG:HomeDir}. Modified: trunk/doc/tools.texi =================================================================== --- trunk/doc/tools.texi 2008-05-26 15:05:31 UTC (rev 4771) +++ trunk/doc/tools.texi 2008-05-26 16:48:05 UTC (rev 4772) @@ -1069,7 +1069,7 @@ @mansect synopsis @ifset manverb .B gpg-connect-agent -.RI [ options ] +.RI [ options ] [commands] @end ifset @mansect description @@ -1095,7 +1095,7 @@ @command{gpg-connect-agent} is invoked this way: @example -gpg-connect-agent [options] +gpg-connect-agent [options] [commands] @end example @mancont @@ -1132,8 +1132,8 @@ @smallexample gpg-connect-agent --exec gpgsm --server @end smallexample +Note that you may not use options on the command line in this case. - @item --no-ext-connect @opindex no-ext-connect When using @option{-S} or @option{--exec}, @command{gpg-connect-agent} @@ -1143,7 +1143,8 @@ @item --run @var{file} @opindex run Run the commands from @var{file} at startup and then continue with the -regular input method. +regular input method. Note, that commands given on the command line are +executed after this file. @item -s @itemx --subst @@ -1180,7 +1181,7 @@ substituted on the input if the @command{/subst} has been used. Variables are referenced by prefixing the name with a dollr sign and optionally include the name in curly braces. The rules for a valid name -are idnetically to those of the standard bourne shell. This is not yet +are identically to those of the standard bourne shell. This is not yet enforced but may be in the future. When used with curly braces no leading or trailing white space is allowed. From cvs at cvs.gnupg.org Tue May 27 13:45:45 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue, 27 May 2008 13:45:45 +0200 Subject: [svn] assuan - r287 - in trunk: . doc Message-ID: Author: wk Date: 2008-05-27 13:45:44 +0200 (Tue, 27 May 2008) New Revision: 287 Added: trunk/doc/README.apichanges Modified: trunk/NEWS trunk/configure.ac trunk/doc/Makefile.am Log: Get ready for the envisioned API changes Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2008-05-25 08:49:00 UTC (rev 286) +++ trunk/NEWS 2008-05-27 11:45:44 UTC (rev 287) @@ -1,3 +1,11 @@ +Noteworthy changes in version 1.1.0 +------------------------------------------------ + + * API change: See doc/README.apichanges. + + * Now using libtool and builds a DSO. + + Noteworthy changes in version 1.0.5 (2008-05-25) ------------------------------------------------ Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2008-05-25 08:49:00 UTC (rev 286) +++ trunk/configure.ac 2008-05-27 11:45:44 UTC (rev 287) @@ -24,8 +24,8 @@ # Remember to change the version number immediately *after* a release. # Set my_issvn to "yes" for non-released code. Remember to run an # "svn up" and "autogen.sh" right before creating a distribution. -m4_define([my_version], [1.0.5]) -m4_define([my_issvn], [no]) +m4_define([my_version], [1.1.0]) +m4_define([my_issvn], [yes]) m4_define([svn_revision], m4_esyscmd([echo -n $( (svn info 2>/dev/null \ || echo 'Revision: 0')|sed -n '/^Revision:/ {s/[^0-9]//gp;q;}')])) Modified: trunk/doc/Makefile.am =================================================================== --- trunk/doc/Makefile.am 2008-05-25 08:49:00 UTC (rev 286) +++ trunk/doc/Makefile.am 2008-05-27 11:45:44 UTC (rev 287) @@ -18,6 +18,8 @@ ## Process this file with automake to produce Makefile.in +EXTRA_DIST = README.apichanges + info_TEXINFOS = assuan.texi assuan_TEXINFOS = lgpl.texi gpl.texi Added: trunk/doc/README.apichanges =================================================================== --- trunk/doc/README.apichanges 2008-05-25 08:49:00 UTC (rev 286) +++ trunk/doc/README.apichanges 2008-05-27 11:45:44 UTC (rev 287) @@ -0,0 +1,11 @@ +README.apichanges -*- text -*- + +API changes between 1.0.5 and 1.1.0: +==================================== + +While allowing to build libassuan as a DSO we decided to clean up the +API. The changes are straightforward and it should obnly take a few +minutes to fix your code. + + TODO. + From cvs at cvs.gnupg.org Tue May 27 13:46:16 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue, 27 May 2008 13:46:16 +0200 Subject: [svn] gcry - r1291 - trunk/doc Message-ID: Author: wk Date: 2008-05-27 13:46:15 +0200 (Tue, 27 May 2008) New Revision: 1291 Added: trunk/doc/announce-1.4.txt trunk/doc/announce.txt Log: Add announce files. From cvs at cvs.gnupg.org Tue May 27 13:51:44 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue, 27 May 2008 13:51:44 +0200 Subject: [svn] w32pth - r25 - trunk Message-ID: Author: wk Date: 2008-05-27 13:51:42 +0200 (Tue, 27 May 2008) New Revision: 25 Modified: trunk/ChangeLog trunk/NEWS trunk/libw32pth.def trunk/pth.h trunk/w32-io.c trunk/w32-io.h trunk/w32-pth.c Log: New funtion pth_thread_id. Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-03-25 03:45:46 UTC (rev 24) +++ trunk/ChangeLog 2008-05-27 11:51:42 UTC (rev 25) @@ -1,3 +1,17 @@ +2008-05-27 Werner Koch + + * w32-pth.c (_pth_malloc, _pth_calloc, _pth_free): New. Always + use these wrappers to be prepared to change the allocators. + +2008-05-26 Werner Koch + + * w32-io.c (_pth_debug): Print tick, process and thread id. + * w32-pth.c (enter_pth, leave_pth): Use debug function. + + * w32-pth.c (pth_thread_id): New. + + * libw32pth.def (pth_thread_id): New. + 2008-03-25 Marcus Brinkmann * debug.h (DEBUG_INFO, DEBUG_CALLS): New macros. @@ -53,6 +67,13 @@ about remaining issues. (do_pth_event_body): Fix type in va_arg invocation. +2007-11-20 Werner Koch + + * pth.h (PTH_EVENT_HANDLE): New. + * w32-pth.c (struct pth_event_s): Add HANDLE. + (do_pth_event_body, do_pth_wait): Implement handle event. + (do_pth_event_free): Do not close HD for a handle event. + 2007-08-16 Werner Koch Released 2.0.1. Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2008-03-25 03:45:46 UTC (rev 24) +++ trunk/NEWS 2008-05-27 11:51:42 UTC (rev 25) @@ -11,6 +11,9 @@ * Bug fixes. + * New non-standard fucntion pth_thread_id. + + Noteworthy changes in version 2.0.1 (2007-08-16) ------------------------------------------------ Modified: trunk/libw32pth.def =================================================================== --- trunk/libw32pth.def 2008-03-25 03:45:46 UTC (rev 24) +++ trunk/libw32pth.def 2008-05-27 11:51:42 UTC (rev 25) @@ -72,3 +72,4 @@ pth_mutex_destroy @41 pth_usleep @42 + pth_thread_id @43 Modified: trunk/pth.h =================================================================== --- trunk/pth.h 2008-03-25 03:45:46 UTC (rev 24) +++ trunk/pth.h 2008-05-27 11:51:42 UTC (rev 25) @@ -280,7 +280,12 @@ int pth_yield (pth_t tid); +/* Special W32 function to cope with the problem that pth_self returns + just a pseudo handle which is not very usefule for debugging. */ +unsigned long pth_thread_id (void); +#define PTH_HAVE_PTH_THREAD_ID 1 + /*-- pth_util.c --*/ /* void sigemptyset (struct sigset_s * ss); */ Modified: trunk/w32-io.c =================================================================== --- trunk/w32-io.c 2008-03-25 03:45:46 UTC (rev 24) +++ trunk/w32-io.c 2008-05-27 11:51:42 UTC (rev 25) @@ -103,7 +103,7 @@ return; } /* now init it */ - mp = malloc ( sizeof *mp ); + mp = _pth_malloc ( sizeof *mp ); if (!mp) { LeaveCriticalSection (&init_lock); sema_fatal ("out of core while creating critical section lock"); @@ -143,7 +143,7 @@ { if (s && s->priv) { DeleteCriticalSection ((CRITICAL_SECTION*)s->priv); - free (s->priv); + _pth_free (s->priv); s->priv = NULL; } } @@ -167,6 +167,10 @@ va_start (arg_ptr, format); LOCK (debug_lock); + fprintf (dbgfp, "%05lu/%lu.%lu/libw32pth: ", + ((unsigned long)GetTickCount () % 100000), + (unsigned long)GetCurrentProcessId (), + (unsigned long)GetCurrentThreadId ()); vfprintf (dbgfp, format, arg_ptr); va_end (arg_ptr); if(format && *format && format[strlen (format) - 1] != '\n') @@ -380,7 +384,7 @@ sec_attr.nLength = sizeof sec_attr; sec_attr.bInheritHandle = FALSE; - ctx = calloc (1, sizeof *ctx); + ctx = _pth_calloc (1, sizeof *ctx); if (!ctx) { TRACE_SYSERR (errno); @@ -403,7 +407,7 @@ CloseHandle (ctx->have_space_ev); if (ctx->stopped) CloseHandle (ctx->stopped); - free (ctx); + _pth_free (ctx); /* FIXME: Translate the error code. */ TRACE_SYSERR (EIO); return NULL; @@ -423,7 +427,7 @@ CloseHandle (ctx->have_space_ev); if (ctx->stopped) CloseHandle (ctx->stopped); - free (ctx); + _pth_free (ctx); TRACE_SYSERR (EIO); return NULL; } @@ -469,7 +473,7 @@ CloseHandle (ctx->have_space_ev); CloseHandle (ctx->thread_hd); DESTROY_LOCK (ctx->mutex); - free (ctx); + _pth_free (ctx); } @@ -685,7 +689,7 @@ sec_attr.nLength = sizeof sec_attr; sec_attr.bInheritHandle = FALSE; - ctx = calloc (1, sizeof *ctx); + ctx = _pth_calloc (1, sizeof *ctx); if (!ctx) { TRACE_SYSERR (errno); @@ -708,7 +712,7 @@ CloseHandle (ctx->is_empty); if (ctx->stopped) CloseHandle (ctx->stopped); - free (ctx); + _pth_free (ctx); /* FIXME: Translate the error code. */ TRACE_SYSERR (EIO); return NULL; @@ -728,7 +732,7 @@ CloseHandle (ctx->is_empty); if (ctx->stopped) CloseHandle (ctx->stopped); - free (ctx); + _pth_free (ctx); TRACE_SYSERR (EIO); return NULL; } @@ -773,7 +777,7 @@ CloseHandle (ctx->is_empty); CloseHandle (ctx->thread_hd); DESTROY_LOCK (ctx->mutex); - free (ctx); + _pth_free (ctx); } Modified: trunk/w32-io.h =================================================================== --- trunk/w32-io.h 2008-03-25 03:45:46 UTC (rev 24) +++ trunk/w32-io.h 2008-05-27 11:51:42 UTC (rev 25) @@ -21,6 +21,13 @@ #ifndef W32_IO_H #define W32_IO_H +/* Actually in w32-pth.c */ +void *pth_malloc (size_t n); +void *pth_calloc (size_t n, size_t m); +void _pth_free (void *p); + + +/* w32-io.c */ void _pth_sema_subsystem_init (void); /* For select. */ @@ -30,4 +37,5 @@ int _pth_io_read (int fd, void *buffer, size_t count); int _pth_io_write (int fd, const void *buffer, size_t count); + #endif /* W32_IO_H */ Modified: trunk/w32-pth.c =================================================================== --- trunk/w32-pth.c 2008-03-25 03:45:46 UTC (rev 24) +++ trunk/w32-pth.c 2008-05-27 11:51:42 UTC (rev 25) @@ -64,6 +64,7 @@ /* States whether this module has been initialized. */ static int pth_initialized; +/* Debug helpers. */ int debug_level; FILE *dbgfp; @@ -154,6 +155,33 @@ return "libw32pth"; } + +/* Our own malloc function. Eventually we will use HeapCreate to use + a private heap here. */ +void * +_pth_malloc (size_t n) +{ + void *p; + p = malloc (n); + return p; +} + +void * +_pth_calloc (size_t n, size_t m) +{ + void *p; + p = calloc (n, m); + return p; +} + +void +_pth_free (void *p) +{ + if (p) + free (p); +} + + static char * w32_strerror (char *strerr, size_t strerrsize) { @@ -409,7 +437,7 @@ s1++; if (!(s2 = strchr (s1, ';'))) s2 = s1 + strlen (s1); - p = malloc (s2 - s1 + 1); + p = _pth_malloc (s2 - s1 + 1); if (p) { memcpy (p, s1, s2-s1); @@ -417,14 +445,14 @@ dbgfp = fopen (p, "a"); if (dbgfp) setvbuf (dbgfp, NULL, _IOLBF, 0); - free (p); + _pth_free (p); } } } if (!dbgfp) dbgfp = stderr; if (debug_level) - fprintf (dbgfp, "%s: pth_init: called.\n", log_get_prefix (NULL)); + _pth_debug (DEBUG_ERROR, "pth_init called\n"); if (WSAStartup (0x202, &wsadat)) return FALSE; @@ -466,8 +494,7 @@ /* Fixme: I am not sure whether the same thread my enter a critical section twice. */ if (DBG_CALLS) - fprintf (dbgfp, "%s: enter_pth (%s)\n", - log_get_prefix (NULL), function? function:""); + _pth_debug (DEBUG_CALLS, "enter_pth (%s)\n", function? function:""); LeaveCriticalSection (&pth_shd); } @@ -477,8 +504,7 @@ { EnterCriticalSection (&pth_shd); if (DBG_CALLS) - fprintf (dbgfp, "%s: leave_pth (%s)\n", - log_get_prefix (NULL), function? function:""); + _pth_debug (DEBUG_CALLS, "leave_pth (%s)\n", function? function:""); } @@ -1096,7 +1122,7 @@ pth_attr_t hd; implicit_init (); - hd = calloc (1, sizeof *hd); + hd = _pth_calloc (1, sizeof *hd); return hd; } @@ -1108,8 +1134,8 @@ return -1; implicit_init (); if (hd->name) - free (hd->name); - free (hd); + _pth_free (hd->name); + _pth_free (hd); return TRUE; } @@ -1153,7 +1179,7 @@ case PTH_ATTR_NAME: str = va_arg (args, char*); if (hd->name) - free (hd->name); + _pth_free (hd->name); if (str) { hd->name = strdup (str); @@ -1191,7 +1217,7 @@ sa.lpSecurityDescriptor = NULL; sa.nLength = sizeof sa; - ctx = calloc (1, sizeof *ctx); + ctx = _pth_calloc (1, sizeof *ctx); if (!ctx) return NULL; ctx->thread = func; @@ -1217,7 +1243,7 @@ fprintf (dbgfp, "%s: do_pth_spawn created thread %p\n", log_get_prefix (NULL),th); if (!th) - free (ctx); + _pth_free (ctx); else ResumeThread (th); @@ -1246,6 +1272,16 @@ return GetCurrentThread (); } + +/* Special W32 function to cope with the problem that pth_self returns + just a pseudo handle which is not very usefule for debugging. */ +unsigned long +pth_thread_id (void) +{ + return GetCurrentThreadId (); +} + + int pth_join (pth_t hd, void **value) { @@ -1407,7 +1443,7 @@ if (DBG_INFO) fprintf (dbgfp, "%s: pth_event spec=%lx\n", log_get_prefix (NULL), spec); - ev = calloc (1, sizeof *ev); + ev = _pth_calloc (1, sizeof *ev); if (!ev) return NULL; ev->next = ev; @@ -1418,7 +1454,7 @@ ev->hd = create_event (); if (!ev->hd) { - free (ev); + _pth_free (ev); return NULL; } @@ -1582,7 +1618,7 @@ deallocated handle. Don't use it directly but setup proper scheduling queues. */ enter_pth (__FUNCTION__); - free (c); + _pth_free (c); } ExitThread (0); return NULL; @@ -1662,7 +1698,7 @@ pth_event_t next = cur->next; CloseHandle (cur->hd); cur->hd = NULL; - free (cur); + _pth_free (cur); cur = next; } while (cur != ev); @@ -1673,7 +1709,7 @@ ev->next->prev = ev->prev; CloseHandle (ev->hd); ev->hd = NULL; - free (ev); + _pth_free (ev); } else return FALSE; From cvs at cvs.gnupg.org Tue May 27 14:04:11 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue, 27 May 2008 14:04:11 +0200 Subject: [svn] GnuPG - r4773 - in trunk: . agent common jnlib po Message-ID: Author: wk Date: 2008-05-27 14:03:50 +0200 (Tue, 27 May 2008) New Revision: 4773 Modified: trunk/NEWS trunk/agent/ChangeLog trunk/agent/call-pinentry.c trunk/agent/command-ssh.c trunk/agent/command.c trunk/agent/divert-scd.c trunk/agent/gpg-agent.c trunk/agent/preset-passphrase.c trunk/agent/trustlist.c trunk/agent/w32main.c trunk/autogen.sh trunk/common/ChangeLog trunk/common/asshelp.c trunk/common/homedir.c trunk/common/i18n.c trunk/common/util.h trunk/jnlib/ChangeLog trunk/jnlib/argparse.c trunk/po/ChangeLog trunk/po/be.po trunk/po/ca.po trunk/po/cs.po trunk/po/da.po trunk/po/de.po trunk/po/el.po trunk/po/eo.po trunk/po/es.po trunk/po/et.po trunk/po/fi.po trunk/po/fr.po trunk/po/gl.po trunk/po/hu.po trunk/po/id.po trunk/po/it.po trunk/po/ja.po trunk/po/nb.po trunk/po/pl.po trunk/po/pt.po trunk/po/pt_BR.po trunk/po/ro.po trunk/po/ru.po trunk/po/sk.po trunk/po/sv.po trunk/po/tr.po trunk/po/zh_CN.po trunk/po/zh_TW.po Log: Fixed segv in gpg-agent (command marktrusted). Replaced almost all free by xfree. Translation fixes. [The diff below has been truncated] Modified: trunk/agent/ChangeLog =================================================================== --- trunk/agent/ChangeLog 2008-05-26 16:48:05 UTC (rev 4772) +++ trunk/agent/ChangeLog 2008-05-27 12:03:50 UTC (rev 4773) @@ -1,3 +1,30 @@ +2008-05-27 Werner Koch + + * trustlist.c (insert_colons): Fix stupidly wrong allocation + computation. + +2008-05-26 Werner Koch + + * gpg-agent.c (main): Re-initialize default assuan log stream if a + log file is used. + + * trustlist.c (agent_marktrusted): Use xtryasprintf and xfree. + + * gpg-agent.c (main, agent_deinit_default_ctrl): Always use xfree + because our asprintf is mapped to an xmalloc style function in + util.h. Replace xtrdup by xtrystrdup. + * w32main.c (build_argv): Ditto. + * preset-passphrase.c (preset_passphrase): Ditto. + * divert-scd.c (ask_for_card): Ditto. + * command.c (option_handler): Ditto. + * command-ssh.c (ssh_handler_request_identities): Ditto. + * call-pinentry.c (start_pinentry): Ditto. + + * gpg-agent.c (start_connection_thread) + (start_connection_thread_ssh): Use pth_thread_id for useful output + under W32. + (pth_thread_id) [!PTH_HAVE_PTH_THREAD_ID]: New. + 2008-03-17 Werner Koch * agent.h (agent_inq_pinentry_launched): New prototype. Modified: trunk/common/ChangeLog =================================================================== --- trunk/common/ChangeLog 2008-05-26 16:48:05 UTC (rev 4772) +++ trunk/common/ChangeLog 2008-05-27 12:03:50 UTC (rev 4773) @@ -1,3 +1,13 @@ +2008-05-26 Werner Koch + + * asshelp.c (send_one_option, send_pinentry_environment): use + xfree and xtrystrdup. + + * i18n.c (i18n_switchto_utf8) [USE_SIMPLE_GETTEXT]: Return NULL. + + * homedir.c (gnupg_module_name): Add + GNUPG_MODULE_NAME_CONNECT_AGENT and GNUPG_MODULE_NAME_GPGCONF. + 2008-04-21 Werner Koch * http.c (http_wait_response) [W32]: Use DuplicateHandle because Modified: trunk/jnlib/ChangeLog =================================================================== --- trunk/jnlib/ChangeLog 2008-05-26 16:48:05 UTC (rev 4772) +++ trunk/jnlib/ChangeLog 2008-05-27 12:03:50 UTC (rev 4773) @@ -1,3 +1,7 @@ +2008-05-26 Werner Koch + + * argparse.c (usage): Make sure to print a trailing LF for usage(1). + 2008-04-08 Werner Koch * w32-gettext.c (gettext_select_utf8): New. Modified: trunk/po/ChangeLog =================================================================== --- trunk/po/ChangeLog 2008-05-26 16:48:05 UTC (rev 4772) +++ trunk/po/ChangeLog 2008-05-27 12:03:50 UTC (rev 4773) @@ -1,3 +1,9 @@ +2008-05-26 Werner Koch + + * de.po: Minor fixes submitted by Jan Seidel. Fixes bug#916. + + * it.po: Typo fix. Fixes bug#920. + 2008-05-09 Werner Koch * de.po: Update. Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2008-05-26 16:48:05 UTC (rev 4772) +++ trunk/NEWS 2008-05-27 12:03:50 UTC (rev 4773) @@ -7,13 +7,17 @@ * New mechanisms "local" and "nodefault" for --auto-key-locate [gpg]. Fixed a few problems with this option. - * [W32] Initialize the socket subsystem for all keyserver helpers. + * [W32] Initialized the socket subsystem for all keyserver helpers. * New gpg2 command --locate-keys. * New gpg2 options --with-sig-list and --with-sig-check. + * Made gpgsm's --output option work with --export-secret-key-p12. + * gpg-connect-agent accepts commands given as command line arguments. + + Noteworthy changes in version 2.0.9 (2008-03-26) ------------------------------------------------ Modified: trunk/agent/call-pinentry.c =================================================================== --- trunk/agent/call-pinentry.c 2008-05-26 16:48:05 UTC (rev 4772) +++ trunk/agent/call-pinentry.c 2008-05-27 12:03:50 UTC (rev 4773) @@ -319,7 +319,7 @@ return unlock_pinentry (out_of_core ()); rc = assuan_transact (entry_ctx, optstr, NULL, NULL, NULL, NULL, NULL, NULL); - free (optstr); + xfree (optstr); if (rc) return unlock_pinentry (rc); } @@ -373,7 +373,7 @@ { assuan_transact (entry_ctx, optstr, NULL, NULL, NULL, NULL, NULL, NULL); - free (optstr); + xfree (optstr); } } Modified: trunk/agent/command-ssh.c =================================================================== --- trunk/agent/command-ssh.c 2008-05-26 16:48:05 UTC (rev 4772) +++ trunk/agent/command-ssh.c 2008-05-27 12:03:50 UTC (rev 4773) @@ -1960,7 +1960,7 @@ if (ctrl_fp) fclose (ctrl_fp); - free (key_directory); + xfree (key_directory); xfree (key_path); xfree (buffer); xfree (key_type); @@ -2430,7 +2430,7 @@ xfree (pi); xfree (buffer); xfree (comment); - free (description); /* (asprintf allocated, thus regular free.) */ + xfree (description); return err; } Modified: trunk/agent/command.c =================================================================== --- trunk/agent/command.c 2008-05-26 16:48:05 UTC (rev 4772) +++ trunk/agent/command.c 2008-05-27 12:03:50 UTC (rev 4773) @@ -1422,8 +1422,8 @@ if (!strcmp (key, "display")) { if (ctrl->display) - free (ctrl->display); - ctrl->display = strdup (value); + xfree (ctrl->display); + ctrl->display = xtrystrdup (value); if (!ctrl->display) return out_of_core (); } @@ -1432,8 +1432,8 @@ if (!opt.keep_tty) { if (ctrl->ttyname) - free (ctrl->ttyname); - ctrl->ttyname = strdup (value); + xfree (ctrl->ttyname); + ctrl->ttyname = xtrystrdup (value); if (!ctrl->ttyname) return out_of_core (); } @@ -1443,8 +1443,8 @@ if (!opt.keep_tty) { if (ctrl->ttytype) - free (ctrl->ttytype); - ctrl->ttytype = strdup (value); + xfree (ctrl->ttytype); + ctrl->ttytype = xtrystrdup (value); if (!ctrl->ttytype) return out_of_core (); } @@ -1452,32 +1452,32 @@ else if (!strcmp (key, "lc-ctype")) { if (ctrl->lc_ctype) - free (ctrl->lc_ctype); - ctrl->lc_ctype = strdup (value); + xfree (ctrl->lc_ctype); + ctrl->lc_ctype = xtrystrdup (value); if (!ctrl->lc_ctype) return out_of_core (); } else if (!strcmp (key, "lc-messages")) { if (ctrl->lc_messages) - free (ctrl->lc_messages); - ctrl->lc_messages = strdup (value); + xfree (ctrl->lc_messages); + ctrl->lc_messages = xtrystrdup (value); if (!ctrl->lc_messages) return out_of_core (); } else if (!strcmp (key, "xauthority")) { if (ctrl->xauthority) - free (ctrl->xauthority); - ctrl->xauthority = strdup (value); + xfree (ctrl->xauthority); + ctrl->xauthority = xtrystrdup (value); if (!ctrl->xauthority) return out_of_core (); } else if (!strcmp (key, "pinentry-user-data")) { if (ctrl->pinentry_user_data) - free (ctrl->pinentry_user_data); - ctrl->pinentry_user_data = strdup (value); + xfree (ctrl->pinentry_user_data); + ctrl->pinentry_user_data = xtrystrdup (value); if (!ctrl->pinentry_user_data) return out_of_core (); } @@ -1515,7 +1515,7 @@ const char *line, size_t linelen) { ctrl_t ctrl = assuan_get_pointer (ctx); - + /* Note that we only check for the uppercase name. This allows to see the logging for debugging if using a non-upercase command name. */ Modified: trunk/agent/divert-scd.c =================================================================== --- trunk/agent/divert-scd.c 2008-05-26 16:48:05 UTC (rev 4772) +++ trunk/agent/divert-scd.c 2008-05-27 12:03:50 UTC (rev 4773) @@ -120,7 +120,7 @@ else { rc = agent_get_confirmation (ctrl, desc, NULL, NULL); - free (desc); + xfree (desc); } } if (rc) @@ -293,7 +293,7 @@ info? "')":"") < 0) desc = NULL; rc = agent_askpin (ctrl, desc?desc:info, prompt, NULL, pi); - free (desc); + xfree (desc); } if (!rc) Modified: trunk/agent/gpg-agent.c =================================================================== --- trunk/agent/gpg-agent.c 2008-05-26 16:48:05 UTC (rev 4772) +++ trunk/agent/gpg-agent.c 2008-05-27 12:03:50 UTC (rev 4773) @@ -263,7 +263,14 @@ } +#ifndef PTH_HAVE_PTH_THREAD_ID +static unsigned long pth_thread_id (void) +{ + return (unsigned long)pth_self (); +} +#endif + /* Functions. @@ -840,6 +847,7 @@ |JNLIB_LOG_WITH_TIME |JNLIB_LOG_WITH_PID)); current_logfile = xstrdup (logfile); + assuan_set_assuan_log_stream (log_get_stream ()); } /* Make sure that we have a default ttyname. */ @@ -1034,11 +1042,11 @@ printf ("%s; export SSH_AGENT_PID;\n", infostr_ssh_pid); } } - free (infostr); /* (Note that a vanilla free is here correct.) */ + xfree (infostr); if (opt.ssh_support) { - free (infostr_ssh_sock); - free (infostr_ssh_pid); + xfree (infostr_ssh_sock); + xfree (infostr_ssh_pid); } exit (0); } @@ -1132,31 +1140,33 @@ and the request will fail anyway shortly after this initialization. */ if (ctrl->display) - free (ctrl->display); - ctrl->display = default_display? strdup (default_display) : NULL; + xfree (ctrl->display); + ctrl->display = default_display? xtrystrdup (default_display) : NULL; if (ctrl->ttyname) - free (ctrl->ttyname); - ctrl->ttyname = default_ttyname? strdup (default_ttyname) : NULL; + xfree (ctrl->ttyname); + ctrl->ttyname = default_ttyname? xtrystrdup (default_ttyname) : NULL; if (ctrl->ttytype) - free (ctrl->ttytype); - ctrl->ttytype = default_ttytype? strdup (default_ttytype) : NULL; + xfree (ctrl->ttytype); + ctrl->ttytype = default_ttytype? xtrystrdup (default_ttytype) : NULL; if (ctrl->lc_ctype) - free (ctrl->lc_ctype); - ctrl->lc_ctype = default_lc_ctype? strdup (default_lc_ctype) : NULL; + xfree (ctrl->lc_ctype); + ctrl->lc_ctype = default_lc_ctype? xtrystrdup (default_lc_ctype) : NULL; if (ctrl->lc_messages) - free (ctrl->lc_messages); - ctrl->lc_messages = default_lc_messages? strdup (default_lc_messages) : NULL; + xfree (ctrl->lc_messages); + ctrl->lc_messages = default_lc_messages? xtrystrdup (default_lc_messages) + /**/ : NULL; if (ctrl->xauthority) - free (ctrl->xauthority); - ctrl->xauthority = default_xauthority? strdup (default_xauthority) : NULL; + xfree (ctrl->xauthority); + ctrl->xauthority = default_xauthority? xtrystrdup (default_xauthority) + /**/: NULL; if (ctrl->pinentry_user_data) - free (ctrl->pinentry_user_data); + xfree (ctrl->pinentry_user_data); ctrl->pinentry_user_data = NULL; } @@ -1165,19 +1175,19 @@ agent_deinit_default_ctrl (ctrl_t ctrl) { if (ctrl->display) - free (ctrl->display); + xfree (ctrl->display); if (ctrl->ttyname) - free (ctrl->ttyname); + xfree (ctrl->ttyname); if (ctrl->ttytype) - free (ctrl->ttytype); + xfree (ctrl->ttytype); if (ctrl->lc_ctype) - free (ctrl->lc_ctype); + xfree (ctrl->lc_ctype); if (ctrl->lc_messages) - free (ctrl->lc_messages); + xfree (ctrl->lc_messages); if (ctrl->xauthority) - free (ctrl->xauthority); + xfree (ctrl->xauthority); if (ctrl->pinentry_user_data) - free (ctrl->pinentry_user_data); + xfree (ctrl->pinentry_user_data); } /* Reread parts of the configuration. Note, that this function is @@ -1622,12 +1632,12 @@ agent_init_default_ctrl (ctrl); if (opt.verbose) log_info (_("handler 0x%lx for fd %d started\n"), - (long)pth_self (), FD2INT(ctrl->thread_startup.fd)); + pth_thread_id (), FD2INT(ctrl->thread_startup.fd)); start_command_handler (ctrl, GNUPG_INVALID_FD, ctrl->thread_startup.fd); if (opt.verbose) log_info (_("handler 0x%lx for fd %d terminated\n"), - (long)pth_self (), FD2INT(ctrl->thread_startup.fd)); + pth_thread_id (), FD2INT(ctrl->thread_startup.fd)); agent_deinit_default_ctrl (ctrl); xfree (ctrl); @@ -1647,12 +1657,12 @@ agent_init_default_ctrl (ctrl); if (opt.verbose) log_info (_("ssh handler 0x%lx for fd %d started\n"), - (long)pth_self (), FD2INT(ctrl->thread_startup.fd)); + pth_thread_id (), FD2INT(ctrl->thread_startup.fd)); start_command_handler_ssh (ctrl, ctrl->thread_startup.fd); if (opt.verbose) log_info (_("ssh handler 0x%lx for fd %d terminated\n"), - (long)pth_self (), FD2INT(ctrl->thread_startup.fd)); + pth_thread_id (), FD2INT(ctrl->thread_startup.fd)); agent_deinit_default_ctrl (ctrl); xfree (ctrl); Modified: trunk/agent/preset-passphrase.c =================================================================== --- trunk/agent/preset-passphrase.c 2008-05-26 16:48:05 UTC (rev 4772) +++ trunk/agent/preset-passphrase.c 2008-05-27 12:03:50 UTC (rev 4773) @@ -205,7 +205,7 @@ } wipememory (line, strlen (line)); - free (line); + xfree (line); } @@ -222,7 +222,7 @@ gpg_strerror (gpg_error_from_syserror ())); return; } - free (line); + xfree (line); } Modified: trunk/agent/trustlist.c =================================================================== --- trunk/agent/trustlist.c 2008-05-26 16:48:05 UTC (rev 4772) +++ trunk/agent/trustlist.c 2008-05-27 12:03:50 UTC (rev 4773) @@ -463,8 +463,9 @@ { char *buffer, *p; size_t n = strlen (string); + size_t nnew = n + (n+1)/2; - p = buffer = xtrymalloc ( n + (n+2)/3 + 1 ); + p = buffer = xtrymalloc ( nnew + 1 ); if (!buffer) return NULL; while (*string) @@ -478,6 +479,7 @@ } } *p = 0; + assert (strlen (buffer) <= nnew); return buffer; } @@ -526,7 +528,7 @@ fprformatted = insert_colons (fpr); if (!fprformatted) return out_of_core (); - if (asprintf (&desc, + desc = xtryasprintf ( /* TRANSLATORS: This prompt is shown by the Pinentry and has one special property: A "%%0A" is used by Pinentry to insert a line break. The double @@ -539,7 +541,8 @@ _("Please verify that the certificate identified as:%%0A" " \"%s\"%%0A" "has the fingerprint:%%0A" - " %s"), name, fprformatted) < 0 ) + " %s"), name, fprformatted); + if (!desc) { xfree (fprformatted); return out_of_core (); @@ -549,7 +552,7 @@ be hit if the fingerprint matches the one of the CA. The other button is "the default "Cancel" of the Pinentry. */ err = agent_get_confirmation (ctrl, desc, _("Correct"), NULL); - free (desc); + xfree (desc); /* If the user did not confirmed this, we return cancel here so that gpgsm may stop asking further questions. We won't do this for the second question of course. */ @@ -562,7 +565,7 @@ - if (asprintf (&desc, + desc = xtryasprintf ( /* TRANSLATORS: This prompt is shown by the Pinentry and has one special property: A "%%0A" is used by Pinentry to insert a line break. The double @@ -574,14 +577,15 @@ _("Do you ultimately trust%%0A" " \"%s\"%%0A" "to correctly certify user certificates?"), - name) < 0 ) + name); + if (!desc) { xfree (fprformatted); return out_of_core (); } err = agent_get_confirmation (ctrl, desc, _("Yes"), _("No")); - free (desc); + xfree (desc); if (err) { xfree (fprformatted); Modified: trunk/agent/w32main.c =================================================================== --- trunk/agent/w32main.c 2008-05-26 16:48:05 UTC (rev 4772) +++ trunk/agent/w32main.c 2008-05-27 12:03:50 UTC (rev 4773) @@ -92,10 +92,10 @@ } } - argv = malloc (argc * sizeof *argv); + argv = xtrymalloc (argc * sizeof *argv); if (!argv) { - free (cmdline); + xfree (cmdline); return NULL; } Modified: trunk/autogen.sh =================================================================== --- trunk/autogen.sh 2008-05-26 16:48:05 UTC (rev 4772) +++ trunk/autogen.sh 2008-05-27 12:03:50 UTC (rev 4773) @@ -93,7 +93,7 @@ --with-zlib=${w32root} \ --with-regex=${w32root} \ --with-pth-prefix=${w32root} \ - --with-adns=${w32root} + --with-adns=${w32root} \ --without-included-gettext "$@" rc=$? exit $rc Modified: trunk/common/asshelp.c =================================================================== --- trunk/common/asshelp.c 2008-05-26 16:48:05 UTC (rev 4772) +++ trunk/common/asshelp.c 2008-05-27 12:03:50 UTC (rev 4773) @@ -49,7 +49,7 @@ else { err = assuan_transact (ctx, optstr, NULL, NULL, NULL, NULL, NULL, NULL); - free (optstr); + xfree (optstr); } return err; @@ -119,7 +119,7 @@ old_lc = setlocale (LC_CTYPE, NULL); if (old_lc) { - old_lc = strdup (old_lc); + old_lc = xtrystrdup (old_lc); if (!old_lc) return gpg_error_from_syserror (); } @@ -134,7 +134,7 @@ if (old_lc) { setlocale (LC_CTYPE, old_lc); - free (old_lc); + xfree (old_lc); } #endif if (err) @@ -145,7 +145,7 @@ old_lc = setlocale (LC_MESSAGES, NULL); if (old_lc) { - old_lc = strdup (old_lc); + old_lc = xtrystrdup (old_lc); if (!old_lc) From cvs at cvs.gnupg.org Wed May 28 10:10:19 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 28 May 2008 10:10:19 +0200 Subject: [svn] GpgOL - r252 - in trunk: . po src Message-ID: Author: wk Date: 2008-05-28 10:10:17 +0200 (Wed, 28 May 2008) New Revision: 252 Modified: trunk/NEWS trunk/configure.ac trunk/po/de.po trunk/po/sv.po trunk/src/ChangeLog trunk/src/mapihelp.cpp trunk/src/mimemaker.c trunk/src/mimeparser.c Log: Do not sent a message if the backend did not sent any data. Typo fixes. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2008-05-06 09:11:41 UTC (rev 251) +++ trunk/src/ChangeLog 2008-05-28 08:10:17 UTC (rev 252) @@ -1,3 +1,14 @@ +2008-05-23 Werner Koch + + * mimemaker.c (struct sink_s): Add field ENC_COUNTER. + (write_buffer_for_cb): Update that. + (mime_encrypt): Bail out if no data has been encrypted. + (mime_sign_encrypt): Ditto. + +2008-05-07 Werner Koch + + * mimeparser.c (t2body): Fix last change. + 2008-05-02 Werner Koch * mimeparser.c (t2body): Detect non-inline text parts. Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2008-05-06 09:11:41 UTC (rev 251) +++ trunk/NEWS 2008-05-28 08:10:17 UTC (rev 252) @@ -1,3 +1,9 @@ +Noteworthy changes for version 0.10.14 (2008-05-28) +=================================================== + + * Minor fixes. + + Noteworthy changes for version 0.10.13 (2008-05-06) =================================================== Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2008-05-06 09:11:41 UTC (rev 251) +++ trunk/configure.ac 2008-05-28 08:10:17 UTC (rev 252) @@ -16,7 +16,7 @@ # Remember to change the version number immediately *after* a release. # Set my_issvn to "yes" for non-released code. Remember to run an # "svn up" and "autogen.sh" right before creating a distribution. -m4_define([my_version], [0.10.13]) +m4_define([my_version], [0.10.14]) m4_define([my_issvn], [no]) m4_define([svn_revision], m4_esyscmd([echo -n $( (svn info 2>/dev/null \ Modified: trunk/po/de.po [not shown] Modified: trunk/po/sv.po [not shown] Modified: trunk/src/mapihelp.cpp =================================================================== --- trunk/src/mapihelp.cpp 2008-05-06 09:11:41 UTC (rev 251) +++ trunk/src/mapihelp.cpp 2008-05-28 08:10:17 UTC (rev 252) @@ -560,7 +560,7 @@ class after accessing them. Thus in old stores there may be a lot of *.CexEnc message which are actually just signed. - 2. Is the smime-typeparameter is missing we need another way to + 2. If the smime-type parameter is missing we need another way to decide whether to decrypt or to verify. */ static int Modified: trunk/src/mimemaker.c =================================================================== --- trunk/src/mimemaker.c 2008-05-06 09:11:41 UTC (rev 251) +++ trunk/src/mimemaker.c 2008-05-28 08:10:17 UTC (rev 252) @@ -63,6 +63,7 @@ void *cb_data; sink_t extrasink; int (*writefnc)(sink_t sink, const void *data, size_t datalen); + unsigned long enc_counter; /* Used by write_buffer_for_cb. */ /* struct { */ /* int idx; */ /* unsigned char inbuf[4]; */ @@ -237,7 +238,7 @@ { if (!sink || !sink->writefnc) { - log_error ("%s:%s: sink not properliy setup", SRCNAME, __func__); + log_error ("%s:%s: sink not properly setup", SRCNAME, __func__); return -1; } return sink->writefnc (sink, data, datalen); @@ -250,6 +251,7 @@ write_buffer_for_cb (void *opaque, const void *data, size_t datalen) { sink_t sink = opaque; + sink->enc_counter += datalen; return write_buffer (sink, data, datalen) ? -1 : datalen; } @@ -1565,8 +1567,8 @@ return -1; /* Prepare the encryption. We do this early as it is quite common - that some recipients are not be available and thus the encryption - will fail early. */ + that some recipient keys are not available and thus the + encryption will fail early. */ if (engine_create_filter (&filter, write_buffer_for_cb, sink)) goto failure; if (engine_encrypt_prepare (filter, hwnd, protocol, recipients, &protocol)) @@ -1639,7 +1641,13 @@ goto failure; filter = NULL; /* Not valid anymore. */ encsink->cb_data = NULL; /* Not needed anymore. */ - + + if (!sink->enc_counter) + { + log_debug ("%s:%s: nothing received from engine", SRCNAME, __func__); + goto failure; + } + /* Write the final boundary (for OpenPGP) and finish the attachment. */ if (*boundary && (rc = write_boundary (sink, boundary, 1))) goto failure; @@ -1799,6 +1807,12 @@ goto failure; filter = NULL; /* Not valid anymore. */ encsink->cb_data = NULL; /* Not needed anymore. */ + + if (!sink->enc_counter) + { + log_debug ("%s:%s: nothing received from engine", SRCNAME, __func__); + goto failure; + } /* Write the final boundary (for OpenPGP) and finish the attachment. */ if (*boundary && (rc = write_boundary (sink, boundary, 1))) Modified: trunk/src/mimeparser.c =================================================================== --- trunk/src/mimeparser.c 2008-05-06 09:11:41 UTC (rev 251) +++ trunk/src/mimeparser.c 2008-05-28 08:10:17 UTC (rev 252) @@ -733,7 +733,7 @@ if (s) filename = xstrdup (s); s = rfc822parse_query_parameter (field, NULL, 1); - if (s && !strcmp (s, "inline")) + if (s && strcmp (s, "inline")) not_inline_text = 1; rfc822parse_release_field (field); } From cvs at cvs.gnupg.org Wed May 28 10:15:23 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 28 May 2008 10:15:23 +0200 Subject: [svn] GpgOL - r253 - tags Message-ID: Author: wk Date: 2008-05-28 10:15:22 +0200 (Wed, 28 May 2008) New Revision: 253 Added: tags/gpgol-0.10.14/ Log: Release From cvs at cvs.gnupg.org Wed May 28 12:08:39 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 28 May 2008 12:08:39 +0200 Subject: [svn] GnuPG - r4774 - trunk/po Message-ID: Author: wk Date: 2008-05-28 12:08:37 +0200 (Wed, 28 May 2008) New Revision: 4774 Modified: trunk/po/ChangeLog trunk/po/es.po Log: The Spanish translation is now up to to date. Modulo some changes I did since the last release. Modified: trunk/po/ChangeLog =================================================================== --- trunk/po/ChangeLog 2008-05-27 12:03:50 UTC (rev 4773) +++ trunk/po/ChangeLog 2008-05-28 10:08:37 UTC (rev 4774) @@ -1,3 +1,7 @@ +2008-05-28 Jaime Su?rez (wk) + + * es.po: Update. All strings for 2.0.9 are no translated. + 2008-05-26 Werner Koch * de.po: Minor fixes submitted by Jan Seidel. Fixes bug#916. Modified: trunk/po/es.po [not shown] From cvs at cvs.gnupg.org Wed May 28 16:08:05 2008 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 28 May 2008 16:08:05 +0200 Subject: [svn] GpgOL - r254 - in trunk: . po src Message-ID: Author: wk Date: 2008-05-28 16:08:03 +0200 (Wed, 28 May 2008) New Revision: 254 Modified: trunk/ChangeLog trunk/NEWS trunk/configure.ac trunk/po/de.po trunk/po/sv.po trunk/src/ChangeLog trunk/src/common.h trunk/src/dialogs.h trunk/src/dialogs.rc trunk/src/engine.c trunk/src/main.c trunk/src/mapihelp.cpp trunk/src/mapihelp.h trunk/src/mimeparser.c trunk/src/olflange-dlgs.cpp Log: Add otpion to show encrypted messages as an attachment. Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-05-28 08:15:22 UTC (rev 253) +++ trunk/ChangeLog 2008-05-28 14:08:03 UTC (rev 254) @@ -1,3 +1,7 @@ +2008-05-28 Werner Koch + + * Release 0.10.14. + 2008-05-06 Werner Koch * Release 0.10.13. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2008-05-28 08:15:22 UTC (rev 253) +++ trunk/src/ChangeLog 2008-05-28 14:08:03 UTC (rev 254) @@ -1,3 +1,16 @@ +2008-05-28 Werner Koch + + * dialogs.h (IDC_BODY_AS_ATTACHMENT): New. + * dialogs.rc: Add body-as-attachemnt checkbox to the otpion + dialog. + * olflange-dlgs.cpp (set_labels, GPGOptionsDlgProc): Add it. + * main.c (write_options, read_options): Handle bodyAsAttachment + registry key. + * mimeparser.c (start_attachment): Do not set the hidden flag if + the new option is used. + * mapihelp.cpp (mapi_test_attach_hidden): New. + (mapi_get_gpgol_body_attachment): Make use of that flag. + 2008-05-23 Werner Koch * mimemaker.c (struct sink_s): Add field ENC_COUNTER. Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2008-05-28 08:15:22 UTC (rev 253) +++ trunk/NEWS 2008-05-28 14:08:03 UTC (rev 254) @@ -1,3 +1,11 @@ +Noteworthy changes for version 0.10.15 +=================================================== + + * New option to present the body of a message as an attachment. This + is useful to make sure that the body will never show up in + plaintext in the message store. + + Noteworthy changes for version 0.10.14 (2008-05-28) =================================================== Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2008-05-28 08:15:22 UTC (rev 253) +++ trunk/configure.ac 2008-05-28 14:08:03 UTC (rev 254) @@ -16,8 +16,8 @@ # Remember to change the version number immediately *after* a release. # Set my_issvn to "yes" for non-released code. Remember to run an # "svn up" and "autogen.sh" right before creating a distribution. -m4_define([my_version], [0.10.14]) -m4_define([my_issvn], [no]) +m4_define([my_version], [0.10.15]) +m4_define([my_issvn], [yes]) m4_define([svn_revision], m4_esyscmd([echo -n $( (svn info 2>/dev/null \ || echo 'Revision: 0')|sed -n '/^Revision:/ {s/[^0-9]//gp;q;}')])) Modified: trunk/po/de.po [not shown] Modified: trunk/po/sv.po [not shown] Modified: trunk/src/common.h =================================================================== --- trunk/src/common.h 2008-05-28 08:15:22 UTC (rev 253) +++ trunk/src/common.h 2008-05-28 14:08:03 UTC (rev 254) @@ -118,6 +118,7 @@ int enable_default_key; /* Enable the use of DEFAULT_KEY. */ int preview_decrypt; /* Decrypt in preview window. */ int prefer_html; /* Prefer html in html/text alternatives. */ + int body_as_attachment; /* Present encrypted message as attachment. */ /* The compatibility flags. */ struct Modified: trunk/src/dialogs.h =================================================================== --- trunk/src/dialogs.h 2008-05-28 08:15:22 UTC (rev 253) +++ trunk/src/dialogs.h 2008-05-28 14:08:03 UTC (rev 254) @@ -39,6 +39,7 @@ #define IDC_G_GENERAL 4023 #define IDC_G_SEND 4024 #define IDC_G_RECV 4025 +#define IDC_BODY_AS_ATTACHMENT 4026 /* Ids for the extended options dialog. */ Modified: trunk/src/dialogs.rc =================================================================== --- trunk/src/dialogs.rc 2008-05-28 08:15:22 UTC (rev 253) +++ trunk/src/dialogs.rc 2008-05-28 14:08:03 UTC (rev 254) @@ -72,7 +72,7 @@ /* Receive options box. */ GROUPBOX "recv-options", IDC_G_RECV, - 9, 104, 250, 36 + 9, 104, 250, 47 CONTROL "preview-decrypt", IDC_PREVIEW_DECRYPT, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, @@ -82,6 +82,10 @@ "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 24, 125, 215, 10 + CONTROL "body-as-attachment", IDC_BODY_AS_ATTACHMENT, + "Button", BS_AUTOCHECKBOX | WS_TABSTOP, + 24, 136, 215, 10 + /* Stuff below the group boxes. */ LTEXT "GpgOL by g10 Code GmbH", IDC_STATIC, 8, 197, 100, 8 Modified: trunk/src/engine.c =================================================================== --- trunk/src/engine.c 2008-05-28 08:15:22 UTC (rev 253) +++ trunk/src/engine.c 2008-05-28 14:08:03 UTC (rev 254) @@ -486,7 +486,8 @@ any = 1; } if (!PulseEvent (filter->out.condvar)) - log_error_w32 (-1, "%s:%s: PulseEvent(out) failed", SRCNAME, __func__); + log_error_w32 (-1, "%s:%s: PulseEvent(%p)[out] failed", + SRCNAME, __func__, filter->out.condvar); release_out_lock (filter, __func__); if (any) @@ -533,7 +534,8 @@ break; /* the loop. */ } if (!PulseEvent (filter->in.condvar)) - log_error_w32 (-1, "%s:%s: PulseEvent(in) failed", SRCNAME, __func__); + log_error_w32 (-1, "%s:%s: PulseEvent(%p)[in] failed", + SRCNAME, __func__, filter->in.condvar); release_in_lock (filter, __func__); if (any) clear_switch_threads (filter); Modified: trunk/src/main.c =================================================================== --- trunk/src/main.c 2008-05-28 08:15:22 UTC (rev 253) +++ trunk/src/main.c 2008-05-28 14:08:03 UTC (rev 254) @@ -633,6 +633,10 @@ opt.svn_revision = val? atol (val) : 0; xfree (val); val = NULL; + load_extension_value ("bodyAsAttachment", &val); + opt.body_as_attachment = val == NULL || *val != '1'? 0 : 1; + xfree (val); val = NULL; + /* Note, that on purpose these flags are only Registry changeable. The format of the entry is a string of of "0" and "1" digits; see the switch below for a description. */ @@ -706,6 +710,7 @@ {"enableDefaultKey", 0, opt.enable_default_key}, {"preferHtml", 0, opt.prefer_html}, {"svnRevision", 1, opt.svn_revision}, + {"bodyAsAttachment", 0, opt.body_as_attachment}, {NULL, 0} }; char buf[32]; Modified: trunk/src/mapihelp.cpp =================================================================== --- trunk/src/mapihelp.cpp 2008-05-28 08:15:22 UTC (rev 253) +++ trunk/src/mapihelp.cpp 2008-05-28 14:08:03 UTC (rev 254) @@ -1685,7 +1685,7 @@ /* Mark this attachment as the orginal MOSS message. We set a custom - property as well as the hidden hidden flag. */ + property as well as the hidden flag. */ int mapi_mark_moss_attach (LPMESSAGE message, mapi_attach_item_t *item) { @@ -1791,7 +1791,28 @@ } +/* Returns true if ATTACH has the hidden flag set to true. */ +int +mapi_test_attach_hidden (LPATTACH attach) +{ + HRESULT hr; + LPSPropValue propval = NULL; + int result = 0; + + hr = HrGetOneProp ((LPMAPIPROP)attach, PR_ATTACHMENT_HIDDEN, &propval); + if (FAILED (hr)) + return result; /* No. */ + + if (PROP_TYPE (propval->ulPropTag) == PT_BOOLEAN && propval->Value.b) + result = 1; /* Yes. */ + MAPIFreeBuffer (propval); + return result; +} + + + + /* Returns True if MESSAGE has the GpgOL Sig Status property. */ int mapi_has_sig_status (LPMESSAGE msg) @@ -2333,8 +2354,21 @@ && get_gpgolattachtype (att, moss_tag) == ATTACHTYPE_FROMMOSS) { found = 1; - if (r_body) + if (!r_body) + ; /* Body content has not been requested. */ + else if (opt.body_as_attachment && !mapi_test_attach_hidden (att)) { + /* The body is to be shown as an attachment. */ + body = native_to_utf8 + (bodytype == 2 + ? ("[Open the attachment \"gpgol000.htm\"" + " to view the message.]") + : ("[Open the attachment \"gpgol000.txt\"" + " to view the message.]")); + found = 1; + } + else + { char *charset; if (get_attach_method (att) == ATTACH_BY_VALUE) Modified: trunk/src/mapihelp.h =================================================================== --- trunk/src/mapihelp.h 2008-05-28 08:15:22 UTC (rev 253) +++ trunk/src/mapihelp.h 2008-05-28 14:08:03 UTC (rev 254) @@ -140,6 +140,7 @@ int mapi_set_gpgol_charset (LPMESSAGE obj, const char *charset); int mapi_set_attach_hidden (LPATTACH attach); +int mapi_test_attach_hidden (LPATTACH attach); char *mapi_get_mime_info (LPMESSAGE msg); Modified: trunk/src/mimeparser.c =================================================================== --- trunk/src/mimeparser.c 2008-05-28 08:15:22 UTC (rev 253) +++ trunk/src/mimeparser.c 2008-05-28 14:08:03 UTC (rev 254) @@ -312,12 +312,14 @@ goto leave; } - /* The body attachment is special and should not be shown in the list - of attachments. */ + /* The body attachment is special and should not be shown in the + list of attachments. If the option body-as-attachment is used + and the message is protected we do set the hidden flag to + false. */ if (is_body) { prop.ulPropTag = PR_ATTACHMENT_HIDDEN; - prop.Value.b = TRUE; + prop.Value.b = (ctx->protect_mode && opt.body_as_attachment)? FALSE:TRUE; hr = HrSetOneProp ((LPMAPIPROP)newatt, &prop); if (hr) { Modified: trunk/src/olflange-dlgs.cpp =================================================================== --- trunk/src/olflange-dlgs.cpp 2008-05-28 08:15:22 UTC (rev 253) +++ trunk/src/olflange-dlgs.cpp 2008-05-28 14:08:03 UTC (rev 254) @@ -53,6 +53,7 @@ { IDC_G_RECV, N_("Message receiving")}, { IDC_PREVIEW_DECRYPT, N_("Also decrypt in preview window")}, { IDC_PREFER_HTML, N_("Show HTML view if possible")}, + { IDC_BODY_AS_ATTACHMENT, N_("Present encrypted message as attachment")}, { IDC_GPG_OPTIONS, "Debug..."}, { IDC_VERSION_INFO, "Version "VERSION " ("__DATE__")"}, @@ -191,6 +192,8 @@ !!opt.preview_decrypt, 0L); SendDlgItemMessage (hDlg, IDC_PREFER_HTML, BM_SETCHECK, !!opt.prefer_html, 0L); + SendDlgItemMessage (hDlg, IDC_BODY_AS_ATTACHMENT, BM_SETCHECK, + !!opt.body_as_attachment, 0L); bMsgResult = FALSE; /* Accepts activation. */ break; @@ -226,6 +229,8 @@ (hDlg, IDC_PREVIEW_DECRYPT, BM_GETCHECK, 0, 0L); opt.prefer_html = !!SendDlgItemMessage (hDlg, IDC_PREFER_HTML, BM_GETCHECK, 0, 0L); + opt.body_as_attachment = !!SendDlgItemMessage + (hDlg, IDC_BODY_AS_ATTACHMENT, BM_GETCHECK, 0, 0L); /* Now that the user has confirmed the options dialog, we mark the Registry with revision of this build. */