From cvs at cvs.gnupg.org Tue Jun 2 16:25:28 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue, 02 Jun 2009 16:25:28 +0200 Subject: [svn] GnuPG - r5029 - trunk/po Message-ID: Author: wk Date: 2009-06-02 16:25:28 +0200 (Tue, 02 Jun 2009) New Revision: 5029 Modified: trunk/po/ChangeLog trunk/po/de.po Log: Fix bug#1069. Modified: trunk/po/ChangeLog =================================================================== --- trunk/po/ChangeLog 2009-05-28 16:20:49 UTC (rev 5028) +++ trunk/po/ChangeLog 2009-06-02 14:25:28 UTC (rev 5029) @@ -1,3 +1,8 @@ +2009-06-02 Werner Koch + + * de.po: Applied a patch from Daniel Leidert to fix a bunch of + small typos. See also Debian bug report 314068. Fixes bug#1069. + 2009-01-19 Werner Koch * de.po: Translated a few new audit-log related strings. Modified: trunk/po/de.po [not shown] From cvs at cvs.gnupg.org Tue Jun 2 16:36:40 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue, 02 Jun 2009 16:36:40 +0200 Subject: [svn] GnuPG - r5030 - branches/STABLE-BRANCH-1-4/po Message-ID: Author: wk Date: 2009-06-02 16:36:40 +0200 (Tue, 02 Jun 2009) New Revision: 5030 Modified: branches/STABLE-BRANCH-1-4/po/ChangeLog branches/STABLE-BRANCH-1-4/po/de.po Log: Fix bug#1069. Modified: branches/STABLE-BRANCH-1-4/po/ChangeLog =================================================================== --- branches/STABLE-BRANCH-1-4/po/ChangeLog 2009-06-02 14:25:28 UTC (rev 5029) +++ branches/STABLE-BRANCH-1-4/po/ChangeLog 2009-06-02 14:36:40 UTC (rev 5030) @@ -1,3 +1,8 @@ +2009-06-02 Werner Koch + + * de.po: Applied a patch from Daniel Leidert to fix a bunch of + small typos. See also Debian bug report 314068. Fixes bug#1069. + 2008-09-30 David Ammouial (wk) * fr.po: Fix bug #922. Modified: branches/STABLE-BRANCH-1-4/po/de.po [not shown] From cvs at cvs.gnupg.org Tue Jun 2 17:26:07 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue, 02 Jun 2009 17:26:07 +0200 Subject: [svn] GnuPG - r5031 - branches/STABLE-BRANCH-1-4/g10 Message-ID: Author: wk Date: 2009-06-02 17:26:06 +0200 (Tue, 02 Jun 2009) New Revision: 5031 Modified: branches/STABLE-BRANCH-1-4/g10/ChangeLog branches/STABLE-BRANCH-1-4/g10/gpgv.c Log: Add stub function. Noted by Daniel Leidert. Modified: branches/STABLE-BRANCH-1-4/g10/ChangeLog =================================================================== --- branches/STABLE-BRANCH-1-4/g10/ChangeLog 2009-06-02 14:36:40 UTC (rev 5030) +++ branches/STABLE-BRANCH-1-4/g10/ChangeLog 2009-06-02 15:26:06 UTC (rev 5031) @@ -1,3 +1,7 @@ +2009-06-02 Werner Koch + + * gpgv.c (tty_cleanup_after_signal): Add new stub. + 2009-05-22 Werner Koch * signal.c (got_fatal_signal): Call tty_cleanup_after_signal. Modified: branches/STABLE-BRANCH-1-4/g10/gpgv.c =================================================================== --- branches/STABLE-BRANCH-1-4/g10/gpgv.c 2009-06-02 14:36:40 UTC (rev 5030) +++ branches/STABLE-BRANCH-1-4/g10/gpgv.c 2009-06-02 15:26:06 UTC (rev 5031) @@ -417,6 +417,7 @@ void tty_kill_prompt(void) {} int tty_get_answer_is_yes( const char *prompt ) {return 0;} int tty_no_terminal(int onoff) {return 0;} +void tty_cleanup_after_signal (void) {} #ifdef HAVE_LIBREADLINE void tty_enable_completion(rl_completion_func_t *completer) {} void tty_disable_completion(void) {} From cvs at cvs.gnupg.org Tue Jun 2 17:47:00 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue, 02 Jun 2009 17:47:00 +0200 Subject: [svn] GnuPG - r5032 - in trunk: . agent doc g10 sm Message-ID: Author: wk Date: 2009-06-02 17:46:59 +0200 (Tue, 02 Jun 2009) New Revision: 5032 Modified: trunk/THANKS trunk/agent/ChangeLog trunk/agent/gpg-agent.c trunk/doc/ChangeLog trunk/doc/gpg-agent.texi trunk/doc/tools.texi trunk/g10/ChangeLog trunk/g10/card-util.c trunk/sm/ChangeLog trunk/sm/encrypt.c Log: Fix for bug#1066. A couple of minor changes. Modified: trunk/agent/ChangeLog =================================================================== --- trunk/agent/ChangeLog 2009-06-02 15:26:06 UTC (rev 5031) +++ trunk/agent/ChangeLog 2009-06-02 15:46:59 UTC (rev 5032) @@ -1,3 +1,7 @@ +2009-06-02 Werner Koch + + * gpg-agent.c (main): Run pth_kill after fork. Fixes bug#1066. + 2009-05-19 Werner Koch * gpg-agent.c (JNLIB_NEED_AFLOCAL): Define. Modified: trunk/doc/ChangeLog =================================================================== --- trunk/doc/ChangeLog 2009-06-02 15:26:06 UTC (rev 5031) +++ trunk/doc/ChangeLog 2009-06-02 15:46:59 UTC (rev 5032) @@ -1,3 +1,9 @@ +2009-06-02 Werner Koch + + * tools.texi (watchgnupg): Typo fix. Fixes bug#1065. + + * gpg-agent.texi (Agent Commands): Update description of --daemon. + 2009-05-20 Werner Koch * gpg.texi (GPG Configuration Options): Explain new meaning of Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2009-06-02 15:26:06 UTC (rev 5031) +++ trunk/g10/ChangeLog 2009-06-02 15:46:59 UTC (rev 5032) @@ -1,3 +1,7 @@ +2009-06-02 Werner Koch + + * card-util.c (get_manufacturer): Add new manufacturer. + 2009-05-26 Werner Koch * parse-packet.c (mpi_read): Workaround for zero-length MPI bug in Modified: trunk/sm/ChangeLog =================================================================== --- trunk/sm/ChangeLog 2009-06-02 15:26:06 UTC (rev 5031) +++ trunk/sm/ChangeLog 2009-06-02 15:46:59 UTC (rev 5032) @@ -1,3 +1,7 @@ +2009-05-27 Werner Koch + + * encrypt.c (encrypt_dek): Make use of make_canon_sexp. + 2009-05-18 Werner Koch * server.c (option_handler): New option "no-encrypt-to". Modified: trunk/THANKS =================================================================== --- trunk/THANKS 2009-06-02 15:26:06 UTC (rev 5031) +++ trunk/THANKS 2009-06-02 15:46:59 UTC (rev 5032) @@ -115,6 +115,7 @@ Jeff Long long at kestrel.cc.ukans.edu Jeffery Von Ronne jronne at ics.uci.edu Jens Bachem bachem at rrz.uni-koeln.de +Jens Seidel jensseidel at users.sf.net Jeroen C. van Gelderen jeroen at vangelderen.org J Horacio MG homega at ciberia.es J. Michael Ashley jashley at acm.org Modified: trunk/agent/gpg-agent.c =================================================================== --- trunk/agent/gpg-agent.c 2009-06-02 15:26:06 UTC (rev 5031) +++ trunk/agent/gpg-agent.c 2009-06-02 15:46:59 UTC (rev 5032) @@ -996,6 +996,9 @@ right now and thus we restore it. That is not strictly necessary but some programs falsely assume a cleared signal mask. */ + if ( !pth_kill () ) + log_error ("pth_kill failed in foked process\n"); + #ifdef HAVE_SIGPROCMASK if (startup_signal_mask_valid) { Modified: trunk/doc/gpg-agent.texi =================================================================== --- trunk/doc/gpg-agent.texi 2009-06-02 15:26:06 UTC (rev 5031) +++ trunk/doc/gpg-agent.texi 2009-06-02 15:46:59 UTC (rev 5032) @@ -157,15 +157,17 @@ @item --daemon [@var{command line}] @opindex daemon -Run the program in the background. This option is required to prevent -it from being accidently running in the background. A common way to do -this is: - at example - at end example -$ eval $(gpg-agent --daemon) +Start the gpg-agent as a daemon; that is, detach it from the console +and run it in the background. Because @command{gpg-agent} prints out +important information required for further use, a common way of +invoking gpg-agent is: @code{eval $(gpg-agent --daemon)} to setup the +environment variables. The option @option{--write-env-file} is +another way commonly used to do this. Yet another way is creating +a new process as a child of gpg-agent: @code{gpg-agent --daemon +/bin/sh}. This way you get a new shell with the environment setup +properly; if you exit from this shell, gpg-agent terminates as well. @end table - @mansect options @node Agent Options @section Option Summary Modified: trunk/doc/tools.texi =================================================================== --- trunk/doc/tools.texi 2009-06-02 15:26:06 UTC (rev 5031) +++ trunk/doc/tools.texi 2009-06-02 15:46:59 UTC (rev 5032) @@ -41,7 +41,7 @@ @end ifset @mansect description -Most of the main utilities are able to write there log files to a +Most of the main utilities are able to write their log files to a Unix Domain socket if configured that way. @command{watchgnupg} is a simple listener for such a socket. It ameliorates the output with a time stamp and makes sure that long lines are not interspersed with log Modified: trunk/g10/card-util.c =================================================================== --- trunk/g10/card-util.c 2009-06-02 15:26:06 UTC (rev 5031) +++ trunk/g10/card-util.c 2009-06-02 15:46:59 UTC (rev 5032) @@ -193,6 +193,7 @@ case 0x0002: return "Prism"; case 0x0003: return "OpenFortress"; case 0x0004: return "Wewid AB"; + case 0x0005: return "ZeitControl"; /* 0x00000 and 0xFFFF are defined as test cards per spec, 0xFFF00 to 0xFFFE are assigned for use with randomly created Modified: trunk/sm/encrypt.c =================================================================== --- trunk/sm/encrypt.c 2009-06-02 15:26:06 UTC (rev 5031) +++ trunk/sm/encrypt.c 2009-06-02 15:46:59 UTC (rev 5032) @@ -207,22 +207,10 @@ gcry_sexp_release (s_data); gcry_sexp_release (s_pkey); - /* reformat it */ - len = gcry_sexp_sprint (s_ciph, GCRYSEXP_FMT_CANON, NULL, 0); - assert (len); - buf = xtrymalloc (len); - if (!buf) - { - gpg_error_t tmperr = out_of_core (); - gcry_sexp_release (s_ciph); - return tmperr; - } - len = gcry_sexp_sprint (s_ciph, GCRYSEXP_FMT_CANON, (char*)buf, len); - assert (len); + /* Reformat it. */ + rc = make_canon_sexp (s_ciph, encval, NULL); gcry_sexp_release (s_ciph); - - *encval = buf; - return 0; + return rc; } From cvs at cvs.gnupg.org Wed Jun 3 19:24:26 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 03 Jun 2009 19:24:26 +0200 Subject: [svn] GnuPG - r5033 - in trunk: agent common g10 Message-ID: Author: wk Date: 2009-06-03 19:24:24 +0200 (Wed, 03 Jun 2009) New Revision: 5033 Modified: trunk/agent/ChangeLog trunk/agent/protect-tool.c trunk/agent/trustlist.c trunk/common/ChangeLog trunk/common/estream.c trunk/g10/card-util.c Log: Fixed an fopen problem on Windows Vista. Modified: trunk/agent/ChangeLog =================================================================== --- trunk/agent/ChangeLog 2009-06-02 15:46:59 UTC (rev 5032) +++ trunk/agent/ChangeLog 2009-06-03 17:24:24 UTC (rev 5033) @@ -1,3 +1,13 @@ +2009-06-03 Werner Koch + + * protect-tool.c: Include estream.h. + (store_private_key): Replace stdio streams by estream functions + for a portable use of the "x" mode. + * trustlist.c: Include estream.h. + (agent_marktrusted): Repalce stdio stream by estream functions. + + * protect-tool.c (store_private_key): Use bin2hex. + 2009-06-02 Werner Koch * gpg-agent.c (main): Run pth_kill after fork. Fixes bug#1066. Modified: trunk/common/ChangeLog =================================================================== --- trunk/common/ChangeLog 2009-06-02 15:46:59 UTC (rev 5032) +++ trunk/common/ChangeLog 2009-06-03 17:24:24 UTC (rev 5033) @@ -1,3 +1,7 @@ +2009-06-03 Werner Koch + + * estream.c (es_convert_mode): Rewrite and support the "x" flag. + 2009-05-28 David Shaw From 1.4: Modified: trunk/agent/protect-tool.c =================================================================== --- trunk/agent/protect-tool.c 2009-06-02 15:46:59 UTC (rev 5032) +++ trunk/agent/protect-tool.c 2009-06-03 17:24:24 UTC (rev 5033) @@ -44,6 +44,7 @@ #include "i18n.h" #include "get-passphrase.h" #include "sysutils.h" +#include "estream.h" enum cmd_and_opt_values @@ -1199,18 +1200,15 @@ store_private_key (const unsigned char *grip, const void *buffer, size_t length, int force) { - int i; char *fname; - FILE *fp; + estream_t fp; char hexgrip[40+4+1]; - for (i=0; i < 20; i++) - sprintf (hexgrip+2*i, "%02X", grip[i]); - strcpy (hexgrip+40, ".key"); + bin2hex (grip, 20, hexgrip); fname = make_filename (opt_homedir, GNUPG_PRIVATE_KEYS_DIR, hexgrip, NULL); if (force) - fp = fopen (fname, "wb"); + fp = es_fopen (fname, "wb"); else { if (!access (fname, F_OK)) @@ -1224,9 +1222,9 @@ xfree (fname); return opt_no_fail_on_exist? 0 : -1; } - fp = fopen (fname, "wbx"); /* FIXME: the x is a GNU extension - let - configure check whether this actually - works */ + /* FWIW: Under Windows Vista the standard fopen in the msvcrt + fails if the "x" GNU extension is used. */ + fp = es_fopen (fname, "wbx"); } if (!fp) @@ -1236,15 +1234,15 @@ return -1; } - if (fwrite (buffer, length, 1, fp) != 1) + if (es_fwrite (buffer, length, 1, fp) != 1) { log_error ("error writing `%s': %s\n", fname, strerror (errno)); - fclose (fp); + es_fclose (fp); remove (fname); xfree (fname); return -1; } - if ( fclose (fp) ) + if (es_fclose (fp)) { log_error ("error closing `%s': %s\n", fname, strerror (errno)); remove (fname); Modified: trunk/agent/trustlist.c =================================================================== --- trunk/agent/trustlist.c 2009-06-02 15:46:59 UTC (rev 5032) +++ trunk/agent/trustlist.c 2009-06-03 17:24:24 UTC (rev 5033) @@ -31,6 +31,7 @@ #include "agent.h" #include /* fixme: need a way to avoid assuan calls here */ #include "i18n.h" +#include "estream.h" /* A structure to store the information from the trust file. */ @@ -552,7 +553,7 @@ gpg_error_t err = 0; char *desc; char *fname; - FILE *fp; + estream_t fp; char *fprformatted; char *nameformatted; int is_disabled; @@ -691,7 +692,7 @@ fname = make_filename (opt.homedir, "trustlist.txt", NULL); if ( access (fname, F_OK) && errno == ENOENT) { - fp = fopen (fname, "wx"); /* Warning: "x" is a GNU extension. */ + fp = es_fopen (fname, "wx"); if (!fp) { err = gpg_error_from_syserror (); @@ -702,10 +703,10 @@ xfree (nameformatted); return err; } - fputs (headerblurb, fp); - fclose (fp); + es_fputs (headerblurb, fp); + es_fclose (fp); } - fp = fopen (fname, "a+"); + fp = es_fopen (fname, "a+"); if (!fp) { err = gpg_error_from_syserror (); @@ -718,22 +719,22 @@ } /* Append the key. */ - fputs ("\n# ", fp); + es_fputs ("\n# ", fp); xfree (nameformatted); nameformatted = reformat_name (name, "\n# "); if (!nameformatted || strchr (name, '\n')) { /* Note that there should never be a LF in NAME but we better play safe and print a sanitized version in this case. */ - print_sanitized_string (fp, name, 0); + es_write_sanitized (fp, name, strlen (name), NULL, NULL); } else - fputs (nameformatted, fp); - fprintf (fp, "\n%s%s %c\n", yes_i_trust?"":"!", fprformatted, flag); - if (ferror (fp)) + es_fputs (nameformatted, fp); + es_fprintf (fp, "\n%s%s %c\n", yes_i_trust?"":"!", fprformatted, flag); + if (es_ferror (fp)) err = gpg_error_from_syserror (); - if (fclose (fp)) + if (es_fclose (fp)) err = gpg_error_from_syserror (); agent_reload_trustlist (); Modified: trunk/common/estream.c =================================================================== --- trunk/common/estream.c 2009-06-02 15:46:59 UTC (rev 5032) +++ trunk/common/estream.c 2009-06-03 17:24:24 UTC (rev 5033) @@ -897,67 +897,49 @@ }; - -/* Stream primitives. */ - static int es_convert_mode (const char *mode, unsigned int *modeflags) { + unsigned int omode, oflags; - /* FIXME: We need to allow all mode flags permutations. */ - struct - { - const char *mode; - unsigned int flags; - } mode_flags[] = { { "r", - O_RDONLY }, - { "rb", - O_RDONLY | O_BINARY }, - { "w", - O_WRONLY | O_TRUNC | O_CREAT }, - { "wb", - O_WRONLY | O_TRUNC | O_CREAT | O_BINARY }, - { "a", - O_WRONLY | O_APPEND | O_CREAT }, - { "ab", - O_WRONLY | O_APPEND | O_CREAT | O_BINARY }, - { "r+", - O_RDWR }, - { "rb+", - O_RDWR | O_BINARY }, - { "r+b", - O_RDONLY | O_WRONLY | O_BINARY }, - { "w+", - O_RDWR | O_TRUNC | O_CREAT }, - { "wb+", - O_RDWR | O_TRUNC | O_CREAT | O_BINARY }, - { "w+b", - O_RDWR | O_TRUNC | O_CREAT | O_BINARY }, - { "a+", - O_RDWR | O_CREAT | O_APPEND }, - { "ab+", - O_RDWR | O_CREAT | O_APPEND | O_BINARY }, - { "a+b", - O_RDWR | O_CREAT | O_APPEND | O_BINARY } - }; - unsigned int i; - int err; - - for (i = 0; i < DIM (mode_flags); i++) - if (! strcmp (mode_flags[i].mode, mode)) - break; - if (i == DIM (mode_flags)) + switch (*mode) { + case 'r': + omode = O_RDONLY; + oflags = 0; + break; + case 'w': + omode = O_WRONLY; + oflags = O_TRUNC | O_CREAT; + break; + case 'a': + omode = O_WRONLY; + oflags = O_APPEND | O_CREAT; + break; + default: errno = EINVAL; - err = -1; + return -1; } - else + for (mode++; *mode; mode++) { - err = 0; - *modeflags = mode_flags[i].flags; + switch (*mode) + { + case '+': + omode = O_RDWR; + break; + case 'b': + oflags |= O_BINARY; + break; + case 'x': + oflags |= O_EXCL; + break; + default: /* Ignore unknown flags. */ + break; + } } - return err; + *modeflags = (omode | oflags); + return 0; } Modified: trunk/g10/card-util.c =================================================================== --- trunk/g10/card-util.c 2009-06-02 15:46:59 UTC (rev 5032) +++ trunk/g10/card-util.c 2009-06-03 17:24:24 UTC (rev 5033) @@ -195,6 +195,7 @@ case 0x0004: return "Wewid AB"; case 0x0005: return "ZeitControl"; + case 0x002A: return "Magrathea"; /* 0x00000 and 0xFFFF are defined as test cards per spec, 0xFFF00 to 0xFFFE are assigned for use with randomly created serial numbers. */ From cvs at cvs.gnupg.org Thu Jun 4 16:19:22 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Thu, 04 Jun 2009 16:19:22 +0200 Subject: [svn] GnuPG - r5034 - in trunk: artwork jnlib Message-ID: Author: wk Date: 2009-06-04 16:19:21 +0200 (Thu, 04 Jun 2009) New Revision: 5034 Added: trunk/artwork/gnupg-logo-new-single.svg Modified: trunk/jnlib/ChangeLog trunk/jnlib/mischelp.h Log: Define SUN_LEN also for W32. Modified: trunk/jnlib/ChangeLog =================================================================== --- trunk/jnlib/ChangeLog 2009-06-03 17:24:24 UTC (rev 5033) +++ trunk/jnlib/ChangeLog 2009-06-04 14:19:21 UTC (rev 5034) @@ -1,3 +1,7 @@ +2009-06-04 Werner Koch + + * mischelp.h: Include SUN_LEN etc also for W32. + 2009-05-19 Werner Koch * mischelp.h: Define PF_LOCAL, AF_LOCAL and SUN_LEN if requested. Modified: trunk/jnlib/mischelp.h =================================================================== --- trunk/jnlib/mischelp.h 2009-06-03 17:24:24 UTC (rev 5033) +++ trunk/jnlib/mischelp.h 2009-06-04 14:19:21 UTC (rev 5034) @@ -61,9 +61,13 @@ /* Include hacks which are mainly required for Slowaris. */ -#if defined(JNLIB_NEED_AFLOCAL) && !defined(HAVE_W32_SYSTEM) -#include -#include +#ifdef JNLIB_NEED_AFLOCAL +#ifndef HAVE_W32_SYSTEM +# include +# include +#else +# include +#endif #ifndef PF_LOCAL # ifdef PF_UNIX @@ -88,7 +92,7 @@ # define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \ + strlen ((ptr)->sun_path)) #endif /*SUN_LEN*/ -#endif /*JNLIB_NEED_AFLOCAL && !HAVE_W32_SYSTEM*/ +#endif /*JNLIB_NEED_AFLOCAL*/ #endif /*LIBJNLIB_MISCHELP_H*/ From cvs at cvs.gnupg.org Fri Jun 5 11:51:27 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Fri, 05 Jun 2009 11:51:27 +0200 Subject: [svn] ksba - r304 - trunk Message-ID: Author: wk Date: 2009-06-05 11:51:27 +0200 (Fri, 05 Jun 2009) New Revision: 304 Modified: trunk/ChangeLog trunk/NEWS trunk/configure.ac Log: Prepare 1.0.6 Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-05-28 08:07:16 UTC (rev 303) +++ trunk/ChangeLog 2009-06-05 09:51:27 UTC (rev 304) @@ -1,3 +1,9 @@ +2009-06-05 Werner Koch + + Release 1.0.6. + + * configure.ac: Bump LT version to C17/A9/R6. + 2009-01-09 Werner Koch Release 1.0.5. Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2009-05-28 08:07:16 UTC (rev 303) +++ trunk/NEWS 2009-06-05 09:51:27 UTC (rev 304) @@ -1,12 +1,12 @@ -Noteworthy changes in version 1.0.6 +Noteworthy changes in version 1.0.6 (2009-06-05) ------------------------------------------------ * Support SHA-{384,512} based signature generation. * The RSA algorithmIdentifier ASN.1 sequence is now emitted with an - explicit NULL parameter. Despite all the interop testing we did in - the past, some software still requires this and thus we follow the - best current practise now. + explicit NULL parameter. Despite the interop testing we did in the + past, some software still requires this and thus we better follow + the best current practise. Noteworthy changes in version 1.0.5 (2009-01-09) Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2009-05-28 08:07:16 UTC (rev 303) +++ trunk/configure.ac 2009-06-05 09:51:27 UTC (rev 304) @@ -25,7 +25,7 @@ # 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.6]) -m4_define([my_issvn], [yes]) +m4_define([my_issvn], [no]) m4_define([svn_revision], m4_esyscmd([printf "%d" $(svn info 2>/dev/null \ | sed -n '/^Revision:/ s/[^0-9]//gp'|head -1)])) @@ -40,7 +40,7 @@ # Please remember to document interface changes in the NEWS file. LIBKSBA_LT_CURRENT=17 LIBKSBA_LT_AGE=9 -LIBKSBA_LT_REVISION=5 +LIBKSBA_LT_REVISION=6 #------------------- # If the API is changed in an incompatible way: increment the next counter. KSBA_CONFIG_API_VERSION=1 From cvs at cvs.gnupg.org Fri Jun 5 11:55:05 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Fri, 05 Jun 2009 11:55:05 +0200 Subject: [svn] ksba - r305 - tags Message-ID: Author: wk Date: 2009-06-05 11:55:04 +0200 (Fri, 05 Jun 2009) New Revision: 305 Added: tags/libksba-1.0.6/ Log: Release tag From cvs at cvs.gnupg.org Fri Jun 5 12:29:33 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Fri, 05 Jun 2009 12:29:33 +0200 Subject: [svn] ksba - r306 - trunk Message-ID: Author: wk Date: 2009-06-05 12:29:33 +0200 (Fri, 05 Jun 2009) New Revision: 306 Modified: trunk/NEWS trunk/configure.ac Log: post release updates Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2009-06-05 09:55:04 UTC (rev 305) +++ trunk/NEWS 2009-06-05 10:29:33 UTC (rev 306) @@ -1,3 +1,7 @@ +Noteworthy changes in version 1.0.7 +------------------------------------------------ + + Noteworthy changes in version 1.0.6 (2009-06-05) ------------------------------------------------ Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2009-06-05 09:55:04 UTC (rev 305) +++ trunk/configure.ac 2009-06-05 10:29:33 UTC (rev 306) @@ -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.6]) -m4_define([my_issvn], [no]) +m4_define([my_version], [1.0.7]) +m4_define([my_issvn], [yes]) m4_define([svn_revision], m4_esyscmd([printf "%d" $(svn info 2>/dev/null \ | sed -n '/^Revision:/ s/[^0-9]//gp'|head -1)])) From cvs at cvs.gnupg.org Fri Jun 5 15:54:08 2009 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Fri, 05 Jun 2009 15:54:08 +0200 Subject: [svn] GnuPG - r5035 - trunk/tests/openpgp Message-ID: Author: dshaw Date: 2009-06-05 15:54:08 +0200 (Fri, 05 Jun 2009) New Revision: 5035 Modified: trunk/tests/openpgp/ChangeLog trunk/tests/openpgp/defs.inc Log: * defs.inc: Improved all_cipher_algos and all_hash_algos to work when there are more than one line of algorithms. From 1.4. Modified: trunk/tests/openpgp/ChangeLog =================================================================== --- trunk/tests/openpgp/ChangeLog 2009-06-04 14:19:21 UTC (rev 5034) +++ trunk/tests/openpgp/ChangeLog 2009-06-05 13:54:08 UTC (rev 5035) @@ -1,3 +1,8 @@ +2009-06-05 David Shaw + + * defs.inc: Improved all_cipher_algos and all_hash_algos to work + when there are more than one line of algorithms. From 1.4. + 2009-04-19 Werner Koch * mkdemodirs (GPG): Use --no-options. Modified: trunk/tests/openpgp/defs.inc =================================================================== --- trunk/tests/openpgp/defs.inc 2009-06-04 14:19:21 UTC (rev 5034) +++ trunk/tests/openpgp/defs.inc 2009-06-05 13:54:08 UTC (rev 5035) @@ -148,14 +148,13 @@ } all_cipher_algos () { - ../../g10/gpg2 --homedir . --version | grep "Cipher" | sed 's/^Cipher: //; s/,//g' + ../../g10/gpg2 --homedir . --with-colons --list-config ciphername | sed 's/^cfg:ciphername://; s/;/ /g' } all_hash_algos () { - ../../g10/gpg2 --homedir . --version | grep "Hash" | sed 's/^Hash: //; s/,//g' + ../../g10/gpg2 --homedir . --with-colons --list-config digestname | sed 's/^cfg:digestname://; s/;/ /g' } - set -e pgmname=`basename $0` #trap cleanup SIGHUP SIGINT SIGQUIT From cvs at cvs.gnupg.org Fri Jun 5 16:11:04 2009 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Fri, 05 Jun 2009 16:11:04 +0200 Subject: [svn] GnuPG - r5036 - in trunk: . g10 Message-ID: Author: dshaw Date: 2009-06-05 16:11:03 +0200 (Fri, 05 Jun 2009) New Revision: 5036 Modified: trunk/ChangeLog trunk/configure.ac trunk/g10/ChangeLog trunk/g10/cipher.c trunk/g10/encode.c trunk/g10/encr-data.c trunk/g10/gpg.c trunk/g10/main.h trunk/g10/mainproc.c trunk/g10/misc.c trunk/g10/passphrase.c trunk/g10/pubkey-enc.c trunk/g10/seckey-cert.c trunk/g10/seskey.c Log: Add full Camellia support. * configure.ac: Remove Camellia restriction. * gpg.c (main), misc.c (openpgp_cipher_test_algo): Remove Camellia restriction. * misc.c (map_cipher_openpgp_to_gcry), main.h: Add macros for openpgp_cipher_open, openpgp_cipher_get_algo_keylen, and openpgp_cipher_get_algo_blklen to wrap around the corresponding gcry_* functions, but pass the algorithm number through map_cipher_openpgp_to_gcry. This is needed in case the gcry algorithm number doesn't match the OpenPGP number (c.f. Camellia). * encr-data.c, pubkey-enc.c, mainproc.c, cipher.c, encode.c, seskey.c, passphrase.c, seckey-cert.c: Use new openpgp_cipher_* macros here. Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-06-05 13:54:08 UTC (rev 5035) +++ trunk/ChangeLog 2009-06-05 14:11:03 UTC (rev 5036) @@ -1,3 +1,7 @@ +2009-06-05 David Shaw + + * configure.ac: Remove Camellia restriction. + 2009-04-01 Werner Koch * configure.ac: Test for fsync. Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2009-06-05 13:54:08 UTC (rev 5035) +++ trunk/g10/ChangeLog 2009-06-05 14:11:03 UTC (rev 5036) @@ -1,3 +1,19 @@ +2009-06-05 David Shaw + + * gpg.c (main), misc.c (openpgp_cipher_test_algo): Remove Camellia + restriction. + + * misc.c (map_cipher_openpgp_to_gcry), main.h: Add macros for + openpgp_cipher_open, openpgp_cipher_get_algo_keylen, and + openpgp_cipher_get_algo_blklen to wrap around the corresponding + gcry_* functions, but pass the algorithm number through + map_cipher_openpgp_to_gcry. This is needed in case the gcry + algorithm number doesn't match the OpenPGP number (c.f. Camellia). + + * encr-data.c, pubkey-enc.c, mainproc.c, cipher.c, encode.c, + seskey.c, passphrase.c, seckey-cert.c: Use new openpgp_cipher_* + macros here. + 2009-06-02 Werner Koch * card-util.c (get_manufacturer): Add new manufacturer. Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2009-06-05 13:54:08 UTC (rev 5035) +++ trunk/configure.ac 2009-06-05 14:11:03 UTC (rev 5036) @@ -74,7 +74,6 @@ use_bzip2=yes use_exec=yes disable_keyserver_path=no -use_camellia=no GNUPG_BUILD_PROGRAM(gpg, yes) @@ -174,22 +173,6 @@ use_bzip2=$enableval) AC_MSG_RESULT($use_bzip2) -# Check whether testing support for Camellia has been requested -AC_MSG_CHECKING([whether to enable the CAMELLIA cipher for gpg]) -AC_ARG_ENABLE(camellia, - AC_HELP_STRING([--enable-camellia],[enable the CAMELLIA cipher for gpg]), - use_camellia=$enableval) -AC_MSG_RESULT($use_camellia) -if test x"$use_camellia" = xyes ; then - AC_DEFINE(USE_CAMELLIA,1,[Define to include the CAMELLIA cipher into gpg]) - AC_MSG_WARN([[ -*** -*** The Camellia cipher for gpg is for testing only and -*** is NOT for production use! -***]]) -fi - - # Configure option to allow or disallow execution of external # programs, like a photo viewer. AC_MSG_CHECKING([whether to enable external program execution]) @@ -1489,10 +1472,3 @@ gpg-check-pattern will not be build. " fi -if test x"$use_camellia" = xyes ; then - echo - echo "WARNING: The Camellia cipher for gpg is for testing only" - echo " and is NOT for production use!" - echo -fi - Modified: trunk/g10/cipher.c =================================================================== --- trunk/g10/cipher.c 2009-06-05 13:54:08 UTC (rev 5035) +++ trunk/g10/cipher.c 2009-06-05 14:11:03 UTC (rev 5036) @@ -1,6 +1,6 @@ /* cipher.c - En-/De-ciphering filter * Copyright (C) 1998, 1999, 2000, 2001, 2003, - * 2006 Free Software Foundation, Inc. + * 2006, 2009 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -49,7 +49,7 @@ unsigned int blocksize; unsigned int nprefix; - blocksize = gcry_cipher_get_algo_blklen (cfx->dek->algo); + blocksize = openpgp_cipher_get_algo_blklen (cfx->dek->algo); if ( blocksize < 8 || blocksize > 16 ) log_fatal("unsupported blocksize %u\n", blocksize ); @@ -81,12 +81,12 @@ temp[nprefix] = temp[nprefix-2]; temp[nprefix+1] = temp[nprefix-1]; print_cipher_algo_note( cfx->dek->algo ); - err = gcry_cipher_open (&cfx->cipher_hd, - cfx->dek->algo, - GCRY_CIPHER_MODE_CFB, - (GCRY_CIPHER_SECURE - | ((cfx->dek->use_mdc || cfx->dek->algo >= 100)? - 0 : GCRY_CIPHER_ENABLE_SYNC))); + err = openpgp_cipher_open (&cfx->cipher_hd, + cfx->dek->algo, + GCRY_CIPHER_MODE_CFB, + (GCRY_CIPHER_SECURE + | ((cfx->dek->use_mdc || cfx->dek->algo >= 100)? + 0 : GCRY_CIPHER_ENABLE_SYNC))); if (err) { /* We should never get an error here cause we already checked, * that the algorithm is available. */ Modified: trunk/g10/encode.c =================================================================== --- trunk/g10/encode.c 2009-06-05 13:54:08 UTC (rev 5035) +++ trunk/g10/encode.c 2009-06-05 14:11:03 UTC (rev 5036) @@ -1,6 +1,6 @@ /* encode.c - encode data * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - * 2006 Free Software Foundation, Inc. + * 2006, 2009 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -86,7 +86,7 @@ /* We only pass already checked values to the following fucntion, thus we consider any failure as fatal. */ - if (gcry_cipher_open (&hd, dek->algo, GCRY_CIPHER_MODE_CFB, 1)) + if (openpgp_cipher_open (&hd, dek->algo, GCRY_CIPHER_MODE_CFB, 1)) BUG (); if (gcry_cipher_setkey (hd, dek->key, dek->keylen)) BUG (); @@ -142,7 +142,7 @@ /* Last try. Use MDC for the modern ciphers. */ - if (gcry_cipher_get_algo_blklen (algo) != 8) + if (openpgp_cipher_get_algo_blklen (algo) != 8) return 1; if (opt.verbose) @@ -237,7 +237,7 @@ { DEK *dek = NULL; - seskeylen = gcry_cipher_get_algo_keylen (default_cipher_algo ()); + seskeylen = openpgp_cipher_get_algo_keylen (default_cipher_algo ()); encode_seskey( cfx.dek, &dek, enckey ); xfree( cfx.dek ); cfx.dek = dek; } @@ -411,7 +411,7 @@ static int write_symkey_enc(STRING2KEY *symkey_s2k,DEK *symkey_dek,DEK *dek,IOBUF out) { - int rc, seskeylen = gcry_cipher_get_algo_keylen (dek->algo); + int rc, seskeylen = openpgp_cipher_get_algo_keylen (dek->algo); PKT_symkey_enc *enc; byte enckey[33]; Modified: trunk/g10/encr-data.c =================================================================== --- trunk/g10/encr-data.c 2009-06-05 13:54:08 UTC (rev 5035) +++ trunk/g10/encr-data.c 2009-06-05 14:11:03 UTC (rev 5036) @@ -1,6 +1,6 @@ /* encr-data.c - process an encrypted data packet * Copyright (C) 1998, 1999, 2000, 2001, 2005, - * 2006 Free Software Foundation, Inc. + * 2006, 2009 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -98,7 +98,7 @@ rc = openpgp_cipher_test_algo (dek->algo); if (rc) goto leave; - blocksize = gcry_cipher_get_algo_blklen (dek->algo); + blocksize = openpgp_cipher_get_algo_blklen (dek->algo); if ( !blocksize || blocksize > 16 ) log_fatal ("unsupported blocksize %u\n", blocksize ); nprefix = blocksize; @@ -113,11 +113,11 @@ gcry_md_start_debug (dfx->mdc_hash, "checkmdc"); } - rc = gcry_cipher_open (&dfx->cipher_hd, dek->algo, - GCRY_CIPHER_MODE_CFB, - (GCRY_CIPHER_SECURE - | ((ed->mdc_method || dek->algo >= 100)? - 0 : GCRY_CIPHER_ENABLE_SYNC))); + rc = openpgp_cipher_open (&dfx->cipher_hd, dek->algo, + GCRY_CIPHER_MODE_CFB, + (GCRY_CIPHER_SECURE + | ((ed->mdc_method || dek->algo >= 100)? + 0 : GCRY_CIPHER_ENABLE_SYNC))); if (rc) { /* We should never get an error here cause we already checked Modified: trunk/g10/gpg.c =================================================================== --- trunk/g10/gpg.c 2009-06-05 13:54:08 UTC (rev 5035) +++ trunk/g10/gpg.c 2009-06-05 14:11:03 UTC (rev 5036) @@ -1,6 +1,6 @@ /* gpg.c - The GnuPG utility (main for gpg) * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - * 2006, 2007, 2008 Free Software Foundation, Inc. + * 2006, 2007, 2008, 2009 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -2963,15 +2963,6 @@ log_set_prefix (NULL, 1|2|4); } -#ifdef USE_CAMELLIA - /* We better also print a runtime warning if people build it with - support for Camellia (which is not yet defined by OpenPGP). */ - log_info ("WARNING: This version has been built with support for the " - "Camellia cipher.\n"); - log_info (" It is for testing only and is NOT for production " - "use!\n"); -#endif - /* Older Libgcrypts fail with an assertion during DSA key generation. Better disable DSA2 entirely. */ if (opt.flags.dsa2 && !gcry_check_version ("1.4.0") ) @@ -4323,4 +4314,3 @@ if(critical) sl->flags |= 1; } - Modified: trunk/g10/main.h =================================================================== --- trunk/g10/main.h 2009-06-05 13:54:08 UTC (rev 5035) +++ trunk/g10/main.h 2009-06-05 14:11:03 UTC (rev 5036) @@ -1,6 +1,6 @@ /* main.h * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - * 2008 Free Software Foundation, Inc. + * 2008, 2009 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -82,6 +82,10 @@ u16 checksum_mpi( gcry_mpi_t a ); u32 buffer_to_u32( const byte *buffer ); const byte *get_session_marker( size_t *rlen ); +int map_cipher_openpgp_to_gcry (int algo); +#define openpgp_cipher_open(_a,_b,_c,_d) gcry_cipher_open((_a),map_cipher_openpgp_to_gcry((_b)),(_c),(_d)) +#define openpgp_cipher_get_algo_keylen(_a) gcry_cipher_get_algo_keylen(map_cipher_openpgp_to_gcry((_a))) +#define openpgp_cipher_get_algo_blklen(_a) gcry_cipher_get_algo_blklen(map_cipher_openpgp_to_gcry((_a))) int openpgp_cipher_blocklen (int algo); int openpgp_cipher_test_algo( int algo ); const char *openpgp_cipher_algo_name (int algo); Modified: trunk/g10/mainproc.c =================================================================== --- trunk/g10/mainproc.c 2009-06-05 13:54:08 UTC (rev 5035) +++ trunk/g10/mainproc.c 2009-06-05 14:11:03 UTC (rev 5036) @@ -1,6 +1,6 @@ /* mainproc.c - handle packets * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - * 2008 Free Software Foundation, Inc. + * 2008, 2009 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -233,7 +233,7 @@ return G10ERR_BAD_KEY; } - if (gcry_cipher_open (&hd, dek->algo, GCRY_CIPHER_MODE_CFB, 1)) + if (openpgp_cipher_open (&hd, dek->algo, GCRY_CIPHER_MODE_CFB, 1)) BUG (); if (gcry_cipher_setkey ( hd, dek->key, dek->keylen )) BUG (); Modified: trunk/g10/misc.c =================================================================== --- trunk/g10/misc.c 2009-06-05 13:54:08 UTC (rev 5035) +++ trunk/g10/misc.c 2009-06-05 14:11:03 UTC (rev 5036) @@ -1,6 +1,6 @@ /* misc.c - miscellaneous functions * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - * 2008 Free Software Foundation, Inc. + * 2008, 2009 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -340,7 +340,7 @@ /* Map OpenPGP algo numbers to those used by Libgcrypt. We need to do this for algorithms we implemented in Libgcrypt after they become part of OpenPGP. */ -static int +int map_cipher_openpgp_to_gcry (int algo) { switch (algo) @@ -400,15 +400,6 @@ if ( algo < 0 || algo > 110 || algo == 5 || algo == 6 ) return gpg_error (GPG_ERR_CIPHER_ALGO); - /* Camellia is not yet defined for OpenPGP thus only allow it if - requested. */ -#ifndef USE_CAMELLIA - if (algo == CIPHER_ALGO_CAMELLIA128 - || algo == CIPHER_ALGO_CAMELLIA192 - || algo == CIPHER_ALGO_CAMELLIA256) - return gpg_error (GPG_ERR_CIPHER_ALGO); -#endif - return gcry_cipher_test_algo (map_cipher_openpgp_to_gcry (algo)); } Modified: trunk/g10/passphrase.c =================================================================== --- trunk/g10/passphrase.c 2009-06-05 13:54:08 UTC (rev 5035) +++ trunk/g10/passphrase.c 2009-06-05 14:11:03 UTC (rev 5036) @@ -1,6 +1,6 @@ /* passphrase.c - Get a passphrase * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, - * 2005, 2006, 2007 Free Software Foundation, Inc. + * 2005, 2006, 2007, 2009 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -61,7 +61,7 @@ int pwlen = strlen(pw); assert ( s2k->hash_algo ); - dek->keylen = gcry_cipher_get_algo_keylen (dek->algo); + dek->keylen = openpgp_cipher_get_algo_keylen (dek->algo); if ( !(dek->keylen > 0 && dek->keylen <= DIM(dek->key)) ) BUG(); Modified: trunk/g10/pubkey-enc.c =================================================================== --- trunk/g10/pubkey-enc.c 2009-06-05 13:54:08 UTC (rev 5035) +++ trunk/g10/pubkey-enc.c 2009-06-05 14:11:03 UTC (rev 5036) @@ -1,6 +1,6 @@ /* pubkey-enc.c - public key encoded packet handling * Copyright (C) 1998, 1999, 2000, 2001, 2002, - * 2006 Free Software Foundation, Inc. + * 2006, 2009 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -251,7 +251,7 @@ dek->algo = 0; goto leave; } - if ( dek->keylen != gcry_cipher_get_algo_keylen (dek->algo) ) { + if ( dek->keylen != openpgp_cipher_get_algo_keylen (dek->algo) ) { rc = GPG_ERR_WRONG_SECKEY; goto leave; } Modified: trunk/g10/seckey-cert.c =================================================================== --- trunk/g10/seckey-cert.c 2009-06-05 13:54:08 UTC (rev 5035) +++ trunk/g10/seckey-cert.c 2009-06-05 14:11:03 UTC (rev 5036) @@ -1,6 +1,6 @@ /* seckey-cert.c - secret key certificate packet handling * Copyright (C) 1998, 1999, 2000, 2001, 2002, - * 2006 Free Software Foundation, Inc. + * 2006, 2009 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -86,11 +86,11 @@ return G10ERR_GENERAL; - err = gcry_cipher_open (&cipher_hd, sk->protect.algo, - GCRY_CIPHER_MODE_CFB, - (GCRY_CIPHER_SECURE - | (sk->protect.algo >= 100 ? - 0 : GCRY_CIPHER_ENABLE_SYNC))); + err = openpgp_cipher_open (&cipher_hd, sk->protect.algo, + GCRY_CIPHER_MODE_CFB, + (GCRY_CIPHER_SECURE + | (sk->protect.algo >= 100 ? + 0 : GCRY_CIPHER_ENABLE_SYNC))); if (err) log_fatal ("cipher open failed: %s\n", gpg_strerror (err) ); @@ -351,16 +351,16 @@ else { print_cipher_algo_note( sk->protect.algo ); - if ( gcry_cipher_open (&cipher_hd, sk->protect.algo, - GCRY_CIPHER_MODE_CFB, - (GCRY_CIPHER_SECURE - | (sk->protect.algo >= 100 ? - 0 : GCRY_CIPHER_ENABLE_SYNC))) ) + if ( openpgp_cipher_open (&cipher_hd, sk->protect.algo, + GCRY_CIPHER_MODE_CFB, + (GCRY_CIPHER_SECURE + | (sk->protect.algo >= 100 ? + 0 : GCRY_CIPHER_ENABLE_SYNC))) ) BUG(); if ( gcry_cipher_setkey ( cipher_hd, dek->key, dek->keylen ) ) log_info(_("WARNING: Weak key detected" " - please change passphrase again.\n")); - sk->protect.ivlen = gcry_cipher_get_algo_blklen (sk->protect.algo); + sk->protect.ivlen = openpgp_cipher_get_algo_blklen (sk->protect.algo); assert( sk->protect.ivlen <= DIM(sk->protect.iv) ); if( sk->protect.ivlen != 8 && sk->protect.ivlen != 16 ) BUG(); /* yes, we are very careful */ @@ -471,4 +471,3 @@ } return rc; } - Modified: trunk/g10/seskey.c =================================================================== --- trunk/g10/seskey.c 2009-06-05 13:54:08 UTC (rev 5035) +++ trunk/g10/seskey.c 2009-06-05 14:11:03 UTC (rev 5036) @@ -1,6 +1,6 @@ /* seskey.c - make sesssion keys etc. * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, - * 2006 Free Software Foundation, Inc. + * 2006, 2009 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -40,12 +40,12 @@ gcry_cipher_hd_t chd; int i, rc; - dek->keylen = gcry_cipher_get_algo_keylen (dek->algo); + dek->keylen = openpgp_cipher_get_algo_keylen (dek->algo); - if (gcry_cipher_open (&chd, dek->algo, GCRY_CIPHER_MODE_CFB, - (GCRY_CIPHER_SECURE - | (dek->algo >= 100 ? - 0 : GCRY_CIPHER_ENABLE_SYNC))) ) + if (openpgp_cipher_open (&chd, dek->algo, GCRY_CIPHER_MODE_CFB, + (GCRY_CIPHER_SECURE + | (dek->algo >= 100 ? + 0 : GCRY_CIPHER_ENABLE_SYNC))) ) BUG(); gcry_randomize (dek->key, dek->keylen, GCRY_STRONG_RANDOM ); for (i=0; i < 16; i++ ) From cvs at cvs.gnupg.org Fri Jun 5 18:54:48 2009 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Fri, 05 Jun 2009 18:54:48 +0200 Subject: [svn] GnuPG - r5037 - in branches/STABLE-BRANCH-1-4: . g10 Message-ID: Author: dshaw Date: 2009-06-05 18:54:47 +0200 (Fri, 05 Jun 2009) New Revision: 5037 Modified: branches/STABLE-BRANCH-1-4/ChangeLog branches/STABLE-BRANCH-1-4/configure.ac branches/STABLE-BRANCH-1-4/g10/ChangeLog branches/STABLE-BRANCH-1-4/g10/gpg.c Log: Remove Camellia restriction. Modified: branches/STABLE-BRANCH-1-4/ChangeLog =================================================================== --- branches/STABLE-BRANCH-1-4/ChangeLog 2009-06-05 14:11:03 UTC (rev 5036) +++ branches/STABLE-BRANCH-1-4/ChangeLog 2009-06-05 16:54:47 UTC (rev 5037) @@ -1,3 +1,7 @@ +2009-06-05 David Shaw + + * configure.ac: Remove Camellia restriction. + 2008-10-03 David Shaw * configure.ac, acinclude.m4: Remove GNUPG_CHECK_DOCBOOK_TO_TEXI Modified: branches/STABLE-BRANCH-1-4/g10/ChangeLog =================================================================== --- branches/STABLE-BRANCH-1-4/g10/ChangeLog 2009-06-05 14:11:03 UTC (rev 5036) +++ branches/STABLE-BRANCH-1-4/g10/ChangeLog 2009-06-05 16:54:47 UTC (rev 5037) @@ -1,3 +1,7 @@ +2009-06-05 David Shaw + + * gpg.c (main): Remove Camellia restriction. + 2009-06-02 Werner Koch * gpgv.c (tty_cleanup_after_signal): Add new stub. Modified: branches/STABLE-BRANCH-1-4/configure.ac =================================================================== --- branches/STABLE-BRANCH-1-4/configure.ac 2009-06-05 14:11:03 UTC (rev 5036) +++ branches/STABLE-BRANCH-1-4/configure.ac 2009-06-05 16:54:47 UTC (rev 5037) @@ -1,6 +1,6 @@ # configure.ac script for GnuPG # Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, -# 2008 Free Software Foundation, Inc. +# 2008, 2009 Free Software Foundation, Inc. # # This file is part of GnuPG. # @@ -139,7 +139,7 @@ use_blowfish=yes use_aes=yes use_twofish=yes -use_camellia=no +use_camellia=yes use_sha256=yes use_sha512=yes use_bzip2=yes @@ -263,10 +263,6 @@ AC_MSG_RESULT($use_camellia) if test x"$use_camellia" = xyes ; then AC_DEFINE(USE_CAMELLIA,1,[Define to include the CAMELLIA cipher]) - AC_MSG_WARN([[ -*** -*** The Camellia cipher is for testing only and is NOT for production use! -***]]) fi AC_MSG_CHECKING([whether to enable the SHA-224 and SHA-256 digests]) @@ -1452,9 +1448,3 @@ echo " Extra cpu specific functions:$show_extraasm" fi echo - -if test x"$use_camellia" = xyes ; then - echo "WARNING: The Camellia cipher is for testing only and is NOT for production use!" - echo -fi - Modified: branches/STABLE-BRANCH-1-4/g10/gpg.c =================================================================== --- branches/STABLE-BRANCH-1-4/g10/gpg.c 2009-06-05 14:11:03 UTC (rev 5036) +++ branches/STABLE-BRANCH-1-4/g10/gpg.c 2009-06-05 16:54:47 UTC (rev 5037) @@ -1,6 +1,6 @@ /* gpg.c - The GnuPG utility (main for gpg) * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - * 2007, 2008 Free Software Foundation, Inc. + * 2007, 2008, 2009 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -2933,14 +2933,6 @@ log_info("%s\n",s); } #endif -#ifdef USE_CAMELLIA - /* We better also print a runtime warning if people build it with - support for Camellia (which is not yet defiend by OpenPGP). */ - log_info ("WARNING: This version has been built with support for the " - "Camellia cipher.\n"); - log_info (" It is for testing only and is NOT for production " - "use!\n"); -#endif if (opt.verbose > 2) log_info ("using character set `%s'\n", get_native_charset ()); From cvs at cvs.gnupg.org Fri Jun 5 22:51:53 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Fri, 05 Jun 2009 22:51:53 +0200 Subject: [svn] GnuPG - r5038 - trunk/agent Message-ID: Author: wk Date: 2009-06-05 22:51:52 +0200 (Fri, 05 Jun 2009) New Revision: 5038 Modified: trunk/agent/ChangeLog trunk/agent/protect-tool.c Log: Fix last change Modified: trunk/agent/ChangeLog =================================================================== --- trunk/agent/ChangeLog 2009-06-05 16:54:47 UTC (rev 5037) +++ trunk/agent/ChangeLog 2009-06-05 20:51:52 UTC (rev 5038) @@ -1,3 +1,8 @@ +2009-06-05 Werner Koch + + * protect-tool.c (store_private_key): Fix last change by appending + a ".key". + 2009-06-03 Werner Koch * protect-tool.c: Include estream.h. @@ -4,7 +9,7 @@ (store_private_key): Replace stdio streams by estream functions for a portable use of the "x" mode. * trustlist.c: Include estream.h. - (agent_marktrusted): Repalce stdio stream by estream functions. + (agent_marktrusted): Replace stdio stream by estream functions. * protect-tool.c (store_private_key): Use bin2hex. Modified: trunk/agent/protect-tool.c =================================================================== --- trunk/agent/protect-tool.c 2009-06-05 16:54:47 UTC (rev 5037) +++ trunk/agent/protect-tool.c 2009-06-05 20:51:52 UTC (rev 5038) @@ -1205,6 +1205,7 @@ char hexgrip[40+4+1]; bin2hex (grip, 20, hexgrip); + strcpy (hexgrip+40, ".key"); fname = make_filename (opt_homedir, GNUPG_PRIVATE_KEYS_DIR, hexgrip, NULL); if (force) From cvs at cvs.gnupg.org Mon Jun 8 10:15:34 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Mon, 08 Jun 2009 10:15:34 +0200 Subject: [svn] GnuPG - r5039 - trunk/tools Message-ID: Author: wk Date: 2009-06-08 10:15:34 +0200 (Mon, 08 Jun 2009) New Revision: 5039 Modified: trunk/tools/ChangeLog trunk/tools/gpgconf.c Log: Help against closed standard descriptors. Modified: trunk/tools/ChangeLog =================================================================== --- trunk/tools/ChangeLog 2009-06-05 20:51:52 UTC (rev 5038) +++ trunk/tools/ChangeLog 2009-06-08 08:15:34 UTC (rev 5039) @@ -1,3 +1,7 @@ +2009-06-08 Werner Koch + + * gpgconf.c (main): Call gnupg_reopen_std. Should fix bug#1072. + 2009-05-19 Werner Koch * watchgnupg.c: Include jnlib/mischelp.h if required. Modified: trunk/tools/gpgconf.c =================================================================== --- trunk/tools/gpgconf.c 2009-06-05 20:51:52 UTC (rev 5038) +++ trunk/tools/gpgconf.c 2009-06-08 08:15:34 UTC (rev 5039) @@ -25,6 +25,7 @@ #include "gpgconf.h" #include "i18n.h" +#include "sysutils.h" /* Constants to identify the commands and options. */ enum cmd_and_opt_values @@ -145,6 +146,7 @@ enum cmd_and_opt_values cmd = 0; FILE *outfp = NULL; + gnupg_reopen_std ("gpgconf"); set_strusage (my_strusage); log_set_prefix ("gpgconf", 1); From cvs at cvs.gnupg.org Mon Jun 8 11:11:32 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Mon, 08 Jun 2009 11:11:32 +0200 Subject: [svn] GnuPG - r5040 - in trunk: po scd Message-ID: Author: wk Date: 2009-06-08 11:11:27 +0200 (Mon, 08 Jun 2009) New Revision: 5040 Modified: 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/scd/app-openpgp.c Log: Typo fix. Updated German translation. 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/scd/app-openpgp.c =================================================================== --- trunk/scd/app-openpgp.c 2009-06-08 08:15:34 UTC (rev 5039) +++ trunk/scd/app-openpgp.c 2009-06-08 09:11:27 UTC (rev 5040) @@ -2833,11 +2833,11 @@ } - /* If a fingerprint has been specified check it against the one on - the card. This is allows for a meaningful error message in case - the key on the card has been replaced but the shadow information - known to gpg was not updated. If there is no fingerprint we - assume that this is okay. */ +/* If a fingerprint has been specified check it against the one on the + card. This allows for a meaningful error message in case the key + on the card has been replaced but the shadow information known to + gpg has not been updated. If there is no fingerprint we assume + that this is okay. */ static gpg_error_t check_against_given_fingerprint (app_t app, const char *fpr, int keyno) { From cvs at cvs.gnupg.org Tue Jun 9 14:13:28 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue, 09 Jun 2009 14:13:28 +0200 Subject: [svn] gpgme - r1370 - trunk/src Message-ID: Author: wk Date: 2009-06-09 14:13:28 +0200 (Tue, 09 Jun 2009) New Revision: 1370 Modified: trunk/src/ChangeLog trunk/src/util.h Log: Define error code. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2009-05-28 15:16:01 UTC (rev 1369) +++ trunk/src/ChangeLog 2009-06-09 12:13:28 UTC (rev 1370) @@ -1,3 +1,7 @@ +2009-06-09 Werner Koch + + * util.h (GPG_ERR_NOT_OPERATIONAL): Define. + 2009-05-28 Marcus Brinkmann * gpgme.h.in (gpgme_check_version_internal): New prototype. Modified: trunk/src/util.h =================================================================== --- trunk/src/util.h 2009-05-28 15:16:01 UTC (rev 1369) +++ trunk/src/util.h 2009-06-09 12:13:28 UTC (rev 1370) @@ -120,6 +120,8 @@ #ifndef GPG_ERR_UNFINISHED #define GPG_ERR_UNFINISHED 199 #endif +#ifndef GPG_ERR_NOT_OPERATIONAL +#define GPG_ERR_NOT_OPERATIONAL 176 +#endif - #endif /* UTIL_H */ From cvs at cvs.gnupg.org Tue Jun 9 14:44:35 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue, 09 Jun 2009 14:44:35 +0200 Subject: [svn] gpgme - r1371 - trunk/src Message-ID: Author: wk Date: 2009-06-09 14:44:35 +0200 (Tue, 09 Jun 2009) New Revision: 1371 Modified: trunk/src/ChangeLog trunk/src/Makefile.am Log: Do not distribute gpgme.h. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2009-06-09 12:13:28 UTC (rev 1370) +++ trunk/src/ChangeLog 2009-06-09 12:44:35 UTC (rev 1371) @@ -1,5 +1,9 @@ 2009-06-09 Werner Koch + * Makefile.am (main_sources): Remove gpgme.h. + (include_HEADERS): Rename to nodist_include_HEADERS so that a + VPATH build won't use the distributed one. + * util.h (GPG_ERR_NOT_OPERATIONAL): Define. 2009-05-28 Marcus Brinkmann Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2009-06-09 12:13:28 UTC (rev 1370) +++ trunk/src/Makefile.am 2009-06-09 12:44:35 UTC (rev 1371) @@ -14,8 +14,7 @@ # Public License for more details. # # You should have received a copy of the GNU Lesser General Public -# License along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA +# License along with this program; if not, see . ## Process this file with automake to produce Makefile.in @@ -27,7 +26,7 @@ bin_SCRIPTS = gpgme-config m4datadir = $(datadir)/aclocal m4data_DATA = gpgme.m4 -include_HEADERS = gpgme.h +nodist_include_HEADERS = gpgme.h if HAVE_PTHREAD ltlib_gpgme_pthread = libgpgme-pthread.la @@ -95,7 +94,7 @@ # right linking order with libtool, as the non-installed version has # unresolved symbols to the thread module. main_sources = \ - gpgme.h util.h conversion.c get-env.c context.h ops.h \ + util.h conversion.c get-env.c context.h ops.h \ data.h data.c data-fd.c data-stream.c data-mem.c data-user.c \ data-compat.c \ signers.c sig-notation.c \ From cvs at cvs.gnupg.org Tue Jun 9 18:01:02 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue, 09 Jun 2009 18:01:02 +0200 Subject: [svn] gpgme - r1372 - in trunk: . src tests tests/gpg Message-ID: Author: wk Date: 2009-06-09 18:01:02 +0200 (Tue, 09 Jun 2009) New Revision: 1372 Modified: trunk/NEWS trunk/src/ChangeLog trunk/src/gpgme.c trunk/src/gpgme.def trunk/src/gpgme.h.in trunk/src/libgpgme.vers trunk/src/version.c trunk/tests/ChangeLog trunk/tests/gpg/Makefile.am trunk/tests/gpg/mkdemodirs.in trunk/tests/gpg/t-edit.c Log: Add gpgme_io_write and gpgme_io_read. Minor cleanups. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2009-06-09 12:44:35 UTC (rev 1371) +++ trunk/src/ChangeLog 2009-06-09 16:01:02 UTC (rev 1372) @@ -1,5 +1,12 @@ 2009-06-09 Werner Koch + * version.c (gpgme_check_version_internal): Make result const. + + * gpgme.c: Include priv-io.h. + (gpgme_io_read, gpgme_io_write): New. + * libgpgme.vers (GPGME_1.1): Add them. + * gpgme.def: Ditto. + * Makefile.am (main_sources): Remove gpgme.h. (include_HEADERS): Rename to nodist_include_HEADERS so that a VPATH build won't use the distributed one. Modified: trunk/tests/ChangeLog =================================================================== --- trunk/tests/ChangeLog 2009-06-09 12:44:35 UTC (rev 1371) +++ trunk/tests/ChangeLog 2009-06-09 16:01:02 UTC (rev 1372) @@ -1,3 +1,12 @@ +2009-06-09 Werner Koch + + * gpg/Makefile.am (./pubring.gpg): Ignore errors in case of + already imported keys. Add --no-permission-warning and remove + obsolete --allow-secret-key-import. + * gpg/mkdemodirs.in (GPG): Add --no-permission-warning. + + * gpg/t-edit.c (edit_fnc): Use gpgme_io_write. + 2009-04-19 Moritz * gpg/Makefile.am (EXTRA_DIST): Replaced mkdemodirs with mkdemodirs.in. Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2009-06-09 12:44:35 UTC (rev 1371) +++ trunk/NEWS 2009-06-09 16:01:02 UTC (rev 1372) @@ -8,6 +8,10 @@ selftest failed (for example, if -mms-bitfields was not used on MingW32 targets). + * New functions gpgme_io_read and gpgme_io_write for use with + gpgme_passphrase_cb_t and gpgme_edit_cb_t functions. + + * Interface changes relative to the 1.1.7 release: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GPGME_KEYLIST_MODE_EPHEMERAL NEW. @@ -22,6 +26,8 @@ GPGME_ENCRYPT_NO_ENCRYPT_TO NEW. gpgme_check_version CHANGED: Is now a macro. gpgme_new EXTENDED: More failure codes. + gpgme_io_read NEW. + gpgme_io_write NEW. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Modified: trunk/src/gpgme.c =================================================================== --- trunk/src/gpgme.c 2009-06-09 12:44:35 UTC (rev 1371) +++ trunk/src/gpgme.c 2009-06-09 16:01:02 UTC (rev 1372) @@ -34,6 +34,7 @@ #include "ops.h" #include "wait.h" #include "debug.h" +#include "priv-io.h" /* The default locale. */ @@ -428,6 +429,33 @@ } +/* This function provides access to the internal read function; it is + normally not used. */ +ssize_t +gpgme_io_read (int fd, void *buffer, size_t count) +{ + int ret; + + ret = _gpgme_io_read (fd, buffer, count); + + return ret; +} + + +/* This function provides access to the internal write function. It + is to be used by user callbacks to return data to gpgme. See + gpgme_passphrase_cb_t and gpgme_edit_cb_t. */ +ssize_t +gpgme_io_write (int fd, const void *buffer, size_t count) +{ + int ret; + + ret = _gpgme_io_write (fd, buffer, count); + + return ret; +} + + /* This function returns the callback function for I/O. */ void gpgme_get_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs) Modified: trunk/src/gpgme.def =================================================================== --- trunk/src/gpgme.def 2009-06-09 12:44:35 UTC (rev 1371) +++ trunk/src/gpgme.def 2009-06-09 16:01:02 UTC (rev 1372) @@ -173,6 +173,10 @@ gpgme_op_assuan_transact @134 gpgme_check_version_internal @135 + + gpgme_io_read @136 + gpgme_io_write @137 + ; END Modified: trunk/src/gpgme.h.in =================================================================== --- trunk/src/gpgme.h.in 2009-06-09 12:44:35 UTC (rev 1371) +++ trunk/src/gpgme.h.in 2009-06-09 16:01:02 UTC (rev 1372) @@ -961,6 +961,11 @@ /* Get the current I/O callback functions. */ void gpgme_get_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs); +/* Wrappers around the internal I/O functions for use with + gpgme_passphrase_cb_t and gpgme_edit_cb_t. */ +ssize_t gpgme_io_read (int fd, void *buffer, size_t count); +ssize_t gpgme_io_write (int fd, const void *buffer, size_t count); + /* Process the pending operation and, if HANG is non-zero, wait for the pending operation to finish. */ gpgme_ctx_t gpgme_wait (gpgme_ctx_t ctx, gpgme_error_t *status, int hang); Modified: trunk/src/libgpgme.vers =================================================================== --- trunk/src/libgpgme.vers 2009-06-09 12:44:35 UTC (rev 1371) +++ trunk/src/libgpgme.vers 2009-06-09 16:01:02 UTC (rev 1372) @@ -53,6 +53,10 @@ gpgme_op_assuan_transact_start; gpgme_check_version_internal; + + gpgme_io_read; + gpgme_io_write; + }; Modified: trunk/src/version.c =================================================================== --- trunk/src/version.c 2009-06-09 12:44:35 UTC (rev 1371) +++ trunk/src/version.c 2009-06-09 16:01:02 UTC (rev 1372) @@ -213,7 +213,7 @@ gpgme_check_version_internal (const char *req_version, size_t offset_sig_validity) { - char *result; + const char *result; TRACE2 (DEBUG_INIT, "gpgme_check_version_internal: ", 0, "req_version=%s, offset_sig_validity=%i", Modified: trunk/tests/gpg/Makefile.am =================================================================== --- trunk/tests/gpg/Makefile.am 2009-06-09 12:44:35 UTC (rev 1371) +++ trunk/tests/gpg/Makefile.am 2009-06-09 16:01:02 UTC (rev 1372) @@ -63,8 +63,9 @@ all-local: ./pubring.gpg ./gpg.conf ./gpg-agent.conf ./pubring.gpg: $(srcdir)/pubdemo.asc ./Alpha/Secret.gpg - $(GPG) --homedir . --import $(srcdir)/pubdemo.asc - $(GPG) --homedir . --allow-secret-key-import \ + -$(GPG) --homedir . --no-permission-warning \ + --import $(srcdir)/pubdemo.asc + -$(GPG) --homedir . --no-permission-warning \ --import Alpha/Secret.gpg Zulu/Secret.gpg ./Alpha/Secret.gpg: mkdemodirs secdemo.asc Modified: trunk/tests/gpg/mkdemodirs.in =================================================================== --- trunk/tests/gpg/mkdemodirs.in 2009-06-09 12:44:35 UTC (rev 1371) +++ trunk/tests/gpg/mkdemodirs.in 2009-06-09 16:01:02 UTC (rev 1372) @@ -19,7 +19,7 @@ set -e -GPG="@GPG@ --batch --quiet --no-secmem-warning" +GPG="@GPG@ --batch --quiet --no-secmem-warning --no-permission-warning" NAMES='Alpha Bravo Charlie Delta Echo Foxtrot Golf Hotel India Juliet Kilo Lima Mike November Oscar Papa Quebec Romeo Sierra Tango Uniform Victor Whisky XRay Yankee Zulu' @@ -45,7 +45,7 @@ [ -d $name ] && rm -r $name mkdir $name $GPGDEMO --export-secret-key -o - $name > $name/Secret.gpg - $GPG --homedir $name --allow-secret-key-import --import $name/Secret.gpg + $GPG --homedir $name --import $name/Secret.gpg $GPGDEMO --export -o - $name > $name/Public.gpg $GPG --homedir $name --import $name/Public.gpg [ -f $name/pubring.gpg~ ] && rm $name/pubring.gpg~ Modified: trunk/tests/gpg/t-edit.c =================================================================== --- trunk/tests/gpg/t-edit.c 2009-06-09 12:44:35 UTC (rev 1371) +++ trunk/tests/gpg/t-edit.c 2009-06-09 16:01:02 UTC (rev 1372) @@ -103,8 +103,8 @@ if (result) { - write (fd, result, strlen (result)); - write (fd, "\n", 1); + gpgme_io_write (fd, result, strlen (result)); + gpgme_io_write (fd, "\n", 1); } return 0; } From cvs at cvs.gnupg.org Tue Jun 9 20:59:45 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue, 09 Jun 2009 20:59:45 +0200 Subject: [svn] gpgme - r1373 - trunk/src Message-ID: Author: wk Date: 2009-06-09 20:59:45 +0200 (Tue, 09 Jun 2009) New Revision: 1373 Modified: trunk/src/ChangeLog trunk/src/engine-gpg.c Log: Fix possible assert in the card edit. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2009-06-09 16:01:02 UTC (rev 1372) +++ trunk/src/ChangeLog 2009-06-09 18:59:45 UTC (rev 1373) @@ -1,5 +1,7 @@ 2009-06-09 Werner Koch + * engine-gpg.c (gpg_io_event): Test for cmd.fd. + * version.c (gpgme_check_version_internal): Make result const. * gpgme.c: Include priv-io.h. Modified: trunk/src/engine-gpg.c =================================================================== --- trunk/src/engine-gpg.c 2009-06-09 16:01:02 UTC (rev 1372) +++ trunk/src/engine-gpg.c 2009-06-09 18:59:45 UTC (rev 1373) @@ -171,6 +171,8 @@ } else if (gpg->colon.fd[1] == fd) gpg->colon.fd[1] = -1; + else if (gpg->cmd.fd == fd) + gpg->cmd.fd = -1; else if (gpg->fd_data_map) { int i; From cvs at cvs.gnupg.org Tue Jun 9 21:11:29 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue, 09 Jun 2009 21:11:29 +0200 Subject: [svn] GnuPG - r5041 - in trunk: agent g10 scd Message-ID: Author: wk Date: 2009-06-09 21:11:28 +0200 (Tue, 09 Jun 2009) New Revision: 5041 Modified: trunk/agent/ChangeLog trunk/agent/learncard.c trunk/g10/ChangeLog trunk/g10/call-agent.c trunk/g10/card-util.c trunk/scd/ChangeLog trunk/scd/app-openpgp.c trunk/scd/app.c Log: app-openpgp changes Modified: trunk/agent/ChangeLog =================================================================== --- trunk/agent/ChangeLog 2009-06-08 09:11:27 UTC (rev 5040) +++ trunk/agent/ChangeLog 2009-06-09 19:11:28 UTC (rev 5041) @@ -1,3 +1,7 @@ +2009-06-09 Werner Koch + + * learncard.c (send_cert_back): Ignore certain error codes. + 2009-06-05 Werner Koch * protect-tool.c (store_private_key): Fix last change by appending Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2009-06-08 09:11:27 UTC (rev 5040) +++ trunk/g10/ChangeLog 2009-06-09 19:11:28 UTC (rev 5041) @@ -1,3 +1,11 @@ +2009-06-09 Werner Koch + + * card-util.c (write_sc_op_status): New. + (change_pin): Use it. + (change_url, change_login, change_private_do, change_cert) + (change_lang, change_sex, change_cafpr, toggle_forcesig) + (check_pin_for_key_operation): Ditto. + 2009-06-05 David Shaw * gpg.c (main), misc.c (openpgp_cipher_test_algo): Remove Camellia Modified: trunk/scd/ChangeLog =================================================================== --- trunk/scd/ChangeLog 2009-06-08 09:11:27 UTC (rev 5040) +++ trunk/scd/ChangeLog 2009-06-09 19:11:28 UTC (rev 5041) @@ -1,3 +1,9 @@ +2009-06-09 Werner Koch + + * app-openpgp.c (do_readcert): Return NOT_FOUND if the retrieved + data has a length of zero. + (do_getattr): Add EXTCAP subkey "sm". + 2009-05-20 Werner Koch * app-openpgp.c (verify_chv2): Add case for v2 cards. Modified: trunk/agent/learncard.c =================================================================== --- trunk/agent/learncard.c 2009-06-08 09:11:27 UTC (rev 5040) +++ trunk/agent/learncard.c 2009-06-09 19:11:28 UTC (rev 5041) @@ -262,9 +262,23 @@ rc = agent_card_readcert (ctrl, id, &derbuf, &derbuflen); if (rc) { - log_error ("error reading certificate: %s\n", - gpg_strerror (rc)); - return rc; + const char *action; + + switch (gpg_err_code (rc)) + { + case GPG_ERR_INV_ID: + case GPG_ERR_NOT_FOUND: + action = " - ignored"; + break; + default: + action = ""; + break; + } + if (opt.verbose || !*action) + log_info ("error reading certificate `%s': %s%s\n", + id? id:"?", gpg_strerror (rc), action); + + return *action? 0 : rc; } rc = assuan_send_data (assuan_context, derbuf, derbuflen); @@ -288,6 +302,7 @@ agent_handle_learn (ctrl_t ctrl, void *assuan_context) { int rc; + struct kpinfo_cb_parm_s parm; struct certinfo_cb_parm_s cparm; struct sinfo_cb_parm_s sparm; Modified: trunk/g10/call-agent.c =================================================================== --- trunk/g10/call-agent.c 2009-06-08 09:11:27 UTC (rev 5040) +++ trunk/g10/call-agent.c 2009-06-09 19:11:28 UTC (rev 5041) @@ -667,7 +667,7 @@ /* Send the serialno command to initialize the connection. We don't care about the data returned. If the card has already been initialized, this is a very fast command. We request the openpgp - card because that is waht we expect. */ + card because that is what we expect. */ rc = assuan_transact (agent_ctx, "SCD SERIALNO openpgp", NULL, NULL, NULL, NULL, NULL, NULL); if (rc) @@ -732,7 +732,7 @@ /* Send the serialno command to initialize the connection. We don't care about the data returned. If the card has already been initialized, this is a very fast command. We request the openpgp - card because that is waht we expect. */ + card because that is what we expect. */ rc = assuan_transact (agent_ctx, "SCD SERIALNO openpgp", NULL, NULL, NULL, NULL, NULL, NULL); if (rc) Modified: trunk/g10/card-util.c =================================================================== --- trunk/g10/card-util.c 2009-06-08 09:11:27 UTC (rev 5040) +++ trunk/g10/card-util.c 2009-06-09 19:11:28 UTC (rev 5041) @@ -48,6 +48,29 @@ #define CONTROL_D ('D' - 'A' + 1) +static void +write_sc_op_status (gpg_error_t err) +{ + switch (gpg_err_code (err)) + { + case 0: + write_status (STATUS_SC_OP_SUCCESS); + break; +#if GNUPG_MAJOR_VERSION != 1 + case GPG_ERR_CANCELED: + write_status_text (STATUS_SC_OP_FAILURE, "1"); + break; + case GPG_ERR_BAD_PIN: + write_status_text (STATUS_SC_OP_FAILURE, "2"); + break; + default: + write_status (STATUS_SC_OP_FAILURE); + break; +#endif /* GNUPG_MAJOR_VERSION != 1 */ + } +} + + /* Change the PIN of a an OpenPGP card. This is an interactive function. */ void @@ -86,25 +109,21 @@ else { rc = agent_scd_change_pin (2, info.serialno); + write_sc_op_status (rc); if (rc) tty_printf ("Error changing the PIN: %s\n", gpg_strerror (rc)); else - { - write_status (STATUS_SC_OP_SUCCESS); - tty_printf ("PIN changed.\n"); - } + tty_printf ("PIN changed.\n"); } } else if (!allow_admin) { rc = agent_scd_change_pin (1, info.serialno); + write_sc_op_status (rc); if (rc) tty_printf ("Error changing the PIN: %s\n", gpg_strerror (rc)); else - { - write_status (STATUS_SC_OP_SUCCESS); - tty_printf ("PIN changed.\n"); - } + tty_printf ("PIN changed.\n"); } else for (;;) @@ -129,50 +148,42 @@ { /* Change PIN. */ rc = agent_scd_change_pin (1, info.serialno); + write_sc_op_status (rc); if (rc) tty_printf ("Error changing the PIN: %s\n", gpg_strerror (rc)); else - { - write_status (STATUS_SC_OP_SUCCESS); - tty_printf ("PIN changed.\n"); - } + tty_printf ("PIN changed.\n"); } else if (*answer == '2') { /* Unblock PIN. */ rc = agent_scd_change_pin (101, info.serialno); + write_sc_op_status (rc); if (rc) tty_printf ("Error unblocking the PIN: %s\n", gpg_strerror (rc)); else - { - write_status (STATUS_SC_OP_SUCCESS); - tty_printf ("PIN unblocked and new PIN set.\n"); - } + tty_printf ("PIN unblocked and new PIN set.\n"); } else if (*answer == '3') { /* Change Admin PIN. */ rc = agent_scd_change_pin (3, info.serialno); + write_sc_op_status (rc); if (rc) tty_printf ("Error changing the PIN: %s\n", gpg_strerror (rc)); else - { - write_status (STATUS_SC_OP_SUCCESS); - tty_printf ("PIN changed.\n"); - } + tty_printf ("PIN changed.\n"); } else if (*answer == '4') { /* Set a new Reset Code. */ rc = agent_scd_change_pin (102, info.serialno); + write_sc_op_status (rc); if (rc) tty_printf ("Error setting the Reset Code: %s\n", gpg_strerror (rc)); else - { - write_status (STATUS_SC_OP_SUCCESS); - tty_printf ("Reset Code set.\n"); - } + tty_printf ("Reset Code set.\n"); } else if (*answer == 'q' || *answer == 'Q') { @@ -694,6 +705,7 @@ if (rc) log_error ("error setting URL: %s\n", gpg_strerror (rc)); xfree (url); + write_sc_op_status (rc); return rc; } @@ -744,6 +756,7 @@ return rc; #else + #warning need to implemented fucntion return 0; #endif } @@ -839,6 +852,7 @@ if (rc) log_error ("error setting login data: %s\n", gpg_strerror (rc)); xfree (data); + write_sc_op_status (rc); return rc; } @@ -884,6 +898,7 @@ if (rc) log_error ("error setting private DO: %s\n", gpg_strerror (rc)); xfree (data); + write_sc_op_status (rc); return rc; } @@ -913,6 +928,7 @@ if (rc) log_error ("error writing certificate to card: %s\n", gpg_strerror (rc)); xfree (data); + write_sc_op_status (rc); return rc; } @@ -950,6 +966,7 @@ if (rc) log_error ("error setting lang: %s\n", gpg_strerror (rc)); xfree (data); + write_sc_op_status (rc); return rc; } @@ -985,6 +1002,7 @@ if (rc) log_error ("error setting sex: %s\n", gpg_strerror (rc)); xfree (data); + write_sc_op_status (rc); return rc; } @@ -1029,6 +1047,7 @@ fprno==3?"CA-FPR-3":"x", fpr, 20, NULL ); if (rc) log_error ("error setting cafpr: %s\n", gpg_strerror (rc)); + write_sc_op_status (rc); return rc; } @@ -1054,6 +1073,7 @@ rc = agent_scd_setattr ("CHV-STATUS-1", newstate? "\x01":"", 1, NULL); if (rc) log_error ("error toggling signature PIN flag: %s\n", gpg_strerror (rc)); + write_sc_op_status (rc); } @@ -1111,8 +1131,11 @@ binding signature. */ rc = agent_scd_checkpin (info->serialno); if (rc) - log_error ("error checking the PIN: %s\n", gpg_strerror (rc)); - } + { + log_error ("error checking the PIN: %s\n", gpg_strerror (rc)); + write_sc_op_status (rc); + } + } return rc; } Modified: trunk/scd/app-openpgp.c =================================================================== --- trunk/scd/app-openpgp.c 2009-06-08 09:11:27 UTC (rev 5040) +++ trunk/scd/app-openpgp.c 2009-06-09 19:11:28 UTC (rev 5041) @@ -833,13 +833,16 @@ char tmp[100]; snprintf (tmp, sizeof tmp, - "gc=%d ki=%d fc=%d pd=%d mcl3=%u aac=%d", + "gc=%d ki=%d fc=%d pd=%d mcl3=%u aac=%d sm=%d", app->app_local->extcap.get_challenge, app->app_local->extcap.key_import, app->app_local->extcap.change_force_chv, app->app_local->extcap.private_dos, app->app_local->extcap.max_certlen_3, - app->app_local->extcap.algo_attr_change); + app->app_local->extcap.algo_attr_change, + (app->app_local->extcap.sm_supported + ? (app->app_local->extcap.sm_aes128? 7 : 2) + : 0)); send_status_info (ctrl, table[idx].name, tmp, strlen (tmp), NULL, 0); return 0; } @@ -1398,8 +1401,9 @@ if (!relptr) return gpg_error (GPG_ERR_NOT_FOUND); - *cert = xtrymalloc (buflen); - if (!*cert) + if (!buflen) + err = gpg_error (GPG_ERR_NOT_FOUND); + else if (!(*cert = xtrymalloc (buflen))) err = gpg_error_from_syserror (); else { Modified: trunk/scd/app.c =================================================================== --- trunk/scd/app.c 2009-06-08 09:11:27 UTC (rev 5040) +++ trunk/scd/app.c 2009-06-09 19:11:28 UTC (rev 5041) @@ -620,7 +620,7 @@ code returned. This function might not be supported by all applications. */ -gpg_error_t +gpg_error_t app_readkey (app_t app, const char *keyid, unsigned char **pk, size_t *pklen) { gpg_error_t err; From cvs at cvs.gnupg.org Wed Jun 10 01:07:49 2009 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Wed, 10 Jun 2009 01:07:49 +0200 Subject: [svn] GnuPG - r5042 - branches/STABLE-BRANCH-1-4/keyserver Message-ID: Author: dshaw Date: 2009-06-10 01:07:48 +0200 (Wed, 10 Jun 2009) New Revision: 5042 Modified: branches/STABLE-BRANCH-1-4/keyserver/ChangeLog branches/STABLE-BRANCH-1-4/keyserver/Makefile.am Log: * Makefile.am (gpgkeys_hkp_LDADD): Need DNSLIBS for the resolver now that we're using SRVs. Modified: branches/STABLE-BRANCH-1-4/keyserver/ChangeLog =================================================================== --- branches/STABLE-BRANCH-1-4/keyserver/ChangeLog 2009-06-09 19:11:28 UTC (rev 5041) +++ branches/STABLE-BRANCH-1-4/keyserver/ChangeLog 2009-06-09 23:07:48 UTC (rev 5042) @@ -1,3 +1,8 @@ +2009-06-09 David Shaw + + * Makefile.am (gpgkeys_hkp_LDADD): Need DNSLIBS for the resolver + now that we're using SRVs. + 2009-05-27 David Shaw * gpgkeys_hkp.c (srv_replace): Fix build warning. Modified: branches/STABLE-BRANCH-1-4/keyserver/Makefile.am =================================================================== --- branches/STABLE-BRANCH-1-4/keyserver/Makefile.am 2009-06-09 19:11:28 UTC (rev 5041) +++ branches/STABLE-BRANCH-1-4/keyserver/Makefile.am 2009-06-09 23:07:48 UTC (rev 5042) @@ -1,5 +1,5 @@ # Copyright (C) 2001, 2002, 2004, 2005, 2006, -# 2007 Free Software Foundation, Inc. +# 2007, 2009 Free Software Foundation, Inc. # # This file is part of GnuPG. # @@ -48,7 +48,7 @@ gpgkeys_curl_CPPFLAGS = @LIBCURL_CPPFLAGS@ gpgkeys_curl_LDADD = ../util/libcompat.a @LIBCURL@ @GETOPT@ gpgkeys_hkp_CPPFLAGS = @LIBCURL_CPPFLAGS@ -gpgkeys_hkp_LDADD = ../util/libcompat.a @LIBCURL@ @GETOPT@ +gpgkeys_hkp_LDADD = ../util/libcompat.a @DNSLIBS@ @LIBCURL@ @GETOPT@ gpgkeys_finger_CPPFLAGS = @LIBCURL_CPPFLAGS@ gpgkeys_ldap_CPPFLAGS += @LIBCURL_CPPFLAGS@ endif From cvs at cvs.gnupg.org Fri Jun 12 18:58:46 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Fri, 12 Jun 2009 18:58:46 +0200 Subject: [svn] gpgme - r1374 - trunk/src Message-ID: Author: wk Date: 2009-06-12 18:58:45 +0200 (Fri, 12 Jun 2009) New Revision: 1374 Modified: trunk/src/ChangeLog trunk/src/dirinfo.c trunk/src/engine-assuan.c trunk/src/engine-gpg.c trunk/src/engine-gpgconf.c trunk/src/engine-gpgsm.c trunk/src/gpgme-w32spawn.c trunk/src/posix-io.c trunk/src/posix-util.c trunk/src/priv-io.h trunk/src/util.h trunk/src/version.c trunk/src/w32-glib-io.c trunk/src/w32-io.c trunk/src/w32-qt-io.cpp trunk/src/w32-util.c Log: Improved W32 SetForegroundWindow hacks. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2009-06-09 18:59:45 UTC (rev 1373) +++ trunk/src/ChangeLog 2009-06-12 16:58:45 UTC (rev 1374) @@ -1,3 +1,26 @@ +2009-06-12 Werner Koch + + * gpgme-w32spawn.c (translate_get_from_file): Parse optional spawn + flags. Add new arg R_FLAGS. Fix segv on file w/o LF. + (translate_handles): Add new arg R_FLAGS. Avoid possible segv. + (main): Pass flags for my_spawn. + (my_spawn): Add arg FLAGS and implement AllowSetForegroundWindow. + + * priv-io.h (IOSPAWN_FLAG_ALLOW_SET_FG): New. + * w32-io.c (_gpgme_io_spawn): Add arg FLAGS and implement it. + * w32-glib-io.c (_gpgme_io_spawn): Ditto. + * w32-qt-io.cpp (_gpgme_io_spawn): Ditto. + * posix-io.c (_gpgme_io_spawn): Add dummy arg FLAGS. + * engine-gpg.c (start): Call spawn with new flag. + + * w32-util.c (_gpgme_allow_set_foregound_window): Rename to + _gpgme_allow_set_foreground_window. Change all callers. + * posix-util.c (_gpgme_allow_set_foreground_window): Ditto. + +2009-06-10 Werner Koch + + * w32-util.c (_gpgme_allow_set_foregound_window): Add trace support. + 2009-06-09 Werner Koch * engine-gpg.c (gpg_io_event): Test for cmd.fd. Modified: trunk/src/dirinfo.c =================================================================== --- trunk/src/dirinfo.c 2009-06-09 18:59:45 UTC (rev 1373) +++ trunk/src/dirinfo.c 2009-06-12 16:58:45 UTC (rev 1374) @@ -102,7 +102,7 @@ cfd[0].fd = rp[1]; - status = _gpgme_io_spawn (pgmname, argv, cfd, NULL); + status = _gpgme_io_spawn (pgmname, argv, 0, cfd, NULL); if (status < 0) { _gpgme_io_close (rp[0]); Modified: trunk/src/engine-assuan.c =================================================================== --- trunk/src/engine-assuan.c 2009-06-09 18:59:45 UTC (rev 1373) +++ trunk/src/engine-assuan.c 2009-06-12 16:58:45 UTC (rev 1374) @@ -377,7 +377,7 @@ if (llass->opt.gpg_agent && !strcmp (keyword, "PINENTRY_LAUNCHED")) { - _gpgme_allow_set_foregound_window ((pid_t)strtoul (args, NULL, 10)); + _gpgme_allow_set_foreground_window ((pid_t)strtoul (args, NULL, 10)); } if (llass->user.inq_cb) Modified: trunk/src/engine-gpg.c =================================================================== --- trunk/src/engine-gpg.c 2009-06-09 18:59:45 UTC (rev 1373) +++ trunk/src/engine-gpg.c 2009-06-12 16:58:45 UTC (rev 1374) @@ -1328,7 +1328,9 @@ fd_list[n].dup_to = -1; status = _gpgme_io_spawn (gpg->file_name ? gpg->file_name : - _gpgme_get_gpg_path (), gpg->argv, fd_list, &pid); + _gpgme_get_gpg_path (), gpg->argv, + IOSPAWN_FLAG_ALLOW_SET_FG, + fd_list, &pid); saved_errno = errno; free (fd_list); @@ -1376,8 +1378,6 @@ } } - _gpgme_allow_set_foregound_window (pid); - gpg_io_event (gpg, GPGME_EVENT_START, NULL); /* fixme: check what data we can release here */ Modified: trunk/src/engine-gpgconf.c =================================================================== --- trunk/src/engine-gpgconf.c 2009-06-09 18:59:45 UTC (rev 1373) +++ trunk/src/engine-gpgconf.c 2009-06-12 16:58:45 UTC (rev 1374) @@ -221,7 +221,7 @@ cfd[0].fd = rp[1]; - status = _gpgme_io_spawn (gpgconf->file_name, argv, cfd, NULL); + status = _gpgme_io_spawn (gpgconf->file_name, argv, 0, cfd, NULL); if (status < 0) { _gpgme_io_close (rp[0]); @@ -659,7 +659,7 @@ cfd[0].fd = rp[0]; - status = _gpgme_io_spawn (gpgconf->file_name, argv, cfd, NULL); + status = _gpgme_io_spawn (gpgconf->file_name, argv, 0, cfd, NULL); if (status < 0) { _gpgme_io_close (rp[0]); Modified: trunk/src/engine-gpgsm.c =================================================================== --- trunk/src/engine-gpgsm.c 2009-06-09 18:59:45 UTC (rev 1373) +++ trunk/src/engine-gpgsm.c 2009-06-12 16:58:45 UTC (rev 1374) @@ -292,7 +292,7 @@ { if (!strncmp (line, "PINENTRY_LAUNCHED", 17) && (line[17]==' '||!line[17])) { - _gpgme_allow_set_foregound_window ((pid_t)strtoul (line+17, NULL, 10)); + _gpgme_allow_set_foreground_window ((pid_t)strtoul (line+17, NULL, 10)); } return 0; Modified: trunk/src/gpgme-w32spawn.c =================================================================== --- trunk/src/gpgme-w32spawn.c 2009-06-09 18:59:45 UTC (rev 1373) +++ trunk/src/gpgme-w32spawn.c 2009-06-12 16:58:45 UTC (rev 1374) @@ -34,7 +34,14 @@ #include #include +/* Flag values as used by gpgme. */ +#define IOSPAWN_FLAG_ALLOW_SET_FG 1 + +/* Name of this program. */ +#define PGM "gpgme-w32spawn" + + struct spawn_fd_item_s { @@ -101,7 +108,7 @@ int -my_spawn (char **argv, struct spawn_fd_item_s *fd_list) +my_spawn (char **argv, struct spawn_fd_item_s *fd_list, unsigned int flags) { SECURITY_ATTRIBUTES sec_attr; PROCESS_INFORMATION pi = @@ -127,7 +134,7 @@ i = 0; while (argv[i]) { - fprintf (stderr, "argv[%2i] = %s\n", i, argv[i]); + fprintf (stderr, PGM": argv[%2i] = %s\n", i, argv[i]); i++; } @@ -147,7 +154,7 @@ si.hStdOutput = GetStdHandle (STD_OUTPUT_HANDLE); si.hStdError = GetStdHandle (STD_ERROR_HANDLE); - fprintf (stderr, "spawning: %s\n", arg_string); + fprintf (stderr, PGM": spawning: %s\n", arg_string); for (i = 0; fd_list[i].handle != -1; i++) { @@ -156,19 +163,19 @@ { si.hStdInput = (HANDLE) fd_list[i].peer_name; duped_stdin = 1; - fprintf (stderr, "dup 0x%x to stdin\n", fd_list[i].peer_name); + fprintf (stderr, PGM": dup 0x%x to stdin\n", fd_list[i].peer_name); } else if (fd_list[i].dup_to == 1) { si.hStdOutput = (HANDLE) fd_list[i].peer_name; duped_stdout = 1; - fprintf (stderr, "dup 0x%x to stdout\n", fd_list[i].peer_name); + fprintf (stderr, PGM": dup 0x%x to stdout\n", fd_list[i].peer_name); } else if (fd_list[i].dup_to == 2) { si.hStdError = (HANDLE) fd_list[i].peer_name; duped_stderr = 1; - fprintf (stderr, "dup 0x%x to stderr\n", fd_list[i].peer_name); + fprintf (stderr, PGM":dup 0x%x to stderr\n", fd_list[i].peer_name); } } @@ -231,7 +238,34 @@ for (i = 0; fd_list[i].handle != -1; i++) CloseHandle ((HANDLE) fd_list[i].handle); + + if (flags & IOSPAWN_FLAG_ALLOW_SET_FG) + { + static int initialized; + static BOOL (WINAPI * func)(DWORD); + void *handle; + if (!initialized) + { + /* Available since W2000; thus we dynload it. */ + initialized = 1; + handle = LoadLibrary ("user32.dll"); + if (handle) + { + func = GetProcAddress (handle, "AllowSetForegroundWindow"); + if (!func) + FreeLibrary (handle); + } + } + + if (func) + { + int rc = func (pi.dwProcessId); + fprintf (stderr, PGM": AllowSetForegroundWindow(%d): rc=%d\n", + (int)pi.dwProcessId, rc); + } + } + ResumeThread (pi.hThread); CloseHandle (pi.hThread); CloseHandle (pi.hProcess); @@ -244,12 +278,13 @@ int translate_get_from_file (const char *trans_file, - struct spawn_fd_item_s *fd_list) + struct spawn_fd_item_s *fd_list, + unsigned int *r_flags) { /* Hold roughly MAX_TRANS triplets of 64 bit numbers in hex notation: "0xFEDCBA9876543210". 10*19*4 - 1 = 759. This plans ahead for a time when a HANDLE is 64 bit. */ -#define BUFFER_MAX 800 +#define BUFFER_MAX 810 char line[BUFFER_MAX + 1]; char *linep; @@ -257,6 +292,8 @@ int res; int fd; + *r_flags = 0; + fd = open (trans_file, O_RDONLY); if (fd < 0) return -1; @@ -269,10 +306,12 @@ line[BUFFER_MAX] = '\0'; linep = strchr (line, '\n'); - if (linep > line && linep[-1] == '\r') - linep--; - *linep = '\0'; - + if (linep) + { + if (linep > line && linep[-1] == '\r') + linep--; + *linep = '\0'; + } linep = line; /* Now start to read mapping pairs. */ @@ -289,6 +328,21 @@ linep++; if (*linep == '\0') break; + if (!idx && *linep == '~') + { + /* Spawn flags have been passed. */ + linep++; + *r_flags = strtoul (linep, &tail, 0); + if (tail == NULL || ! (*tail == '\0' || isspace (*tail))) + break; + linep = tail; + + while (isspace (*((unsigned char *)linep))) + linep++; + if (*linep == '\0') + break; + } + from = strtoul (linep, &tail, 0); if (tail == NULL || ! (*tail == '\0' || isspace (*tail))) break; @@ -339,13 +393,14 @@ FD_LIST (which must be MAX_TRANS+1 large). */ char ** translate_handles (const char *trans_file, const char * const *argv, - struct spawn_fd_item_s *fd_list) + struct spawn_fd_item_s *fd_list, unsigned int *r_flags) { int res; int idx; + int n_args; char **args; - res = translate_get_from_file (trans_file, fd_list); + res = translate_get_from_file (trans_file, fd_list, r_flags); if (res < 0) return NULL; @@ -359,6 +414,7 @@ return NULL; } args[idx] = NULL; + n_args = idx; for (idx = 0; fd_list[idx].handle != -1; idx++) { @@ -369,6 +425,12 @@ if (aidx == 0) continue; + if (aidx >= n_args) + { + fprintf (stderr, PGM": translation file does not match args\n"); + return NULL; + } + args[aidx] = malloc (sizeof (buf)); /* We currently disable translation for stdin/stdout/stderr. We assume that the spawned program handles 0/1/2 specially @@ -394,6 +456,7 @@ int rc = 0; char **argv_spawn; struct spawn_fd_item_s fd_list[MAX_TRANS + 1]; + unsigned int flags; if (argc < 3) { @@ -401,7 +464,7 @@ goto leave; } - argv_spawn = translate_handles (argv[1], &argv[2], fd_list); + argv_spawn = translate_handles (argv[1], &argv[2], fd_list, &flags); if (!argv_spawn) { rc = 2; @@ -411,10 +474,10 @@ /* Using execv does not replace the existing program image, but spawns a new one and daemonizes it, confusing the command line interpreter. So we have to use spawnv. */ - rc = my_spawn (argv_spawn, fd_list); + rc = my_spawn (argv_spawn, fd_list, flags); if (rc < 0) { - fprintf (stderr, "gpgwrap: executing `%s' failed: %s\n", + fprintf (stderr, PGM": executing `%s' failed: %s\n", argv[0], strerror (errno)); rc = 2; goto leave; @@ -422,12 +485,12 @@ leave: if (rc) - fprintf (stderr, "gpg-w32spawn: internal error\n"); + fprintf (stderr, PGM": internal error\n"); /* Always try to delete the temporary file. */ if (argc >= 2) { if (DeleteFile (argv[1]) == 0) - fprintf (stderr, "Failed to delete %s: ec=%ld\n", + fprintf (stderr, PGM": failed to delete %s: ec=%ld\n", argv[1], GetLastError ()); } return rc; Modified: trunk/src/posix-io.c =================================================================== --- trunk/src/posix-io.c 2009-06-09 18:59:45 UTC (rev 1373) +++ trunk/src/posix-io.c 2009-06-12 16:58:45 UTC (rev 1374) @@ -304,13 +304,16 @@ /* Returns 0 on success, -1 on error. */ int -_gpgme_io_spawn (const char *path, char *const argv[], +_gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, struct spawn_fd_item_s *fd_list, pid_t *r_pid) { pid_t pid; int i; int status; int signo; + + (void)flags; + TRACE_BEG1 (DEBUG_SYSIO, "_gpgme_io_spawn", path, "path=%s", path); i = 0; Modified: trunk/src/posix-util.c =================================================================== --- trunk/src/posix-util.c 2009-06-09 18:59:45 UTC (rev 1373) +++ trunk/src/posix-util.c 2009-06-12 16:58:45 UTC (rev 1374) @@ -67,7 +67,7 @@ } void -_gpgme_allow_set_foregound_window (pid_t pid) +_gpgme_allow_set_foreground_window (pid_t pid) { (void)pid; /* Not needed. */ Modified: trunk/src/priv-io.h =================================================================== --- trunk/src/priv-io.h 2009-06-09 18:59:45 UTC (rev 1373) +++ trunk/src/priv-io.h 2009-06-12 16:58:45 UTC (rev 1374) @@ -59,11 +59,15 @@ void *value); int _gpgme_io_set_nonblocking (int fd); +/* A flag to tell the spawn function to allow the child process to set + the foreground window. */ +#define IOSPAWN_FLAG_ALLOW_SET_FG 1 + /* Spawn the executable PATH with ARGV as arguments. After forking close all fds except for those in FD_LIST in the child, then optionally dup() the child fds. Finally, all fds in the list are closed in the parent. */ -int _gpgme_io_spawn (const char *path, char *const argv[], +int _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, struct spawn_fd_item_s *fd_list, pid_t *r_pid); int _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock); Modified: trunk/src/util.h =================================================================== --- trunk/src/util.h 2009-06-09 18:59:45 UTC (rev 1373) +++ trunk/src/util.h 2009-06-12 16:58:45 UTC (rev 1374) @@ -33,7 +33,7 @@ const char *_gpgme_get_gpgsm_path (void); const char *_gpgme_get_gpgconf_path (void); int _gpgme_get_conf_int (const char *key, int *value); -void _gpgme_allow_set_foregound_window (pid_t pid); +void _gpgme_allow_set_foreground_window (pid_t pid); /*-- dirinfo.c --*/ const char *_gpgme_get_default_homedir (void); Modified: trunk/src/version.c =================================================================== --- trunk/src/version.c 2009-06-09 18:59:45 UTC (rev 1373) +++ trunk/src/version.c 2009-06-12 16:58:45 UTC (rev 1374) @@ -310,7 +310,7 @@ cfd[0].fd = rp[1]; - status = _gpgme_io_spawn (file_name, argv, cfd, NULL); + status = _gpgme_io_spawn (file_name, argv, 0, cfd, NULL); if (status < 0) { _gpgme_io_close (rp[0]); Modified: trunk/src/w32-glib-io.c =================================================================== --- trunk/src/w32-glib-io.c 2009-06-09 18:59:45 UTC (rev 1373) +++ trunk/src/w32-glib-io.c 2009-06-12 16:58:45 UTC (rev 1374) @@ -584,7 +584,7 @@ int -_gpgme_io_spawn (const char *path, char * const argv[], +_gpgme_io_spawn (const char *path, char * const argv[], unsigned int flags, struct spawn_fd_item_s *fd_list, pid_t *r_pid) { SECURITY_ATTRIBUTES sec_attr; @@ -596,8 +596,8 @@ 0 /* returns tid */ }; STARTUPINFO si; - int cr_flags = CREATE_DEFAULT_ERROR_MODE - | GetPriorityClass (GetCurrentProcess ()); + int cr_flags = (CREATE_DEFAULT_ERROR_MODE + | GetPriorityClass (GetCurrentProcess ())); int i; char **args; char *arg_string; @@ -679,6 +679,9 @@ free (arg_string); + if (flags & IOSPAWN_FLAG_ALLOW_SET_FG) + _gpgme_allow_set_foreground_window ((pid_t)pi.dwProcessId); + /* Insert the inherited handles. */ for (i = 0; fd_list[i].fd != -1; i++) { @@ -721,8 +724,10 @@ int written; size_t len; - line[0] = '\n'; - line[1] = '\0'; + if ((flags & IOSPAWN_FLAG_ALLOW_SET_FG)) + strcpy (line, "~1 \n"); + else + strcpy (line, "\n"); for (i = 0; fd_list[i].fd != -1; i++) { /* Strip the newline. */ Modified: trunk/src/w32-io.c =================================================================== --- trunk/src/w32-io.c 2009-06-09 18:59:45 UTC (rev 1373) +++ trunk/src/w32-io.c 2009-06-12 16:58:45 UTC (rev 1374) @@ -1009,7 +1009,7 @@ int -_gpgme_io_spawn (const char *path, char *const argv[], +_gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, struct spawn_fd_item_s *fd_list, pid_t *r_pid) { SECURITY_ATTRIBUTES sec_attr; @@ -1021,8 +1021,8 @@ 0 /* returns tid */ }; STARTUPINFO si; - int cr_flags = CREATE_DEFAULT_ERROR_MODE - | GetPriorityClass (GetCurrentProcess ()); + int cr_flags = (CREATE_DEFAULT_ERROR_MODE + | GetPriorityClass (GetCurrentProcess ())); int i; char **args; char *arg_string; @@ -1104,6 +1104,9 @@ free (arg_string); + if (flags & IOSPAWN_FLAG_ALLOW_SET_FG) + _gpgme_allow_set_foreground_window ((pid_t)pi.dwProcessId); + /* Insert the inherited handles. */ for (i = 0; fd_list[i].fd != -1; i++) { @@ -1139,14 +1142,16 @@ notation: "0xFEDCBA9876543210" with an extra white space after every quadruplet. 10*(19*4 + 1) - 1 = 769. This plans ahead for a time when a HANDLE is 64 bit. */ -#define BUFFER_MAX 800 +#define BUFFER_MAX 810 char line[BUFFER_MAX + 1]; int res; int written; size_t len; - line[0] = '\n'; - line[1] = '\0'; + if ((flags & IOSPAWN_FLAG_ALLOW_SET_FG)) + strcpy (line, "~1 \n"); + else + strcpy (line, "\n"); for (i = 0; fd_list[i].fd != -1; i++) { /* Strip the newline. */ @@ -1181,6 +1186,7 @@ if (r_pid) *r_pid = (pid_t)pi.dwProcessId; + if (ResumeThread (pi.hThread) < 0) TRACE_LOG1 ("ResumeThread failed: ec=%d", (int) GetLastError ()); Modified: trunk/src/w32-qt-io.cpp =================================================================== --- trunk/src/w32-qt-io.cpp 2009-06-09 18:59:45 UTC (rev 1373) +++ trunk/src/w32-qt-io.cpp 2009-06-12 16:58:45 UTC (rev 1374) @@ -397,7 +397,7 @@ int -_gpgme_io_spawn (const char *path, char * const argv[], +_gpgme_io_spawn (const char *path, char * const argv[], unsigned int flags, struct spawn_fd_item_s *fd_list, pid_t *r_pid) { SECURITY_ATTRIBUTES sec_attr; @@ -492,6 +492,9 @@ free (arg_string); + if (flags & IOSPAWN_FLAG_ALLOW_SET_FG) + _gpgme_allow_set_foreground_window ((pid_t)pi.dwProcessId); + /* Insert the inherited handles. */ for (i = 0; fd_list[i].fd != -1; i++) { @@ -533,8 +536,10 @@ int written; size_t len; - line[0] = '\n'; - line[1] = '\0'; + if ((flags & IOSPAWN_FLAG_ALLOW_SET_FG)) + strcpy (line, "~1 \n"); + else + strcpy (line, "\n"); for (i = 0; fd_list[i].fd != -1; i++) { /* Strip the newline. */ Modified: trunk/src/w32-util.c =================================================================== --- trunk/src/w32-util.c 2009-06-09 18:59:45 UTC (rev 1373) +++ trunk/src/w32-util.c 2009-06-12 16:58:45 UTC (rev 1374) @@ -393,7 +393,7 @@ void -_gpgme_allow_set_foregound_window (pid_t pid) +_gpgme_allow_set_foreground_window (pid_t pid) { static int initialized; static BOOL (WINAPI * func)(DWORD); @@ -416,10 +416,23 @@ } if (!pid || pid == (pid_t)(-1)) - ; + { + TRACE1 (DEBUG_ENGINE, "gpgme:AllowSetForegroundWindow", 0, + "no action for pid %d", (int)pid); + } else if (func) - func (pid); + { + int rc = func (pid); + TRACE2 (DEBUG_ENGINE, "gpgme:AllowSetForegroundWindow", 0, + "called for pid %d; result=%d", (int)pid, rc); + } + else + { + TRACE0 (DEBUG_ENGINE, "gpgme:AllowSetForegroundWindow", 0, + "function not available"); + } + } From cvs at cvs.gnupg.org Mon Jun 15 19:05:48 2009 From: cvs at cvs.gnupg.org (svn author marcus) Date: Mon, 15 Jun 2009 19:05:48 +0200 Subject: [svn] gpgme - r1375 - trunk/src Message-ID: Author: marcus Date: 2009-06-15 19:05:47 +0200 (Mon, 15 Jun 2009) New Revision: 1375 Modified: trunk/src/ChangeLog trunk/src/context.h trunk/src/gpgme.c trunk/src/gpgme.def trunk/src/gpgme.h.in trunk/src/libgpgme.vers trunk/src/op-support.c Log: 2009-06-15 Marcus Brinkmann * gpgme.h.in (gpgme_result_ref, gpgme_result_unref): Add prototypes. * gpgme.def, libgpgme.vers (gpgme_result_ref, gpgme_result_unref): Add these. * context.h (struct ctx_op_data): Add member "references". * gpgme.c (gpgme_result_ref, gpgme_result_unref): New functions. (_gpgme_release_result): Use gpgme_result_unref. * op-support.c (_gpgme_op_data_lookup): Initialize references. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2009-06-12 16:58:45 UTC (rev 1374) +++ trunk/src/ChangeLog 2009-06-15 17:05:47 UTC (rev 1375) @@ -1,3 +1,14 @@ +2009-06-15 Marcus Brinkmann + + * gpgme.h.in (gpgme_result_ref, gpgme_result_unref): Add + prototypes. + * gpgme.def, libgpgme.vers (gpgme_result_ref, gpgme_result_unref): + Add these. + * context.h (struct ctx_op_data): Add member "references". + * gpgme.c (gpgme_result_ref, gpgme_result_unref): New functions. + (_gpgme_release_result): Use gpgme_result_unref. + * op-support.c (_gpgme_op_data_lookup): Initialize references. + 2009-06-12 Werner Koch * gpgme-w32spawn.c (translate_get_from_file): Parse optional spawn Modified: trunk/src/context.h =================================================================== --- trunk/src/context.h 2009-06-12 16:58:45 UTC (rev 1374) +++ trunk/src/context.h 2009-06-15 17:05:47 UTC (rev 1375) @@ -45,7 +45,7 @@ struct ctx_op_data { /* The next element in the linked list, or NULL if this is the last - element. */ + element. Used by op data structures linked into a context. */ struct ctx_op_data *next; /* The type of the hook data, which can be used by a routine to @@ -58,6 +58,9 @@ /* The hook that points to the operation data. */ void *hook; + + /* The number of outstanding references. */ + int references; }; typedef struct ctx_op_data *ctx_op_data_t; Modified: trunk/src/gpgme.c =================================================================== --- trunk/src/gpgme.c 2009-06-12 16:58:45 UTC (rev 1374) +++ trunk/src/gpgme.c 2009-06-15 17:05:47 UTC (rev 1375) @@ -176,6 +176,35 @@ void +gpgme_result_ref (void *result) +{ + struct ctx_op_data *data = result - sizeof (struct ctx_op_data); + + if (! result) + return; + + data->references++; +} + + +void +gpgme_result_unref (void *result) +{ + struct ctx_op_data *data = result - sizeof (struct ctx_op_data); + + if (! result) + return; + + if (--data->references == 0) + { + if (data->cleanup) + (*data->cleanup) (data->hook); + free (data); + } +} + + +void _gpgme_release_result (gpgme_ctx_t ctx) { struct ctx_op_data *data = ctx->op_data; @@ -183,9 +212,8 @@ while (data) { struct ctx_op_data *next_data = data->next; - if (data->cleanup) - (*data->cleanup) (data->hook); - free (data); + data->next = NULL; + gpgme_result_unref (data->hook); data = next_data; } ctx->op_data = NULL; @@ -430,7 +458,7 @@ /* This function provides access to the internal read function; it is - normally not used. */ + normally not used. */ ssize_t gpgme_io_read (int fd, void *buffer, size_t count) { Modified: trunk/src/gpgme.def =================================================================== --- trunk/src/gpgme.def 2009-06-12 16:58:45 UTC (rev 1374) +++ trunk/src/gpgme.def 2009-06-15 17:05:47 UTC (rev 1375) @@ -177,6 +177,8 @@ gpgme_io_read @136 gpgme_io_write @137 + gpgme_release_ref @138 + gpgme_release_unref @139 ; END Modified: trunk/src/gpgme.h.in =================================================================== --- trunk/src/gpgme.h.in 2009-06-12 16:58:45 UTC (rev 1374) +++ trunk/src/gpgme.h.in 2009-06-15 17:05:47 UTC (rev 1375) @@ -1934,6 +1934,10 @@ gpgme_error_t gpgme_engine_check_version (gpgme_protocol_t proto); +void gpgme_result_ref (void *result); +void gpgme_result_unref (void *result); + + /* Deprecated types. */ typedef gpgme_ctx_t GpgmeCtx _GPGME_DEPRECATED; typedef gpgme_data_t GpgmeData _GPGME_DEPRECATED; Modified: trunk/src/libgpgme.vers =================================================================== --- trunk/src/libgpgme.vers 2009-06-12 16:58:45 UTC (rev 1374) +++ trunk/src/libgpgme.vers 2009-06-15 17:05:47 UTC (rev 1375) @@ -56,7 +56,9 @@ gpgme_io_read; gpgme_io_write; - + + gpgme_result_ref; + gpgme_result_unref; }; Modified: trunk/src/op-support.c =================================================================== --- trunk/src/op-support.c 2009-06-12 16:58:45 UTC (rev 1374) +++ trunk/src/op-support.c 2009-06-15 17:05:47 UTC (rev 1375) @@ -52,6 +52,7 @@ data->type = type; data->cleanup = cleanup; data->hook = (void *) (((char *) data) + sizeof (struct ctx_op_data)); + data->references = 1; ctx->op_data = data; } *hook = data->hook; From cvs at cvs.gnupg.org Tue Jun 16 13:42:23 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue, 16 Jun 2009 13:42:23 +0200 Subject: [svn] gpgme - r1376 - in trunk: . assuan doc src tests tests/gpg Message-ID: Author: wk Date: 2009-06-16 13:42:21 +0200 (Tue, 16 Jun 2009) New Revision: 1376 Added: trunk/tests/gpg/pgp-export.c trunk/tests/gpg/pgp-keylist.c Modified: trunk/NEWS trunk/TODO trunk/assuan/ChangeLog trunk/assuan/assuan-pipe-connect.c trunk/doc/ChangeLog trunk/doc/gpgme.texi trunk/src/ChangeLog trunk/src/engine-backend.h trunk/src/engine-gpg.c trunk/src/engine-gpgsm.c trunk/src/engine.c trunk/src/engine.h trunk/src/export.c trunk/src/gpgme.def trunk/src/gpgme.h.in trunk/src/import.c trunk/src/libgpgme.vers trunk/tests/ChangeLog trunk/tests/gpg/Makefile.am trunk/tests/gpg/t-export.c Log: Add new functions to import and export keys specified by gpgme_key_t. Allow exporting keys to a keyserver. [The diff below has been truncated] Modified: trunk/assuan/ChangeLog =================================================================== --- trunk/assuan/ChangeLog 2009-06-15 17:05:47 UTC (rev 1375) +++ trunk/assuan/ChangeLog 2009-06-16 11:42:21 UTC (rev 1376) @@ -1,3 +1,8 @@ +2009-06-12 Werner Koch + + * assuan-pipe-connect.c (_gpgme_io_spawn): Change prototype. + (pipe_connect_gpgme): Pass a flags arg. + 2009-04-08 Marcus Brinkmann * assuan.h (_gpgme_io_socket): New prototype. Modified: trunk/doc/ChangeLog =================================================================== --- trunk/doc/ChangeLog 2009-06-15 17:05:47 UTC (rev 1375) +++ trunk/doc/ChangeLog 2009-06-16 11:42:21 UTC (rev 1376) @@ -1,3 +1,8 @@ +2009-06-16 Werner Koch + + * gpgme.texi (Exporting Keys): Document gpgme_op_export_keys. + (Importing Keys): Document gpgme_op_import_keys. + 2009-05-28 Marcus Brinkmann * gpgme.texi (Library Version Check): Document selftest error. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2009-06-15 17:05:47 UTC (rev 1375) +++ trunk/src/ChangeLog 2009-06-16 11:42:21 UTC (rev 1376) @@ -1,3 +1,34 @@ +2009-06-16 Werner Koch + + * gpgme.h.in (gpgme_op_export_keys_start, gpgme_op_export_keys): New. + * gpgme.def, libgpgme.vers: Add them. + * export.c (gpgme_op_export_keys_start, gpgme_op_export_keys): New. + (export_keys_start): New. + + * gpgme.h.in (gpgme_export_mode_t, GPGME_EXPORT_MODE_EXTERN): New. + (gpgme_op_export_start, gpgme_op_export, gpgme_op_export_ext_start) + (gpgme_op_export_ext): Change arg RESERVED to MODE of new + compatible type. + * export.c (gpgme_export_ext_start, gpgme_op_export) + (gpgme_op_export_ext_start, gpgme_op_export_ext): Ditto. + (export_start): Ditto. + * engine.c (_gpgme_engine_op_export): Ditto. + * engine-backend.h (struct engine_ops): Ditto. + * engine-gpgsm.c (gpgsm_export, gpgsm_export_ext): Ditto. + * engine-gpg.c (gpg_export, gpg_export_ext): Ditto. Implement + mode EXTERN. + (gpg_export, gpg_export_ext): Factor common code out to .. + (export_common): .. this. + + * gpgme.h.in (gpgme_op_import_keys_start, gpgme_op_import_keys): New. + * gpgme.def, libgpgme.vers: Add them. + * import.c (gpgme_op_import_keys_start, gpgme_op_import_keys): New. + (_gpgme_op_import_keys_start): New. + * engine.c (_gpgme_engine_op_import): Add arg KEYARRAY. + * engine-backend.h (struct engine_ops): Ditto. + * engine-gpgsm.c (gpgsm_import): Ditto. Not functional. + * engine-gpg.c (gpg_import): Ditto. Implement it. + 2009-06-15 Marcus Brinkmann * gpgme.h.in (gpgme_result_ref, gpgme_result_unref): Add Modified: trunk/tests/ChangeLog =================================================================== --- trunk/tests/ChangeLog 2009-06-15 17:05:47 UTC (rev 1375) +++ trunk/tests/ChangeLog 2009-06-16 11:42:21 UTC (rev 1376) @@ -1,3 +1,7 @@ +2009-06-16 Werner Koch + + * gpg/pgp-export.c, gpg/pgp-keylist.c: New. + 2009-06-09 Werner Koch * gpg/Makefile.am (./pubring.gpg): Ignore errors in case of @@ -16,7 +20,8 @@ * gpg/mkdemodirs: Renamed to ... * gpg/mkdemodirs.in: ... here. - * gpg/mkdemodirs.in (GPG): Derive value from @GPG@ instead of hard-coding "gpg". + * gpg/mkdemodirs.in (GPG): Derive value from @GPG@ instead of + hard-coding "gpg". 2009-02-24 Werner Koch Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2009-06-15 17:05:47 UTC (rev 1375) +++ trunk/NEWS 2009-06-16 11:42:21 UTC (rev 1376) @@ -1,4 +1,4 @@ -Noteworthy changes in version 1.1.9 +Noteworthy changes in version 1.2.0 ------------------------------------------------ * New encryption flag GPGME_ENCRYPT_NO_ENCRYPT_TO to disable default @@ -11,7 +11,6 @@ * New functions gpgme_io_read and gpgme_io_write for use with gpgme_passphrase_cb_t and gpgme_edit_cb_t functions. - * Interface changes relative to the 1.1.7 release: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GPGME_KEYLIST_MODE_EPHEMERAL NEW. @@ -22,12 +21,23 @@ gpgme_op_assuan_transact_start NEW. gpgme_op_assuan_transact NEW. gpgme_op_assuan_result NEW. + gpgme_op_import_keys NEW. + gpgme_op_import_keys_start NEW. gpgme_subkey_t EXTENDED: New fields is_cardkey, card_number. GPGME_ENCRYPT_NO_ENCRYPT_TO NEW. gpgme_check_version CHANGED: Is now a macro. gpgme_new EXTENDED: More failure codes. gpgme_io_read NEW. gpgme_io_write NEW. + gpgme_result_ref NEW. + gpgme_result_unref NEW. + gpgme_export_mode_t NEW. + gpgme_export_ext_start EXTENDED: Arg RESERVED is now a MODE flag. + gpgme_op_export EXTENDED: Arg RESERVED is now a MODE flag. + gpgme_op_export_ext_start EXTENDED: Arg RESERVED is now a MODE flag. + gpgme_op_export_ext EXTENDED: Arg RESERVED is now a MODE flag. + gpgme_op_export_keys_start NEW. + gpgme_op_export_keys NEW. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Modified: trunk/TODO =================================================================== --- trunk/TODO 2009-06-15 17:05:47 UTC (rev 1375) +++ trunk/TODO 2009-06-16 11:42:21 UTC (rev 1376) @@ -1,4 +1,4 @@ -Hey Emacs, this is -*- outline -*- mode! +Hey Emacs, this is -*- org -*- mode! * IMPORTANT ** When using descriptor passing, we need to set the fd to blocking before @@ -24,7 +24,7 @@ (see edit.c::command_handler). ** I/O and User Data could be made extensible. But this can be done without breaking the ABI hopefully. -* All enums that should be enums need to have a maximum value to ensure +** All enums that should be enums need to have a maximum value to ensure a certain minimum width for extensibility. ** Compatibility interfaces that can be removed in future versions: *** gpgme_data_new_from_filepart @@ -68,9 +68,15 @@ application can then do whatever is required. There are other usages too. This notfication system should be independent of any contextes of course. + + Not sure whether this is still required. GPGME_PROTOCOL_ASSUAN is + sufficient for this. + ** --learn-code support This might be integrated with import. we still need to work out how - to learn a card when gpg and gpgsm have support for smartcards. + to learn a card when gpg and gpgsm have support for smartcards. In + GPA we currently invoke gpg directly. + ** Might need a stat() for data objects and use it for length param to gpg. ** Implement support for photo ids. ** Allow selection of subkeys @@ -82,6 +88,7 @@ *** Allow to export secret keys. Rejected because this is conceptually flawed. Secret keys on a smart card can not be exported, for example. + May eventually e supproted with a keywrapping system. *** Selecting the key ring, setting the version or comment in output. Rejected because the naive implementation is engine specific, the configuration is part of the engine's configuration or readily @@ -110,6 +117,11 @@ (it's an internal error, as select_protocol checks already). ** When server mode is implemented properly, more care has to be taken to release all resources on error (for example to free assuan_cmd). +** op_import_keys and op_export_keys have a limit ion the number of keys. + This is because we pass them in gpg via the command line and gpgsm + via an assuan control line. We should pipe them instead and maybe + change gpg/gpgsm to not put them in memory. + * GPG breakage: ** gpg 1.4.2 lacks error reporting if sign/encrypt with revoked key. ** gpg 1.4.2 does crappy error reporting (namely none at all) when Modified: trunk/assuan/assuan-pipe-connect.c =================================================================== --- trunk/assuan/assuan-pipe-connect.c 2009-06-15 17:05:47 UTC (rev 1375) +++ trunk/assuan/assuan-pipe-connect.c 2009-06-16 11:42:21 UTC (rev 1376) @@ -51,7 +51,7 @@ int _gpgme_io_pipe (int filedes[2], int inherit_idx); -int _gpgme_io_spawn (const char *path, char *const argv[], +int _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, struct spawn_fd_item_s *fd_list, pid_t *r_pid); #endif @@ -659,7 +659,7 @@ child_fds[nr].dup_to = -1; /* Start the process. */ - res = _gpgme_io_spawn (name, (char *const *) argv, child_fds, NULL); + res = _gpgme_io_spawn (name, (char *const *) argv, 0, child_fds, NULL); if (res == -1) { _assuan_log_printf ("CreateProcess failed: %s\n", strerror (errno)); Modified: trunk/doc/gpgme.texi =================================================================== --- trunk/doc/gpgme.texi 2009-06-15 17:05:47 UTC (rev 1375) +++ trunk/doc/gpgme.texi 2009-06-16 11:42:21 UTC (rev 1376) @@ -3318,7 +3318,25 @@ @cindex key, export @cindex key ring, export from - at deftypefun gpgme_error_t gpgme_op_export (@w{gpgme_ctx_t @var{ctx}}, @w{const char *@var{pattern}}, @w{unsigned int @var{reserved}}, @w{gpgme_data_t @var{keydata}}) +Exporting keys means the same as running @command{gpg} with the command + at option{--export}. However, a mode flag can be used to change the way +the export works. The available mode flags are described below, they +may be or-ed together. + + at table @code + + at item GPGME_EXPORT_MODE_EXTERN +If this bit is set, the output is send directly to the default +keyserver. This is currently only allowed for OpenPGP keys. It is good +practise to not send more than a few dozens key to a keyserver at one +time. Using this flag requires that the @var{keydata} argument of the +export function is set to @code{NULL}. + + at end table + + + + at deftypefun gpgme_error_t gpgme_op_export (@w{gpgme_ctx_t @var{ctx}}, @w{const char *@var{pattern}}, @w{gpgme_export_mode_t @var{mode}}, @w{gpgme_data_t @var{keydata}}) The function @code{gpgme_op_export} extracts public keys and returns them in the data buffer @var{keydata}. The output format of the key data returned is determined by the @acronym{ASCII} armor attribute set @@ -3329,7 +3347,7 @@ Otherwise, @var{pattern} contains an engine specific expression that is used to limit the list to all keys matching the pattern. - at var{reserved} is reserved for future use and must be @code{0}. + at var{mode} is usually 0; other values are described above. The function returns the error code @code{GPG_ERR_NO_ERROR} if the operation completed successfully, @code{GPG_ERR_INV_VALUE} if @@ -3337,7 +3355,7 @@ errors that are reported by the crypto engine support routines. @end deftypefun - at deftypefun gpgme_error_t gpgme_op_export_start (@w{gpgme_ctx_t @var{ctx}}, @w{const char *@var{pattern}}, @w{unsigned int @var{reserved}}, @w{gpgme_data_t @var{keydata}}) + at deftypefun gpgme_error_t gpgme_op_export_start (@w{gpgme_ctx_t @var{ctx}}, @w{const char *@var{pattern}}, @w{gpgme_export_mode_t @var{mode}}, @w{gpgme_data_t @var{keydata}}) The function @code{gpgme_op_export_start} initiates a @code{gpgme_op_export} operation. It can be completed by calling @code{gpgme_wait} on the context. @xref{Waiting For Completion}. @@ -3347,7 +3365,7 @@ if @var{keydata} is not a valid empty data buffer. @end deftypefun - at deftypefun gpgme_error_t gpgme_op_export_ext (@w{gpgme_ctx_t @var{ctx}}, @w{const char *@var{pattern}[]}, @w{unsigned int @var{reserved}}, @w{gpgme_data_t @var{keydata}}) + at deftypefun gpgme_error_t gpgme_op_export_ext (@w{gpgme_ctx_t @var{ctx}}, @w{const char *@var{pattern}[]}, @w{gpgme_export_mode_t @var{mode}}, @w{gpgme_data_t @var{keydata}}) The function @code{gpgme_op_export} extracts public keys and returns them in the data buffer @var{keydata}. The output format of the key data returned is determined by the @acronym{ASCII} armor attribute set @@ -3359,7 +3377,7 @@ array of strings that are used to limit the list to all keys matching at least one of the patterns verbatim. - at var{reserved} is reserved for future use and must be @code{0}. + at var{mode} is usually 0; other values are described above. The function returns the error code @code{GPG_ERR_NO_ERROR} if the operation completed successfully, @code{GPG_ERR_INV_VALUE} if @@ -3367,7 +3385,7 @@ errors that are reported by the crypto engine support routines. @end deftypefun - at deftypefun gpgme_error_t gpgme_op_export_ext_start (@w{gpgme_ctx_t @var{ctx}}, @w{const char *@var{pattern}[]}, @w{unsigned int @var{reserved}}, @w{gpgme_data_t @var{keydata}}) + at deftypefun gpgme_error_t gpgme_op_export_ext_start (@w{gpgme_ctx_t @var{ctx}}, @w{const char *@var{pattern}[]}, @w{gpgme_export_mode_t @var{mode}}, @w{gpgme_data_t @var{keydata}}) The function @code{gpgme_op_export_ext_start} initiates a @code{gpgme_op_export_ext} operation. It can be completed by calling @code{gpgme_wait} on the context. @xref{Waiting For Completion}. @@ -3378,11 +3396,50 @@ @end deftypefun + at deftypefun gpgme_error_t gpgme_op_export_keys (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_key_t keys[]}, @w{gpgme_export_mode_t @var{mode}}, @w{gpgme_data_t @var{keydata}}) +The function @code{gpgme_op_export_keys} extracts public keys and returns +them in the data buffer @var{keydata}. The output format of the key +data returned is determined by the @acronym{ASCII} armor attribute set +for the context @var{ctx}, or, if that is not set, by the encoding +specified for @var{keydata}. + +The keys to export are taken form the @code{NULL} terminated array + at var{keys}. Only keys of the the currently selected protocol of + at var{ctx} which do have a fingerprint set are considered for export. +Other keys specified by the @var{keys} are ignored. In particular +OpenPGP keys retrieved via an external key listing are not included. + + at var{mode} is usually 0; other values are described above. + +The function returns the error code @code{GPG_ERR_NO_ERROR} if the +operation completed successfully, @code{GPG_ERR_INV_VALUE} if + at var{keydata} is not a valid empty data buffer, @code{GPG_ERR_NO_DATA} +if no useful keys are in @var{keys} and passes through any errors that +are reported by the crypto engine support routines. + at end deftypefun + + at deftypefun gpgme_error_t gpgme_op_export_keys_start (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_key_t @var{keys}[]}, @w{gpgme_export_mode_t @var{mode}}, @w{gpgme_data_t @var{keydata}}) +The function @code{gpgme_op_export_keys_start} initiates a + at code{gpgme_op_export_ext} operation. It can be completed by calling + at code{gpgme_wait} on the context. @xref{Waiting For Completion}. + +The function returns the error code @code{GPG_ERR_NO_ERROR} if the +operation could be started successfully, and @code{GPG_ERR_INV_VALUE} +if @var{keydata} is not a valid empty data buffer, @code{GPG_ERR_NO_DATA} +if no useful keys are in @var{keys} and passes through any errors that +are reported by the crypto engine support routines. + at end deftypefun + + @node Importing Keys @subsection Importing Keys @cindex key, import @cindex key ring, import to +Importing keys means the same as running @command{gpg} with the command + at option{--import}. + + @deftypefun gpgme_error_t gpgme_op_import (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_data_t @var{keydata}}) The function @code{gpgme_op_import} adds the keys in the data buffer @var{keydata} to the key ring of the crypto engine used by @var{ctx}. @@ -3409,6 +3466,44 @@ and @code{GPG_ERR_NO_DATA} if @var{keydata} is an empty data buffer. @end deftypefun + at deftypefun gpgme_error_t gpgme_op_import_keys (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_key_t *@var{keys}}) +The function @code{gpgme_op_import_keys} adds the keys described by the + at code{NULL} terminated array @var{keys} to the key ring of the crypto +engine used by @var{ctx}. This function is the general interface to +move a key from one crypto engine to another as long as they are +compatible. In particular it is used to actually import and make keys +permanent which have been retrieved from an external source (i.e. using + at code{GPGME_KEYLIST_MODE_EXTERN}). @footnote{Thus it is a replacement +for the usual workaround of exporting and then importing a key to make +an X.509 key permanent.} + +Only keys of the the currently selected protocol of @var{ctx} are +considered for import. Other keys specified by the @var{keys} are +ignored. As of now all considered keys must have been retrieved using +the same method, that is the used key listing mode must be identical. + +After the operation completed successfully, the result can be +retrieved with @code{gpgme_op_import_result}. + +The function returns the error code @code{GPG_ERR_NO_ERROR} if the +import was completed successfully, @code{GPG_ERR_INV_VALUE} if + at var{keydata} if @var{ctx} or @var{keydata} is not a valid pointer, + at code{GPG_ERR_CONFLICT} if the key listing mode does not match, and + at code{GPG_ERR_NO_DATA} if no keys are considered for export. + at end deftypefun + + at deftypefun gpgme_error_t gpgme_op_import_keys_start (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_key_t *@var{keys}}) +The function @code{gpgme_op_import_keys_start} initiates a + at code{gpgme_op_import_keys} operation. It can be completed by calling + at code{gpgme_wait} on the context. @xref{Waiting For Completion}. + +The function returns the error code @code{GPG_ERR_NO_ERROR} if the +import was completed successfully, @code{GPG_ERR_INV_VALUE} if + at var{keydata} if @var{ctx} or @var{keydata} is not a valid pointer, + at code{GPG_ERR_CONFLICT} if the key listing mode does not match, and + at code{GPG_ERR_NO_DATA} if no keys are considered for export. + at end deftypefun + @deftp {Data type} {gpgme_import_status_t} This is a pointer to a structure used to store a part of the result of a @code{gpgme_op_import} operation. For each considered key one Modified: trunk/src/engine-backend.h =================================================================== --- trunk/src/engine-backend.h 2009-06-15 17:05:47 UTC (rev 1375) +++ trunk/src/engine-backend.h 2009-06-16 11:42:21 UTC (rev 1376) @@ -77,14 +77,15 @@ gpgme_data_t plain, gpgme_data_t ciph, int use_armor, gpgme_ctx_t ctx /* FIXME */); gpgme_error_t (*export) (void *engine, const char *pattern, - unsigned int reserved, gpgme_data_t keydata, + gpgme_export_mode_t mode, gpgme_data_t keydata, int use_armor); gpgme_error_t (*export_ext) (void *engine, const char *pattern[], - unsigned int reserved, gpgme_data_t keydata, + gpgme_export_mode_t mode, gpgme_data_t keydata, int use_armor); gpgme_error_t (*genkey) (void *engine, gpgme_data_t help_data, int use_armor, gpgme_data_t pubkey, gpgme_data_t seckey); - gpgme_error_t (*import) (void *engine, gpgme_data_t keydata); + gpgme_error_t (*import) (void *engine, gpgme_data_t keydata, + gpgme_key_t *keyarray); gpgme_error_t (*keylist) (void *engine, const char *pattern, int secret_only, gpgme_keylist_mode_t mode); gpgme_error_t (*keylist_ext) (void *engine, const char *pattern[], Modified: trunk/src/engine-gpg.c =================================================================== --- trunk/src/engine-gpg.c 2009-06-15 17:05:47 UTC (rev 1375) +++ trunk/src/engine-gpg.c 2009-06-16 11:42:21 UTC (rev 1376) @@ -678,7 +678,7 @@ /* The Fnc will be called to get a value for one of the commands with - a key KEY. If the Code pssed to FNC is 0, the function may release + a key KEY. If the Code passed to FNC is 0, the function may release resources associated with the returned value from another call. To match such a second call to a first call, the returned value from the first call is passed as keyword. */ @@ -1704,23 +1704,42 @@ static gpgme_error_t -gpg_export (void *engine, const char *pattern, unsigned int reserved, - gpgme_data_t keydata, int use_armor) +export_common (engine_gpg_t gpg, gpgme_export_mode_t mode, + gpgme_data_t keydata, int use_armor) { - engine_gpg_t gpg = engine; gpgme_error_t err; - if (reserved) - return gpg_error (GPG_ERR_INV_VALUE); + if ((mode & ~GPGME_EXPORT_MODE_EXTERN)) + return gpg_error (GPG_ERR_NOT_SUPPORTED); - err = add_arg (gpg, "--export"); - if (!err && use_armor) - err = add_arg (gpg, "--armor"); + if ((mode & GPGME_EXPORT_MODE_EXTERN)) + { + err = add_arg (gpg, "--send-keys"); + } + else + { + err = add_arg (gpg, "--export"); + if (!err && use_armor) + err = add_arg (gpg, "--armor"); + if (!err) + err = add_data (gpg, keydata, 1, 1); + } if (!err) - err = add_data (gpg, keydata, 1, 1); - if (!err) err = add_arg (gpg, "--"); + return err; +} + + +static gpgme_error_t +gpg_export (void *engine, const char *pattern, gpgme_export_mode_t mode, + gpgme_data_t keydata, int use_armor) +{ + engine_gpg_t gpg = engine; + gpgme_error_t err; + + err = export_common (gpg, mode, keydata, use_armor); + if (!err && pattern && *pattern) err = add_arg (gpg, pattern); @@ -1732,23 +1751,14 @@ static gpgme_error_t -gpg_export_ext (void *engine, const char *pattern[], unsigned int reserved, +gpg_export_ext (void *engine, const char *pattern[], gpgme_export_mode_t mode, gpgme_data_t keydata, int use_armor) { engine_gpg_t gpg = engine; gpgme_error_t err; - if (reserved) - return gpg_error (GPG_ERR_INV_VALUE); + err = export_common (gpg, mode, keydata, use_armor); - err = add_arg (gpg, "--export"); - if (!err && use_armor) - err = add_arg (gpg, "--armor"); - if (!err) - err = add_data (gpg, keydata, 1, 1); - if (!err) - err = add_arg (gpg, "--"); - if (pattern) { while (!err && *pattern && **pattern) @@ -1795,17 +1805,41 @@ static gpgme_error_t -gpg_import (void *engine, gpgme_data_t keydata) +gpg_import (void *engine, gpgme_data_t keydata, gpgme_key_t *keyarray) { engine_gpg_t gpg = engine; gpgme_error_t err; + int idx; - err = add_arg (gpg, "--import"); - if (!err) - err = add_arg (gpg, "--"); - if (!err) - err = add_data (gpg, keydata, -1, 0); + if (keydata && keyarray) + gpg_error (GPG_ERR_INV_VALUE); /* Only one is allowed. */ + if (keyarray) + { + err = add_arg (gpg, "--recv-keys"); + if (!err) + err = add_arg (gpg, "--"); + for (idx=0; !err && keyarray[idx]; idx++) + { + if (keyarray[idx]->protocol != GPGME_PROTOCOL_OpenPGP) + ; + else if (!keyarray[idx]->subkeys) + ; + else if (keyarray[idx]->subkeys->fpr && *keyarray[idx]->subkeys->fpr) + err = add_arg (gpg, keyarray[idx]->subkeys->fpr); + else if (*keyarray[idx]->subkeys->keyid) + err = add_arg (gpg, keyarray[idx]->subkeys->keyid); + } + } + else + { + err = add_arg (gpg, "--import"); + if (!err) + err = add_arg (gpg, "--"); + if (!err) + err = add_data (gpg, keydata, -1, 0); + } + if (!err) err = start (gpg); Modified: trunk/src/engine-gpgsm.c =================================================================== --- trunk/src/engine-gpgsm.c 2009-06-15 17:05:47 UTC (rev 1375) +++ trunk/src/engine-gpgsm.c 2009-06-16 11:42:21 UTC (rev 1376) @@ -1379,15 +1379,18 @@ static gpgme_error_t -gpgsm_export (void *engine, const char *pattern, unsigned int reserved, +gpgsm_export (void *engine, const char *pattern, gpgme_export_mode_t mode, gpgme_data_t keydata, int use_armor) { engine_gpgsm_t gpgsm = engine; gpgme_error_t err = 0; char *cmd; - if (!gpgsm || reserved) + if (!gpgsm) return gpg_error (GPG_ERR_INV_VALUE); + + if (mode) + return gpg_error (GPG_ERR_NOT_SUPPORTED); if (!pattern) pattern = ""; @@ -1414,7 +1417,7 @@ static gpgme_error_t -gpgsm_export_ext (void *engine, const char *pattern[], unsigned int reserved, +gpgsm_export_ext (void *engine, const char *pattern[], gpgme_export_mode_t mode, gpgme_data_t keydata, int use_armor) { engine_gpgsm_t gpgsm = engine; @@ -1424,9 +1427,12 @@ int length = 7 + 1; char *linep; - if (!gpgsm || reserved) + if (!gpgsm) return gpg_error (GPG_ERR_INV_VALUE); + if (mode) + return gpg_error (GPG_ERR_NOT_SUPPORTED); + if (pattern && *pattern) { const char **pat = pattern; @@ -1534,7 +1540,7 @@ static gpgme_error_t -gpgsm_import (void *engine, gpgme_data_t keydata) +gpgsm_import (void *engine, gpgme_data_t keydata, gpgme_key_t *keyarray) { engine_gpgsm_t gpgsm = engine; gpgme_error_t err; @@ -1542,14 +1548,24 @@ if (!gpgsm) return gpg_error (GPG_ERR_INV_VALUE); - gpgsm->input_cb.data = keydata; - err = gpgsm_set_fd (gpgsm, INPUT_FD, map_data_enc (gpgsm->input_cb.data)); - if (err) - return err; - gpgsm_clear_fd (gpgsm, OUTPUT_FD); - gpgsm_clear_fd (gpgsm, MESSAGE_FD); - gpgsm->inline_data = NULL; + if (keydata && keyarray) + gpg_error (GPG_ERR_INV_VALUE); /* Only one is allowed. */ + if (keyarray) + { + return gpg_error (GPG_ERR_NOT_IMPLEMENTED); + } + else + { + gpgsm->input_cb.data = keydata; + err = gpgsm_set_fd (gpgsm, INPUT_FD, map_data_enc (gpgsm->input_cb.data)); + if (err) + return err; + gpgsm_clear_fd (gpgsm, OUTPUT_FD); + gpgsm_clear_fd (gpgsm, MESSAGE_FD); + gpgsm->inline_data = NULL; + } + err = start (gpgsm, "IMPORT"); return err; } Modified: trunk/src/engine.c =================================================================== --- trunk/src/engine.c 2009-06-15 17:05:47 UTC (rev 1375) +++ trunk/src/engine.c 2009-06-16 11:42:21 UTC (rev 1376) @@ -620,7 +620,7 @@ gpgme_error_t _gpgme_engine_op_export (engine_t engine, const char *pattern, - unsigned int reserved, gpgme_data_t keydata, + gpgme_export_mode_t mode, gpgme_data_t keydata, int use_armor) { if (!engine) @@ -629,7 +629,7 @@ if (!engine->ops->export) return gpg_error (GPG_ERR_NOT_IMPLEMENTED); - return (*engine->ops->export) (engine->engine, pattern, reserved, + return (*engine->ops->export) (engine->engine, pattern, mode, keydata, use_armor); } @@ -667,7 +667,8 @@ gpgme_error_t -_gpgme_engine_op_import (engine_t engine, gpgme_data_t keydata) +_gpgme_engine_op_import (engine_t engine, gpgme_data_t keydata, + gpgme_key_t *keyarray) { if (!engine) return gpg_error (GPG_ERR_INV_VALUE); @@ -675,7 +676,7 @@ if (!engine->ops->import) return gpg_error (GPG_ERR_NOT_IMPLEMENTED); - return (*engine->ops->import) (engine->engine, keydata); + return (*engine->ops->import) (engine->engine, keydata, keyarray); } Modified: trunk/src/engine.h =================================================================== --- trunk/src/engine.h 2009-06-15 17:05:47 UTC (rev 1375) +++ trunk/src/engine.h 2009-06-16 11:42:21 UTC (rev 1376) @@ -93,11 +93,11 @@ int use_armor, gpgme_ctx_t ctx /* FIXME */); gpgme_error_t _gpgme_engine_op_export (engine_t engine, const char *pattern, - unsigned int reserved, + gpgme_export_mode_t mode, gpgme_data_t keydata, int use_armor); gpgme_error_t _gpgme_engine_op_export_ext (engine_t engine, const char *pattern[], - unsigned int reserved, + gpgme_export_mode_t mode, gpgme_data_t keydata, int use_armor); gpgme_error_t _gpgme_engine_op_genkey (engine_t engine, @@ -105,7 +105,8 @@ int use_armor, gpgme_data_t pubkey, gpgme_data_t seckey); gpgme_error_t _gpgme_engine_op_import (engine_t engine, - gpgme_data_t keydata); + gpgme_data_t keydata, + gpgme_key_t *keyarray); gpgme_error_t _gpgme_engine_op_keylist (engine_t engine, const char *pattern, int secret_only, Modified: trunk/src/export.c =================================================================== --- trunk/src/export.c 2009-06-15 17:05:47 UTC (rev 1375) +++ trunk/src/export.c 2009-06-16 11:42:21 UTC (rev 1376) @@ -22,6 +22,8 @@ #if HAVE_CONFIG_H #include #endif +#include +#include #include "gpgme.h" #include "context.h" @@ -37,39 +39,51 @@ static gpgme_error_t export_start (gpgme_ctx_t ctx, int synchronous, const char *pattern, - unsigned int reserved, gpgme_data_t keydata) + gpgme_export_mode_t mode, gpgme_data_t keydata) { gpgme_error_t err; - if (!keydata) - return gpg_error (GPG_ERR_INV_VALUE); + if ((mode & ~(GPGME_EXPORT_MODE_EXTERN))) + return gpg_error (GPG_ERR_INV_VALUE); /* Invalid flags in MODE. */ + + if ((mode & GPGME_EXPORT_MODE_EXTERN)) + { + if (keydata) + return gpg_error (GPG_ERR_INV_VALUE); + } + else + { + if (!keydata) + return gpg_error (GPG_ERR_INV_VALUE); + } + err = _gpgme_op_reset (ctx, synchronous); if (err) return err; _gpgme_engine_set_status_handler (ctx->engine, export_status_handler, ctx); - return _gpgme_engine_op_export (ctx->engine, pattern, reserved, keydata, + return _gpgme_engine_op_export (ctx->engine, pattern, mode, keydata, ctx->use_armor); } -/* Export the keys listed in RECP into KEYDATA. */ +/* Export the keys listed in PATTERN into KEYDATA. */ gpgme_error_t gpgme_op_export_start (gpgme_ctx_t ctx, const char *pattern, - unsigned int reserved, gpgme_data_t keydata) + gpgme_export_mode_t mode, gpgme_data_t keydata) { - return export_start (ctx, 0, pattern, reserved, keydata); + return export_start (ctx, 0, pattern, mode, keydata); } -/* Export the keys listed in RECP into KEYDATA. */ +/* Export the keys listed in PATTERN into KEYDATA. */ gpgme_error_t -gpgme_op_export (gpgme_ctx_t ctx, const char *pattern, unsigned int reserved, - gpgme_data_t keydata) +gpgme_op_export (gpgme_ctx_t ctx, const char *pattern, + gpgme_export_mode_t mode, gpgme_data_t keydata) { - gpgme_error_t err = export_start (ctx, 1, pattern, reserved, keydata); + gpgme_error_t err = export_start (ctx, 1, pattern, mode, keydata); if (!err) err = _gpgme_wait_one (ctx); return err; @@ -78,40 +92,132 @@ static gpgme_error_t export_ext_start (gpgme_ctx_t ctx, int synchronous, const char *pattern[], - unsigned int reserved, gpgme_data_t keydata) + gpgme_export_mode_t mode, gpgme_data_t keydata) { gpgme_error_t err; - if (!keydata) - return gpg_error (GPG_ERR_INV_VALUE); + if ((mode & ~(GPGME_EXPORT_MODE_EXTERN))) + return gpg_error (GPG_ERR_INV_VALUE); /* Invalid flags in MODE. */ + if ((mode & GPGME_EXPORT_MODE_EXTERN)) + { + if (keydata) + return gpg_error (GPG_ERR_INV_VALUE); + } + else + { + if (!keydata) + return gpg_error (GPG_ERR_INV_VALUE); + } + err = _gpgme_op_reset (ctx, synchronous); if (err) return err; _gpgme_engine_set_status_handler (ctx->engine, export_status_handler, ctx); - return _gpgme_engine_op_export_ext (ctx->engine, pattern, reserved, keydata, + return _gpgme_engine_op_export_ext (ctx->engine, pattern, mode, keydata, ctx->use_armor); } -/* Export the keys listed in RECP into KEYDATA. */ +/* Export the keys listed in PATTERN into KEYDATA. */ gpgme_error_t gpgme_op_export_ext_start (gpgme_ctx_t ctx, const char *pattern[], - unsigned int reserved, gpgme_data_t keydata) + gpgme_export_mode_t mode, gpgme_data_t keydata) { - return export_ext_start (ctx, 0, pattern, reserved, keydata); + return export_ext_start (ctx, 0, pattern, mode, keydata); } -/* Export the keys listed in RECP into KEYDATA. */ +/* Export the keys listed in PATTERN into KEYDATA. */ gpgme_error_t gpgme_op_export_ext (gpgme_ctx_t ctx, const char *pattern[], - unsigned int reserved, gpgme_data_t keydata) + gpgme_export_mode_t mode, gpgme_data_t keydata) { - gpgme_error_t err = export_ext_start (ctx, 1, pattern, reserved, keydata); + gpgme_error_t err = export_ext_start (ctx, 1, pattern, mode, keydata); if (!err) err = _gpgme_wait_one (ctx); return err; } + + + + + +static gpgme_error_t +export_keys_start (gpgme_ctx_t ctx, int synchronous, gpgme_key_t keys[], + gpgme_export_mode_t mode, gpgme_data_t keydata) +{ + gpgme_error_t err; + int nkeys, idx; + char **pattern; + + if (!keys) + return gpg_error (GPG_ERR_INV_VALUE); + + /* Create a list of pattern from the keys. */ + for (idx=nkeys=0; keys[idx]; idx++) + if (keys[idx]->protocol == ctx->protocol) + nkeys++; + if (!nkeys) + return gpg_error (GPG_ERR_NO_DATA); + + pattern = calloc (nkeys+1, sizeof *pattern); + if (!pattern) + return gpg_error_from_syserror (); + + for (idx=nkeys=0; keys[idx]; idx++) + if (keys[idx]->protocol == ctx->protocol + && keys[idx]->subkeys + && keys[idx]->subkeys->fpr + && *keys[idx]->subkeys->fpr) + { + pattern[nkeys] = strdup (keys[idx]->subkeys->fpr); + if (!pattern[nkeys]) + { + err = gpg_error_from_syserror (); + goto leave; + } + nkeys++; + } + + + /* Pass on to the regular function. */ + err = export_ext_start (ctx, synchronous, (const char**)pattern, + mode, keydata); + + leave: + for (idx=0; pattern[idx]; idx++) + free (pattern[idx]); + free (pattern); + + return err; +} + + +/* Export the keys from the array KEYS into KEYDATA. Only keys of the + current protocol are exported and only those which have a + fingerprint set; that is keys received with some external search + methods are silently skipped. */ +gpgme_error_t +gpgme_op_export_keys_start (gpgme_ctx_t ctx, + gpgme_key_t keys[], + gpgme_export_mode_t mode, + gpgme_data_t keydata) +{ + return export_keys_start (ctx, 0, keys, mode, keydata); +} + +gpgme_error_t +gpgme_op_export_keys (gpgme_ctx_t ctx, + gpgme_key_t keys[], + gpgme_export_mode_t mode, + gpgme_data_t keydata) +{ + gpgme_error_t err = export_keys_start (ctx, 1, keys, mode, keydata); + if (!err) + err = _gpgme_wait_one (ctx); + return err; +} + Modified: trunk/src/gpgme.def =================================================================== --- trunk/src/gpgme.def 2009-06-15 17:05:47 UTC (rev 1375) +++ trunk/src/gpgme.def 2009-06-16 11:42:21 UTC (rev 1376) @@ -180,5 +180,10 @@ gpgme_release_ref @138 gpgme_release_unref @139 + gpgme_op_import_keys @140 + gpgme_op_import_keys_start @141 + gpgme_op_export_keys @142 + gpgme_op_export_keys_start @143 + ; END Modified: trunk/src/gpgme.h.in =================================================================== --- trunk/src/gpgme.h.in 2009-06-15 17:05:47 UTC (rev 1375) +++ trunk/src/gpgme.h.in 2009-06-16 11:42:21 UTC (rev 1376) @@ -329,6 +329,12 @@ typedef unsigned int gpgme_keylist_mode_t; +/* The available export mode flags. */ +#define GPGME_EXPORT_MODE_EXTERN 2 + +typedef unsigned int gpgme_export_mode_t; + + /* Flags for the audit log functions. */ #define GPGME_AUDITLOG_HTML 1 #define GPGME_AUDITLOG_WITH_HELP 128 @@ -1497,22 +1503,39 @@ gpgme_error_t gpgme_op_import_ext (gpgme_ctx_t ctx, gpgme_data_t keydata, int *nr) _GPGME_DEPRECATED; +/* Import the keys from the array KEYS into the keyring. */ +gpgme_error_t gpgme_op_import_keys_start (gpgme_ctx_t ctx, gpgme_key_t keys[]); +gpgme_error_t gpgme_op_import_keys (gpgme_ctx_t ctx, gpgme_key_t keys[]); + + /* Export the keys found by PATTERN into KEYDATA. */ gpgme_error_t gpgme_op_export_start (gpgme_ctx_t ctx, const char *pattern, - unsigned int reserved, + gpgme_export_mode_t mode, gpgme_data_t keydata); gpgme_error_t gpgme_op_export (gpgme_ctx_t ctx, const char *pattern, - unsigned int reserved, gpgme_data_t keydata); + gpgme_export_mode_t mode, + gpgme_data_t keydata); gpgme_error_t gpgme_op_export_ext_start (gpgme_ctx_t ctx, const char *pattern[], - unsigned int reserved, + gpgme_export_mode_t mode, gpgme_data_t keydata); gpgme_error_t gpgme_op_export_ext (gpgme_ctx_t ctx, const char *pattern[], - unsigned int reserved, + gpgme_export_mode_t mode, gpgme_data_t keydata); +/* Export the keys from the array KEYS into KEYDATA. */ +gpgme_error_t gpgme_op_export_keys_start (gpgme_ctx_t ctx, + gpgme_key_t keys[], + gpgme_export_mode_t mode, + gpgme_data_t keydata); +gpgme_error_t gpgme_op_export_keys (gpgme_ctx_t ctx, + gpgme_key_t keys[], + gpgme_export_mode_t mode, + gpgme_data_t keydata); + + /* Key generation. */ struct _gpgme_op_genkey_result Modified: trunk/src/import.c =================================================================== --- trunk/src/import.c 2009-06-15 17:05:47 UTC (rev 1375) +++ trunk/src/import.c 2009-06-16 11:42:21 UTC (rev 1376) @@ -238,7 +238,7 @@ _gpgme_engine_set_status_handler (ctx->engine, import_status_handler, ctx); - return _gpgme_engine_op_import (ctx->engine, keydata); + return _gpgme_engine_op_import (ctx->engine, keydata, NULL); } @@ -260,7 +260,85 @@ } + +static gpgme_error_t +_gpgme_op_import_keys_start (gpgme_ctx_t ctx, int synchronous, + gpgme_key_t *keys) +{ + gpgme_error_t err; + void *hook; + op_data_t opd; + int idx, firstidx, nkeys; + + err = _gpgme_op_reset (ctx, synchronous); + if (err) + return err; + + err = _gpgme_op_data_lookup (ctx, OPDATA_IMPORT, &hook, + sizeof (*opd), release_op_data); + opd = hook; + if (err) + return err; + opd->lastp = &opd->result.imports; + + if (!keys) + return gpg_error (GPG_ERR_NO_DATA); + + for (idx=nkeys=0, firstidx=-1; keys[idx]; idx++) + { + /* We only consider keys of the current protocol. */ + if (keys[idx]->protocol != ctx->protocol) + continue; + if (firstidx == -1) + firstidx = idx; + /* If a key has been found using a different key listing mode, + we bail out. This makes the processing easier. Fixme: To + allow a mix of keys we would need to sort them by key listing + mode and start two import operations one after the other. */ + if (keys[idx]->keylist_mode != keys[firstidx]->keylist_mode) + return gpg_error (GPG_ERR_CONFLICT); + nkeys++; + } + if (!nkeys) + return gpg_error (GPG_ERR_NO_DATA); + + _gpgme_engine_set_status_handler (ctx->engine, import_status_handler, ctx); + + return _gpgme_engine_op_import (ctx->engine, NULL, keys); +} + + +/* Asynchronous version of gpgme_op_import_key. */ gpgme_error_t +gpgme_op_import_keys_start (gpgme_ctx_t ctx, gpgme_key_t *keys) +{ + return _gpgme_op_import_keys_start (ctx, 0, keys); +} + + +/* Import the keys from the array KEYS into the keyring. This + function allows to move a key from one engine to another as long as + they are compatible. In particular it is used to actually import + keys retrieved from an external source (i.e. using + GPGME_KEYLIST_MODE_EXTERN). It replaces the old workaround of + exporting and then importing a key as used to make an X.509 key + permanent. This function automagically does the right thing. + + KEYS is a NULL terminated array of gpgme key objects. The result + is the usual import result structure. Only keys matching the + current protocol are imported; other keys are ignored. */ +gpgme_error_t +gpgme_op_import_keys (gpgme_ctx_t ctx, gpgme_key_t *keys) +{ + gpgme_error_t err = _gpgme_op_import_keys_start (ctx, 1, keys); + if (!err) + err = _gpgme_wait_one (ctx); + return err; +} + + +/* Deprecated interface. */ +gpgme_error_t gpgme_op_import_ext (gpgme_ctx_t ctx, gpgme_data_t keydata, int *nr) { gpgme_error_t err = gpgme_op_import (ctx, keydata); Modified: trunk/src/libgpgme.vers =================================================================== --- trunk/src/libgpgme.vers 2009-06-15 17:05:47 UTC (rev 1375) +++ trunk/src/libgpgme.vers 2009-06-16 11:42:21 UTC (rev 1376) @@ -59,6 +59,11 @@ gpgme_result_ref; gpgme_result_unref; + + gpgme_op_import_keys; + gpgme_op_import_keys_start; + gpgme_op_export_keys; + gpgme_op_export_keys_start; }; Modified: trunk/tests/gpg/Makefile.am =================================================================== --- trunk/tests/gpg/Makefile.am 2009-06-15 17:05:47 UTC (rev 1375) +++ trunk/tests/gpg/Makefile.am 2009-06-16 11:42:21 UTC (rev 1376) @@ -50,7 +50,8 @@ t_thread1_LDADD = ../../src/libgpgme-pthread.la # We don't run t-genkey in the test suite, because it takes too long -noinst_PROGRAMS = $(TESTS) t-genkey +# The other programs are used for debugging. +noinst_PROGRAMS = $(TESTS) t-genkey pgp-keylist pgp-export mkdemodirs: mkdemodirs.in Makefile sed -e 's,[@]GPG[@],$(GPG),g' < $(srcdir)/mkdemodirs.in > mkdemodirs Added: trunk/tests/gpg/pgp-export.c =================================================================== --- trunk/tests/gpg/pgp-export.c (rev 0) +++ trunk/tests/gpg/pgp-export.c 2009-06-16 11:42:21 UTC (rev 1376) @@ -0,0 +1,168 @@ +/* pgp-export.c - Helper to run an export command + Copyright (C) 2008, 2009 g10 Code GmbH + + This file is part of GPGME. + + GPGME is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of + the License, or (at your option) any later version. + + GPGME is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this program; if not, see . +*/ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include + +#include + +#define PGM "pgp-export" + +#include "t-support.h" + + +static int verbose; + + +static const char * +nonnull (const char *s) +{ + return s? s :"[none]"; +} + + +static int +show_usage (int ex) +{ + fputs ("usage: " PGM " [options] USERIDS\n\n" + "Options:\n" + " --verbose run in verbose mode\n" + " --extern send keys to the keyserver (TAKE CARE!)\n" + , stderr); + exit (ex); +} + +int +main (int argc, char **argv) +{ + int last_argc = -1; + gpgme_error_t err; + gpgme_ctx_t ctx; + gpgme_key_t key; + gpgme_keylist_result_t result; + gpgme_key_t keyarray[100]; + int keyidx = 0; + gpgme_data_t out; + gpgme_export_mode_t mode = 0; + + if (argc) + { argc--; argv++; } + + while (argc && last_argc != argc ) + { + last_argc = argc; + if (!strcmp (*argv, "--")) + { + argc--; argv++; + break; + } + else if (!strcmp (*argv, "--help")) + show_usage (0); + else if (!strcmp (*argv, "--verbose")) + { + verbose = 1; + argc--; argv++; + } + else if (!strcmp (*argv, "--extern")) + { + mode |= GPGME_KEYLIST_MODE_EXTERN; + argc--; argv++; + } + else if (!strncmp (*argv, "--", 2)) + show_usage (1); + + } + + if (!argc) + show_usage (1); + + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + err = gpgme_new (&ctx); + fail_if_err (err); + gpgme_set_protocol (ctx, GPGME_PROTOCOL_OpenPGP); + + /* Lookup the keys. */ + err = gpgme_op_keylist_ext_start (ctx, (const char**)argv, 0, 0); + fail_if_err (err); + + while (!(err = gpgme_op_keylist_next (ctx, &key))) + { + printf ("keyid: %s (fpr: %s)\n", + key->subkeys?nonnull (key->subkeys->keyid):"?", + key->subkeys?nonnull (key->subkeys->fpr):"?"); + + if (keyidx < DIM (keyarray)-1) + keyarray[keyidx++] = key; + else + { + fprintf (stderr, PGM": too many keys" + "- skipping this key\n"); + gpgme_key_unref (key); + } + } + if (gpg_err_code (err) != GPG_ERR_EOF) + fail_if_err (err); + err = gpgme_op_keylist_end (ctx); + fail_if_err (err); + keyarray[keyidx] = NULL; + + result = gpgme_op_keylist_result (ctx); + if (result->truncated) + { + fprintf (stderr, PGM ": key listing unexpectedly truncated\n"); + exit (1); + } + + /* Now for the actual export. */ + if ((mode & GPGME_KEYLIST_MODE_EXTERN)) + printf ("sending keys to keyserver\n"); + + err = gpgme_data_new (&out); + fail_if_err (err); + + gpgme_set_armor (ctx, 1); + err = gpgme_op_export_keys (ctx, keyarray, mode, + (mode & GPGME_KEYLIST_MODE_EXTERN)? NULL:out); + fail_if_err (err); + + fflush (NULL); + if (!(mode & GPGME_KEYLIST_MODE_EXTERN)) + { + fputs ("Begin Result:\n", stdout); + print_data (out); + fputs ("End Result.\n", stdout); + } + + /* Cleanup. */ + gpgme_data_release (out); + + for (keyidx=0; keyarray[keyidx]; keyidx++) + gpgme_key_unref (keyarray[keyidx]); + + gpgme_release (ctx); + return 0; +} Added: trunk/tests/gpg/pgp-keylist.c =================================================================== --- trunk/tests/gpg/pgp-keylist.c (rev 0) +++ trunk/tests/gpg/pgp-keylist.c 2009-06-16 11:42:21 UTC (rev 1376) @@ -0,0 +1,284 @@ +/* pgp-keylist.c - Helper to show a key listing. + Copyright (C) 2008, 2009 g10 Code GmbH + + This file is part of GPGME. + + GPGME is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of + the License, or (at your option) any later version. + + GPGME is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this program; if not, see . +*/ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include + +#include + +#define PGM "pgp-keylist" + +#include "t-support.h" + + +static int verbose; + + +static const char * +nonnull (const char *s) +{ + return s? s :"[none]"; +} + + +static void +print_import_result (gpgme_import_result_t r) +{ + gpgme_import_status_t st; + + printf ("key import results:\n" + " considered: %d\n" + " no user id: %d\n" + " imported: %d\n" + " imported_rsa: %d\n" + " unchanged: %d\n" + " new user ids: %d\n" + " new subkeys: %d\n" + " new signatures: %d\n" + " new revocations: %d\n" + " secret read: %d\n" + " secret imported: %d\n" + " secret unchanged: %d\n" + " skipped new keys: %d\n" + " not imported: %d\n", + r->considered, + r->no_user_id, + r->imported, + r->imported_rsa, + r->unchanged, + r->new_user_ids, + r->new_sub_keys, + r->new_signatures, + r->new_revocations, + r->secret_read, + r->secret_imported, + r->secret_unchanged, + r->skipped_new_keys, + r->not_imported); + + for (st=r->imports; st; st = st->next) + { + printf (" fpr: %s err: %d (%s) status:", nonnull (st->fpr), + st->result, gpg_strerror (st->result)); + if (st->status & GPGME_IMPORT_NEW) + fputs (" new", stdout); + if (st->status & GPGME_IMPORT_UID) + fputs (" uid", stdout); + if (st->status & GPGME_IMPORT_SIG) + fputs (" sig", stdout); + if (st->status & GPGME_IMPORT_SUBKEY) + fputs (" subkey", stdout); + if (st->status & GPGME_IMPORT_SECRET) + fputs (" secret", stdout); + putchar ('\n'); + } +} + + +static int +show_usage (int ex) +{ + fputs ("usage: " PGM " [options] [USERID]\n\n" + "Options:\n" + " --verbose run in verbose mode\n" + " --local use GPGME_KEYLIST_MODE_LOCAL\n" + " --extern use GPGME_KEYLIST_MODE_EXTERN\n" + " --sigs use GPGME_KEYLIST_MODE_SIGS\n" + " --sig-notations use GPGME_KEYLIST_MODE_SIG_NOTATIONS\n" + " --ephemeral use GPGME_KEYLIST_MODE_EPHEMERAL\n" + " --validate use GPGME_KEYLIST_MODE_VALIDATE\n" + " --import import all keys\n" + , stderr); + exit (ex); +} + +int +main (int argc, char **argv) +{ + int last_argc = -1; + gpgme_error_t err; + gpgme_ctx_t ctx; + gpgme_keylist_mode_t mode = 0; + gpgme_key_t key; + gpgme_keylist_result_t result; + int import = 0; + gpgme_key_t keyarray[100]; + int keyidx = 0; + + if (argc) + { argc--; argv++; } + + while (argc && last_argc != argc ) + { + last_argc = argc; + if (!strcmp (*argv, "--")) + { + argc--; argv++; + break; + } + else if (!strcmp (*argv, "--help")) + show_usage (0); + else if (!strcmp (*argv, "--verbose")) + { + verbose = 1; + argc--; argv++; + } + else if (!strcmp (*argv, "--local")) + { + mode |= GPGME_KEYLIST_MODE_LOCAL; + argc--; argv++; + } + else if (!strcmp (*argv, "--extern")) + { + mode |= GPGME_KEYLIST_MODE_EXTERN; + argc--; argv++; + } + else if (!strcmp (*argv, "--sigs")) + { + mode |= GPGME_KEYLIST_MODE_SIGS; + argc--; argv++; + } + else if (!strcmp (*argv, "--sig-notations")) + { + mode |= GPGME_KEYLIST_MODE_SIG_NOTATIONS; + argc--; argv++; + } + else if (!strcmp (*argv, "--ephemeral")) + { + mode |= GPGME_KEYLIST_MODE_EPHEMERAL; + argc--; argv++; + } + else if (!strcmp (*argv, "--validate")) + { + mode |= GPGME_KEYLIST_MODE_VALIDATE; + argc--; argv++; + } + else if (!strcmp (*argv, "--import")) + { + import = 1; + argc--; argv++; + } + else if (!strncmp (*argv, "--", 2)) + show_usage (1); + + } + + if (argc > 1) + show_usage (1); + + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + err = gpgme_new (&ctx); + fail_if_err (err); + gpgme_set_protocol (ctx, GPGME_PROTOCOL_OpenPGP); + + gpgme_set_keylist_mode (ctx, mode); + + err = gpgme_op_keylist_start (ctx, argc? argv[0]:NULL, 0); + fail_if_err (err); + + while (!(err = gpgme_op_keylist_next (ctx, &key))) + { + gpgme_user_id_t uid; + int nuids; + + + printf ("keyid : %s\n", key->subkeys?nonnull (key->subkeys->keyid):"?"); + printf ("fpr : %s\n", key->subkeys?nonnull (key->subkeys->fpr):"?"); + printf ("caps : %s%s%s%s\n", + key->can_encrypt? "e":"", + key->can_sign? "s":"", + key->can_certify? "c":"", + key->can_authenticate? "a":""); + printf ("flags :%s%s%s%s%s%s\n", + key->secret? " secret":"", + key->revoked? " revoked":"", + key->expired? " expired":"", + key->disabled? " disabled":"", + key->invalid? " invalid":"", + key->is_qualified? " qualifid":""); + for (nuids=0, uid=key->uids; uid; uid = uid->next, nuids++) + { + printf ("userid %d: %s\n", nuids, nonnull(uid->uid)); + printf ("valid %d: %s\n", nuids, + uid->validity == GPGME_VALIDITY_UNKNOWN? "unknown": + uid->validity == GPGME_VALIDITY_UNDEFINED? "undefined": + uid->validity == GPGME_VALIDITY_NEVER? "never": + uid->validity == GPGME_VALIDITY_MARGINAL? "marginal": + uid->validity == GPGME_VALIDITY_FULL? "full": + uid->validity == GPGME_VALIDITY_ULTIMATE? "ultimate": "[?]"); + } + + putchar ('\n'); + + if (import) + { + if (keyidx < DIM (keyarray)-1) + keyarray[keyidx++] = key; + else + { + fprintf (stderr, PGM": too many keys in import mode" + "- skipping this key\n"); + gpgme_key_unref (key); + } + } + else + gpgme_key_unref (key); + } + if (gpg_err_code (err) != GPG_ERR_EOF) + fail_if_err (err); + err = gpgme_op_keylist_end (ctx); + fail_if_err (err); + keyarray[keyidx] = NULL; + + result = gpgme_op_keylist_result (ctx); + if (result->truncated) + { + fprintf (stderr, PGM ": key listing unexpectedly truncated\n"); + exit (1); + } + + if (import) + { + gpgme_import_result_t impres; + + err = gpgme_op_import_keys (ctx, keyarray); + fail_if_err (err); From cvs at cvs.gnupg.org Tue Jun 16 16:43:39 2009 From: cvs at cvs.gnupg.org (svn author marcus) Date: Tue, 16 Jun 2009 16:43:39 +0200 Subject: [svn] gpgme - r1377 - in trunk: . doc src Message-ID: Author: marcus Date: 2009-06-16 16:43:38 +0200 (Tue, 16 Jun 2009) New Revision: 1377 Modified: trunk/NEWS trunk/doc/ChangeLog trunk/doc/gpgme.texi trunk/src/ChangeLog trunk/src/gpgme.c Log: doc/ 2009-06-16 Marcus Brinkmann * gpgme.texi (Result Management): New section. src/ 2009-06-16 Marcus Brinkmann * gpgme.c (result_ref_lock): New global variable. (gpgme_result_ref, gpgme_result_unref): use it. Modified: trunk/doc/ChangeLog =================================================================== --- trunk/doc/ChangeLog 2009-06-16 11:42:21 UTC (rev 1376) +++ trunk/doc/ChangeLog 2009-06-16 14:43:38 UTC (rev 1377) @@ -1,3 +1,7 @@ +2009-06-16 Marcus Brinkmann + + * gpgme.texi (Result Management): New section. + 2009-06-16 Werner Koch * gpgme.texi (Exporting Keys): Document gpgme_op_export_keys. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2009-06-16 11:42:21 UTC (rev 1376) +++ trunk/src/ChangeLog 2009-06-16 14:43:38 UTC (rev 1377) @@ -1,3 +1,8 @@ +2009-06-16 Marcus Brinkmann + + * gpgme.c (result_ref_lock): New global variable. + (gpgme_result_ref, gpgme_result_unref): use it. + 2009-06-16 Werner Koch * gpgme.h.in (gpgme_op_export_keys_start, gpgme_op_export_keys): New. Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2009-06-16 11:42:21 UTC (rev 1376) +++ trunk/NEWS 2009-06-16 14:43:38 UTC (rev 1377) @@ -1,4 +1,4 @@ -Noteworthy changes in version 1.2.0 +Noteworthy changes in version 1.2.0 (unreleased) ------------------------------------------------ * New encryption flag GPGME_ENCRYPT_NO_ENCRYPT_TO to disable default @@ -11,6 +11,16 @@ * New functions gpgme_io_read and gpgme_io_write for use with gpgme_passphrase_cb_t and gpgme_edit_cb_t functions. + * New functions gpgme_result_ref and gpgme_result_unref to detach + result structures from a context. + + * New functions gpgme_op_export_keys_start and gpgme_op_export_keys + that allow to specify exported keys through gpgme_key_t objects + instead of patterns. + + * New mode of operation gpgme_export_mode_t that allows exporting + external keys. + * Interface changes relative to the 1.1.7 release: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GPGME_KEYLIST_MODE_EPHEMERAL NEW. Modified: trunk/doc/gpgme.texi =================================================================== --- trunk/doc/gpgme.texi 2009-06-16 11:42:21 UTC (rev 1376) +++ trunk/doc/gpgme.texi 2009-06-16 14:43:38 UTC (rev 1377) @@ -173,6 +173,7 @@ * Creating Contexts:: Creating new @acronym{GPGME} contexts. * Destroying Contexts:: Releasing @acronym{GPGME} contexts. +* Result Management:: Managing the result of crypto operations. * Context Attributes:: Setting properties of a context. * Key Management:: Managing keys with @acronym{GPGME}. * Trust Item Management:: Managing trust items with @acronym{GPGME}. @@ -1971,6 +1972,7 @@ @menu * Creating Contexts:: Creating new @acronym{GPGME} contexts. * Destroying Contexts:: Releasing @acronym{GPGME} contexts. +* Result Management:: Managing the result of crypto operations. * Context Attributes:: Setting properties of a context. * Key Management:: Managing keys with @acronym{GPGME}. * Trust Item Management:: Managing trust items with @acronym{GPGME}. @@ -2008,6 +2010,38 @@ @end deftypefun + at node Result Management + at section Result Management + at cindex context, result of operation + +The detailed result of an operation is returned in operation-specific +structures such as @code{gpgme_decrypt_result_t}. The corresponding +retrieval functions such as @code{gpgme_op_decrypt_result} provide +static access to the results after an operation completes. The +following interfaces make it possible to detach a result structure +from its associated context and give it a lifetime beyond that of the +current operation or context. + + at deftypefun void gpgme_result_ref (@w{void *@var{result}}) +The function @code{gpgme_result_ref} acquires an additional reference +for the result @var{result}, which may be of any type + at code{gpgme_*_result_t}. As long as the user holds a reference, the +result structure is guaranteed to be valid and unmodified. + at end deftypefun + + at deftypefun void gpgme_result_unref (@w{void *@var{result}}) +The function @code{gpgme_result_unref} releases a reference for the +result @var{result}. If this was the last reference, the result +structure will be destroyed and all resources associated to it will be +released. + at end deftypefun + +Note that a context may hold its own references to result structures, +typically until the context is destroyed or the next operation is +started. In fact, these references are accessed through the + at code{gpgme_op_*_result} functions. + + @node Context Attributes @section Context Attributes @cindex context, attributes Modified: trunk/src/gpgme.c =================================================================== --- trunk/src/gpgme.c 2009-06-16 11:42:21 UTC (rev 1376) +++ trunk/src/gpgme.c 2009-06-16 14:43:38 UTC (rev 1377) @@ -45,6 +45,10 @@ gpgme_error_t _gpgme_selftest = GPG_ERR_NOT_OPERATIONAL; +/* Protects all reference counters in result structures. All other + accesses to a key are read only. */ +DEFINE_STATIC_LOCK (result_ref_lock); + /* Create a new context as an environment for GPGME crypto operations. */ @@ -178,29 +182,39 @@ void gpgme_result_ref (void *result) { - struct ctx_op_data *data = result - sizeof (struct ctx_op_data); + struct ctx_op_data *data; if (! result) return; + data = result - sizeof (struct ctx_op_data); + + LOCK (result_ref_lock); data->references++; + UNLOCK (result_ref_lock); } void gpgme_result_unref (void *result) { - struct ctx_op_data *data = result - sizeof (struct ctx_op_data); + struct ctx_op_data *data; if (! result) return; - if (--data->references == 0) + data = result - sizeof (struct ctx_op_data); + + LOCK (result_ref_lock); + if (--data->references) { - if (data->cleanup) - (*data->cleanup) (data->hook); - free (data); + UNLOCK (result_ref_lock); + return; } + + if (data->cleanup) + (*data->cleanup) (data->hook); + free (data); } From cvs at cvs.gnupg.org Tue Jun 16 17:42:37 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue, 16 Jun 2009 17:42:37 +0200 Subject: [svn] gpgme - r1378 - in trunk: . doc src tests tests/gpg Message-ID: Author: wk Date: 2009-06-16 17:42:37 +0200 (Tue, 16 Jun 2009) New Revision: 1378 Added: trunk/tests/gpg/pgp-import.c Modified: trunk/NEWS trunk/doc/ChangeLog trunk/doc/gpgme.texi trunk/src/ChangeLog trunk/src/data.c trunk/src/engine-gpg.c trunk/src/gpgme.h.in trunk/src/version.c trunk/tests/ChangeLog trunk/tests/gpg/Makefile.am trunk/tests/gpg/pgp-export.c trunk/tests/gpg/pgp-keylist.c trunk/tests/gpg/t-support.h Log: Add support for gpg --fetch-keys. Modified: trunk/doc/ChangeLog =================================================================== --- trunk/doc/ChangeLog 2009-06-16 14:43:38 UTC (rev 1377) +++ trunk/doc/ChangeLog 2009-06-16 15:42:37 UTC (rev 1378) @@ -6,6 +6,7 @@ * gpgme.texi (Exporting Keys): Document gpgme_op_export_keys. (Importing Keys): Document gpgme_op_import_keys. + (Data Buffer Meta-Data): Document URL encodings. 2009-05-28 Marcus Brinkmann Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2009-06-16 14:43:38 UTC (rev 1377) +++ trunk/src/ChangeLog 2009-06-16 15:42:37 UTC (rev 1378) @@ -5,6 +5,14 @@ 2009-06-16 Werner Koch + * version.c: Include stdlib.h. + + * gpgme.h.in (gpgme_data_encoding_t): Add GPGME_DATA_ENCODING_URL, + GPGME_DATA_ENCODING_URLESC, GPGME_DATA_ENCODING_URL0. + * data.c (gpgme_data_set_encoding): Adjust for new values. + * engine-gpg.c (string_from_data): New. + (gpg_import): Implement --fetch-key feature. + * gpgme.h.in (gpgme_op_export_keys_start, gpgme_op_export_keys): New. * gpgme.def, libgpgme.vers: Add them. * export.c (gpgme_op_export_keys_start, gpgme_op_export_keys): New. Modified: trunk/tests/ChangeLog =================================================================== --- trunk/tests/ChangeLog 2009-06-16 14:43:38 UTC (rev 1377) +++ trunk/tests/ChangeLog 2009-06-16 15:42:37 UTC (rev 1378) @@ -1,5 +1,9 @@ 2009-06-16 Werner Koch + * gpg/pgp-import.c: New. + * gpg/t-support.h (print_import_result, nonnull): Factored out + from other tools. + * gpg/pgp-export.c, gpg/pgp-keylist.c: New. 2009-06-09 Werner Koch Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2009-06-16 14:43:38 UTC (rev 1377) +++ trunk/NEWS 2009-06-16 15:42:37 UTC (rev 1378) @@ -48,6 +48,9 @@ gpgme_op_export_ext EXTENDED: Arg RESERVED is now a MODE flag. gpgme_op_export_keys_start NEW. gpgme_op_export_keys NEW. + GPGME_DATA_ENCODING_URL NEW. + GPGME_DATA_ENCODING_URL0 NEW. + GPGME_DATA_ENCODING_URLESC NEW. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Modified: trunk/doc/gpgme.texi =================================================================== --- trunk/doc/gpgme.texi 2009-06-16 14:43:38 UTC (rev 1377) +++ trunk/doc/gpgme.texi 2009-06-16 15:42:37 UTC (rev 1378) @@ -1934,6 +1934,19 @@ @item GPGME_DATA_ENCODING_ARMOR This specifies that the data is encoded in an armored form as used by OpenPGP and PEM. + + at item GPGME_DATA_ENCODING_URL +The data is a list of linefeed delimited URLs. This is only useful with + at code{gpgme_op_import}. + + at item GPGME_DATA_ENCODING_URL0 +The data is a list of binary zero delimited URLs. This is only useful +with @code{gpgme_op_import}. + + at item GPGME_DATA_ENCODING_URLESC +The data is a list of linefeed delimited URLs with all control and space +characters percent escaped. This mode is is not yet implemented. + @end table @end deftp Modified: trunk/src/data.c =================================================================== --- trunk/src/data.c 2009-06-16 14:43:38 UTC (rev 1377) +++ trunk/src/data.c 2009-06-16 15:42:37 UTC (rev 1378) @@ -191,7 +191,7 @@ "encoding=%i", enc); if (!dh) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); - if (enc < 0 || enc > GPGME_DATA_ENCODING_ARMOR) + if (enc < 0 || enc > GPGME_DATA_ENCODING_URL0) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); dh->encoding = enc; return TRACE_ERR (0); Modified: trunk/src/engine-gpg.c =================================================================== --- trunk/src/engine-gpg.c 2009-06-16 14:43:38 UTC (rev 1377) +++ trunk/src/engine-gpg.c 2009-06-16 15:42:37 UTC (rev 1378) @@ -1803,17 +1803,121 @@ return err; } +/* Return the next DELIM delimited string from DATA as a C-string. + The caller needs to provide the address of a pointer variable which + he has to set to NULL before the first call. After the last call + to this function, this function needs to be called once more with + DATA set to NULL so that the function can release its internal + state. After that the pointer variable is free for use again. + Note that we use a delimiter and thus a trailing delimiter is not + required. DELIM may not be changed after the first call. */ +static const char * +string_from_data (gpgme_data_t data, int delim, + void **helpptr, gpgme_error_t *r_err) +{ +#define MYBUFLEN 2000 /* Fixme: We don't support URLs longer than that. */ + struct { + int eof_seen; + int nbytes; /* Length of the last returned string including + the delimiter. */ + int buflen; /* Valid length of BUF. */ + char buf[MYBUFLEN+1]; /* Buffer with one byte extra space. */ + } *self; + char *p; + int nread; + *r_err = 0; + if (!data) + { + if (*helpptr) + { + free (*helpptr); + *helpptr = NULL; + } + return NULL; + } + + if (*helpptr) + self = *helpptr; + else + { + self = malloc (sizeof *self); + if (!self) + { + *r_err = gpg_error_from_syserror (); + return NULL; + } + *helpptr = self; + self->eof_seen = 0; + self->nbytes = 0; + self->buflen = 0; + } + + if (self->eof_seen) + return NULL; + + assert (self->nbytes <= self->buflen); + memmove (self->buf, self->buf + self->nbytes, self->buflen - self->nbytes); + self->buflen -= self->nbytes; + self->nbytes = 0; + + do + { + /* Fixme: This is fairly infective scanning because we may scan + the buffer several times. */ + p = memchr (self->buf, delim, self->buflen); + if (p) + { + *p = 0; + self->nbytes = p - self->buf + 1; + return self->buf; + } + + if ( !(MYBUFLEN - self->buflen) ) + { + /* Not enough space - URL too long. */ + *r_err = gpg_error (GPG_ERR_TOO_LARGE); + return NULL; + } + + nread = gpgme_data_read (data, self->buf + self->buflen, + MYBUFLEN - self->buflen); + if (nread < 0) + { + *r_err = gpg_error_from_syserror (); + return NULL; + } + self->buflen += nread; + } + while (nread); + + /* EOF reached. If we have anything in the buffer, append a Nul and + return it. */ + self->eof_seen = 1; + if (self->buflen) + { + self->buf[self->buflen] = 0; /* (we allocated one extra byte) */ + return self->buf; + } + return NULL; +#undef MYBUFLEN +} + + + static gpgme_error_t gpg_import (void *engine, gpgme_data_t keydata, gpgme_key_t *keyarray) { engine_gpg_t gpg = engine; gpgme_error_t err; int idx; + gpgme_data_encoding_t dataenc; if (keydata && keyarray) gpg_error (GPG_ERR_INV_VALUE); /* Only one is allowed. */ + dataenc = gpgme_data_get_encoding (keydata); + if (keyarray) { err = add_arg (gpg, "--recv-keys"); @@ -1831,6 +1935,38 @@ err = add_arg (gpg, keyarray[idx]->subkeys->keyid); } } + else if (dataenc == GPGME_DATA_ENCODING_URL + || dataenc == GPGME_DATA_ENCODING_URL0) + { + void *helpptr; + const char *string; + gpgme_error_t xerr; + int delim = (dataenc == GPGME_DATA_ENCODING_URL)? '\n': 0; + + /* FIXME: --fetch-keys is probably not correct because it can't + grok all kinds of URLs. On Unix it should just work but on + Windows we will build the command line and that may fail for + some embedded control characters. It is anyway limited to + the maximum size of the command line. We need another + command which can take its input from a file. Maybe we + should use an option to gpg to modify such commands (ala + --multifile). */ + err = add_arg (gpg, "--fetch-keys"); + if (!err) + err = add_arg (gpg, "--"); + helpptr = NULL; + while (!err + && (string = string_from_data (keydata, delim, &helpptr, &xerr))) + err = add_arg (gpg, string); + if (!err) + err = xerr; + string_from_data (NULL, delim, &helpptr, &xerr); + } + else if (dataenc == GPGME_DATA_ENCODING_URLESC) + { + /* Already escaped URLs are not yet supported. */ + err = gpg_error (GPG_ERR_NOT_IMPLEMENTED); + } else { err = add_arg (gpg, "--import"); Modified: trunk/src/gpgme.h.in =================================================================== --- trunk/src/gpgme.h.in 2009-06-16 14:43:38 UTC (rev 1377) +++ trunk/src/gpgme.h.in 2009-06-16 15:42:37 UTC (rev 1378) @@ -185,7 +185,10 @@ GPGME_DATA_ENCODING_NONE = 0, /* Not specified. */ GPGME_DATA_ENCODING_BINARY = 1, GPGME_DATA_ENCODING_BASE64 = 2, - GPGME_DATA_ENCODING_ARMOR = 3 /* Either PEM or OpenPGP Armor. */ + GPGME_DATA_ENCODING_ARMOR = 3, /* Either PEM or OpenPGP Armor. */ + GPGME_DATA_ENCODING_URL = 4, /* LF delimited URL list. */ + GPGME_DATA_ENCODING_URLESC = 5, /* Ditto, but percent escaped. */ + GPGME_DATA_ENCODING_URL0 = 6 /* Nul delimited URL list. */ } gpgme_data_encoding_t; Modified: trunk/src/version.c =================================================================== --- trunk/src/version.c 2009-06-16 14:43:38 UTC (rev 1377) +++ trunk/src/version.c 2009-06-16 15:42:37 UTC (rev 1378) @@ -22,6 +22,7 @@ #if HAVE_CONFIG_H #include #endif +#include #include #include #include Modified: trunk/tests/gpg/Makefile.am =================================================================== --- trunk/tests/gpg/Makefile.am 2009-06-16 14:43:38 UTC (rev 1377) +++ trunk/tests/gpg/Makefile.am 2009-06-16 15:42:37 UTC (rev 1378) @@ -51,7 +51,7 @@ # We don't run t-genkey in the test suite, because it takes too long # The other programs are used for debugging. -noinst_PROGRAMS = $(TESTS) t-genkey pgp-keylist pgp-export +noinst_PROGRAMS = $(TESTS) t-genkey pgp-keylist pgp-export pgp-import mkdemodirs: mkdemodirs.in Makefile sed -e 's,[@]GPG[@],$(GPG),g' < $(srcdir)/mkdemodirs.in > mkdemodirs Modified: trunk/tests/gpg/pgp-export.c =================================================================== --- trunk/tests/gpg/pgp-export.c 2009-06-16 14:43:38 UTC (rev 1377) +++ trunk/tests/gpg/pgp-export.c 2009-06-16 15:42:37 UTC (rev 1378) @@ -37,13 +37,6 @@ static int verbose; -static const char * -nonnull (const char *s) -{ - return s? s :"[none]"; -} - - static int show_usage (int ex) { Added: trunk/tests/gpg/pgp-import.c =================================================================== --- trunk/tests/gpg/pgp-import.c (rev 0) +++ trunk/tests/gpg/pgp-import.c 2009-06-16 15:42:37 UTC (rev 1378) @@ -0,0 +1,129 @@ +/* pgp-import.c - Helper to run an import command + Copyright (C) 2008, 2009 g10 Code GmbH + + This file is part of GPGME. + + GPGME is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of + the License, or (at your option) any later version. + + GPGME is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this program; if not, see . +*/ + +/* We need to include config.h so that we know whether we are building + with large file system (LFS) support. */ +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include + +#include + +#define PGM "pgp-import" + +#include "t-support.h" + + +static int verbose; + + +static int +show_usage (int ex) +{ + fputs ("usage: " PGM " [options] FILENAMEs\n\n" + "Options:\n" + " --verbose run in verbose mode\n" + " --url import from given URLs\n" + " -0 URLs are delimited by a nul\n" + , stderr); + exit (ex); +} + +int +main (int argc, char **argv) +{ + int last_argc = -1; + gpgme_error_t err; + gpgme_ctx_t ctx; + int url_mode = 0; + int nul_mode = 0; + gpgme_import_result_t impres; + gpgme_data_t data; + + if (argc) + { argc--; argv++; } + while (argc && last_argc != argc ) + { + last_argc = argc; + if (!strcmp (*argv, "--")) + { + argc--; argv++; + break; + } + else if (!strcmp (*argv, "--help")) + show_usage (0); + else if (!strcmp (*argv, "--verbose")) + { + verbose = 1; + argc--; argv++; + } + else if (!strcmp (*argv, "--url")) + { + url_mode = 1; + argc--; argv++; + } + else if (!strcmp (*argv, "-0")) + { + nul_mode = 1; + argc--; argv++; + } + else if (!strncmp (*argv, "--", 2)) + show_usage (1); + + } + + if (!argc) + show_usage (1); + + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + err = gpgme_new (&ctx); + fail_if_err (err); + gpgme_set_protocol (ctx, GPGME_PROTOCOL_OpenPGP); + + for (; argc; argc--, argv++) + { + printf ("reading file `%s'\n", *argv); + err = gpgme_data_new_from_file (&data, *argv, 1); + fail_if_err (err); + + if (url_mode) + gpgme_data_set_encoding (data, (nul_mode? GPGME_DATA_ENCODING_URL0 + : GPGME_DATA_ENCODING_URL)); + + err = gpgme_op_import (ctx, data); + fail_if_err (err); + impres = gpgme_op_import_result (ctx); + if (!impres) + { + fprintf (stderr, PGM ": no import result returned\n"); + exit (1); + } + print_import_result (impres); + + gpgme_data_release (data); + } + + gpgme_release (ctx); + return 0; +} Modified: trunk/tests/gpg/pgp-keylist.c =================================================================== --- trunk/tests/gpg/pgp-keylist.c 2009-06-16 14:43:38 UTC (rev 1377) +++ trunk/tests/gpg/pgp-keylist.c 2009-06-16 15:42:37 UTC (rev 1378) @@ -37,67 +37,6 @@ static int verbose; -static const char * -nonnull (const char *s) -{ - return s? s :"[none]"; -} - - -static void -print_import_result (gpgme_import_result_t r) -{ - gpgme_import_status_t st; - - printf ("key import results:\n" - " considered: %d\n" - " no user id: %d\n" - " imported: %d\n" - " imported_rsa: %d\n" - " unchanged: %d\n" - " new user ids: %d\n" - " new subkeys: %d\n" - " new signatures: %d\n" - " new revocations: %d\n" - " secret read: %d\n" - " secret imported: %d\n" - " secret unchanged: %d\n" - " skipped new keys: %d\n" - " not imported: %d\n", - r->considered, - r->no_user_id, - r->imported, - r->imported_rsa, - r->unchanged, - r->new_user_ids, - r->new_sub_keys, - r->new_signatures, - r->new_revocations, - r->secret_read, - r->secret_imported, - r->secret_unchanged, - r->skipped_new_keys, - r->not_imported); - - for (st=r->imports; st; st = st->next) - { - printf (" fpr: %s err: %d (%s) status:", nonnull (st->fpr), - st->result, gpg_strerror (st->result)); - if (st->status & GPGME_IMPORT_NEW) - fputs (" new", stdout); - if (st->status & GPGME_IMPORT_UID) - fputs (" uid", stdout); - if (st->status & GPGME_IMPORT_SIG) - fputs (" sig", stdout); - if (st->status & GPGME_IMPORT_SUBKEY) - fputs (" subkey", stdout); - if (st->status & GPGME_IMPORT_SECRET) - fputs (" secret", stdout); - putchar ('\n'); - } -} - - static int show_usage (int ex) { Modified: trunk/tests/gpg/t-support.h =================================================================== --- trunk/tests/gpg/t-support.h 2009-06-16 14:43:38 UTC (rev 1377) +++ trunk/tests/gpg/t-support.h 2009-06-16 15:42:37 UTC (rev 1378) @@ -48,6 +48,13 @@ while (0) +static const char * +nonnull (const char *s) +{ + return s? s :"[none]"; +} + + void print_data (gpgme_data_t dh) { @@ -113,3 +120,57 @@ err = gpgme_engine_check_version (proto); fail_if_err (err); } + + +void +print_import_result (gpgme_import_result_t r) +{ + gpgme_import_status_t st; + + for (st=r->imports; st; st = st->next) + { + printf (" fpr: %s err: %d (%s) status:", nonnull (st->fpr), + st->result, gpg_strerror (st->result)); + if (st->status & GPGME_IMPORT_NEW) + fputs (" new", stdout); + if (st->status & GPGME_IMPORT_UID) + fputs (" uid", stdout); + if (st->status & GPGME_IMPORT_SIG) + fputs (" sig", stdout); + if (st->status & GPGME_IMPORT_SUBKEY) + fputs (" subkey", stdout); + if (st->status & GPGME_IMPORT_SECRET) + fputs (" secret", stdout); + putchar ('\n'); + } + printf ("key import summary:\n" + " considered: %d\n" + " no user id: %d\n" + " imported: %d\n" + " imported_rsa: %d\n" + " unchanged: %d\n" + " new user ids: %d\n" + " new subkeys: %d\n" + " new signatures: %d\n" + " new revocations: %d\n" + " secret read: %d\n" + " secret imported: %d\n" + " secret unchanged: %d\n" + " skipped new keys: %d\n" + " not imported: %d\n", + r->considered, + r->no_user_id, + r->imported, + r->imported_rsa, + r->unchanged, + r->new_user_ids, + r->new_sub_keys, + r->new_signatures, + r->new_revocations, + r->secret_read, + r->secret_imported, + r->secret_unchanged, + r->skipped_new_keys, + r->not_imported); +} + From cvs at cvs.gnupg.org Wed Jun 17 11:45:51 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 17 Jun 2009 11:45:51 +0200 Subject: [svn] GnuPG - r5043 - in trunk: common g10 scd Message-ID: Author: wk Date: 2009-06-17 11:45:50 +0200 (Wed, 17 Jun 2009) New Revision: 5043 Modified: trunk/common/exechelp.c trunk/g10/ChangeLog trunk/g10/call-agent.c trunk/g10/call-agent.h trunk/g10/card-util.c trunk/g10/keyserver.c trunk/scd/ChangeLog trunk/scd/app-openpgp.c trunk/scd/iso7816.c trunk/scd/iso7816.h Log: Add readcert command. fix reading large certificates. Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2009-06-09 23:07:48 UTC (rev 5042) +++ trunk/g10/ChangeLog 2009-06-17 09:45:50 UTC (rev 5043) @@ -1,3 +1,15 @@ +2009-06-17 Werner Koch + + * card-util.c (put_data_to_file, read_cert): New. + (card_edit): Add command "readcert". + (fetch_url): Allow code also for this gnupg major version 2. + * call-agent.c (agent_scd_readcert): New. + +2009-06-15 Werner Koch + + * keyserver.c (keyserver_search_prompt): No prompt in batch+colons + mode. + 2009-06-09 Werner Koch * card-util.c (write_sc_op_status): New. Modified: trunk/scd/ChangeLog =================================================================== --- trunk/scd/ChangeLog 2009-06-09 23:07:48 UTC (rev 5042) +++ trunk/scd/ChangeLog 2009-06-17 09:45:50 UTC (rev 5043) @@ -1,3 +1,17 @@ +2009-06-17 Werner Koch + + * iso7816.c (iso7816_get_data): Add arg EXTENDED_MODE. Change all + callers. + * app-openpgp.c (data_objects): Use bit flags. Add flag + TRY_EXTLENGTH. + (get_cached_data): Add arg TRY_EXTLEN and use it for iso7816_get_data. + (get_one_do): Use extended length APDU if necessary. + +2009-06-10 Werner Koch + + * app-openpgp.c (store_fpr): Change first arg to app_t; adjust + callers. Flush the cache. + 2009-06-09 Werner Koch * app-openpgp.c (do_readcert): Return NOT_FOUND if the retrieved Modified: trunk/common/exechelp.c =================================================================== --- trunk/common/exechelp.c 2009-06-09 23:07:48 UTC (rev 5042) +++ trunk/common/exechelp.c 2009-06-17 09:45:50 UTC (rev 5043) @@ -575,7 +575,7 @@ /* (int) pi.dwProcessId, (int) pi.dwThreadId); */ /* Fixme: For unknown reasons AllowSetForegroundWindow returns an - invalid argument error if we pass the the correct processID to + invalid argument error if we pass the correct processID to it. As a workaround we use -1 (ASFW_ANY). */ if ( (flags & 64) ) gnupg_allow_set_foregound_window ((pid_t)(-1)/*pi.dwProcessId*/); Modified: trunk/g10/call-agent.c =================================================================== --- trunk/g10/call-agent.c 2009-06-09 23:07:48 UTC (rev 5042) +++ trunk/g10/call-agent.c 2009-06-17 09:45:50 UTC (rev 5043) @@ -488,7 +488,6 @@ } - /* Handle a KEYDATA inquiry. Note, we only send the data, assuan_transact takes care of flushing and writing the end */ @@ -539,7 +538,6 @@ } - /* Status callback for the SCD GENKEY command. */ static int @@ -765,6 +763,43 @@ } + +/* Send a READCERT command to the SCdaemon. */ +int +agent_scd_readcert (const char *certidstr, + void **r_buf, size_t *r_buflen) +{ + int rc; + char line[ASSUAN_LINELENGTH]; + membuf_t data; + size_t len; + + *r_buf = NULL; + rc = start_agent (); + if (rc) + return rc; + + init_membuf (&data, 2048); + + snprintf (line, DIM(line)-1, "SCD READCERT %s", certidstr); + line[DIM(line)-1] = 0; + rc = assuan_transact (agent_ctx, line, + membuf_data_cb, &data, + default_inq_cb, NULL, NULL, NULL); + if (rc) + { + xfree (get_membuf (&data, &len)); + return rc; + } + *r_buf = get_membuf (&data, r_buflen); + if (!*r_buf) + return gpg_error (GPG_ERR_ENOMEM); + + return 0; +} + + + /* Change the PIN of an OpenPGP card or reset the retry counter. CHVNO 1: Change the PIN 2: For v1 cards: Same as 1. Modified: trunk/g10/call-agent.h =================================================================== --- trunk/g10/call-agent.h 2009-06-09 23:07:48 UTC (rev 5042) +++ trunk/g10/call-agent.h 2009-06-17 09:45:50 UTC (rev 5043) @@ -104,6 +104,10 @@ const unsigned char *indata, size_t indatalen, unsigned char **r_buf, size_t *r_buflen); +/* Send a READKEY command to the SCdaemon. */ +int agent_scd_readcert (const char *certidstr, + void **r_buf, size_t *r_buflen); + /* Change the PIN of an OpenPGP card or reset the retry counter. */ int agent_scd_change_pin (int chvno, const char *serialno); Modified: trunk/g10/card-util.c =================================================================== --- trunk/g10/card-util.c 2009-06-09 23:07:48 UTC (rev 5042) +++ trunk/g10/card-util.c 2009-06-17 09:45:50 UTC (rev 5043) @@ -715,7 +715,6 @@ static int fetch_url(void) { -#if GNUPG_MAJOR_VERSION == 1 int rc; struct agent_card_info_s info; @@ -755,15 +754,11 @@ } return rc; -#else - #warning need to implemented fucntion - return 0; -#endif } /* Read data from file FNAME up to MAXLEN characters. On error return - -1 and store NULl at R_BUFFER; on success return the number of + -1 and store NULL at R_BUFFER; on success return the number of bytes read and store the address of a newly allocated buffer at R_BUFFER. */ static int @@ -814,7 +809,40 @@ } +/* Write LENGTH bytes from BUFFER to file FNAME. Return 0 on + success. */ static int +put_data_to_file (const char *fname, const void *buffer, size_t length) +{ + FILE *fp; + + fp = fopen (fname, "wb"); +#if GNUPG_MAJOR_VERSION == 1 + if (fp && is_secured_file (fileno (fp))) + { + fclose (fp); + fp = NULL; + errno = EPERM; + } +#endif + if (!fp) + { + tty_printf (_("can't create `%s': %s\n"), fname, strerror (errno)); + return -1; + } + + if (length && fwrite (buffer, length, 1, fp) != 1) + { + tty_printf (_("error writing `%s': %s\n"), fname, strerror (errno)); + fclose (fp); + return -1; + } + fclose (fp); + return 0; +} + + +static int change_login (const char *args) { char *data; @@ -934,6 +962,37 @@ static int +read_cert (const char *args) +{ + const char *fname; + void *buffer; + size_t length; + int rc; + + if (args && *args == '>') /* Write it to a file */ + { + for (args++; spacep (args); args++) + ; + fname = args; + } + else + { + tty_printf ("usage error: redirectrion to file required\n"); + return -1; + } + + rc = agent_scd_readcert ("OPENPGP.3", &buffer, &length); + if (rc) + log_error ("error reading certificate from card: %s\n", gpg_strerror (rc)); + else + rc = put_data_to_file (fname, buffer, length); + xfree (buffer); + write_sc_op_status (rc); + return rc; +} + + +static int change_lang (void) { char *data, *p; @@ -1447,7 +1506,7 @@ cmdQUIT, cmdADMIN, cmdHELP, cmdLIST, cmdDEBUG, cmdVERIFY, cmdNAME, cmdURL, cmdFETCH, cmdLOGIN, cmdLANG, cmdSEX, cmdCAFPR, cmdFORCESIG, cmdGENERATE, cmdPASSWD, cmdPRIVATEDO, cmdWRITECERT, - cmdUNBLOCK, + cmdREADCERT, cmdUNBLOCK, cmdINVCMD }; @@ -1481,6 +1540,7 @@ { "unblock" , cmdUNBLOCK,0, N_("unblock the PIN using a Reset Code") }, /* Note, that we do not announce these command yet. */ { "privatedo", cmdPRIVATEDO, 0, NULL }, + { "readcert", cmdREADCERT, 0, NULL }, { "writecert", cmdWRITECERT, 1, NULL }, { NULL, cmdINVCMD, 0, NULL } }; @@ -1735,6 +1795,13 @@ change_cert (arg_rest); break; + case cmdREADCERT: + if ( arg_number != 3 ) + tty_printf ("usage: readcert 3 > FILE\n"); + else + read_cert (arg_rest); + break; + case cmdFORCESIG: toggle_forcesig (); break; Modified: trunk/g10/keyserver.c =================================================================== --- trunk/g10/keyserver.c 2009-06-09 23:07:48 UTC (rev 5042) +++ trunk/g10/keyserver.c 2009-06-17 09:45:50 UTC (rev 5043) @@ -862,6 +862,9 @@ if(i!=count) validcount=0; + if (opt.with_colons && opt.batch) + break; + for(;;) { if(show_prompt(desc,i,validcount?count:0,localstr)) Modified: trunk/scd/app-openpgp.c =================================================================== --- trunk/scd/app-openpgp.c 2009-06-09 23:07:48 UTC (rev 5042) +++ trunk/scd/app-openpgp.c 2009-06-17 09:45:50 UTC (rev 5043) @@ -75,43 +75,45 @@ int tag; int constructed; int get_from; /* Constructed DO with this DO or 0 for direct access. */ - int binary; - int dont_cache; - int flush_on_error; - int get_immediate_in_v11; /* Enable a hack to bypass the cache of - this data object if it is used in 1.1 - and later versions of the card. This - does not work with composite DO and is - currently only useful for the CHV - status bytes. */ + int binary:1; + int dont_cache:1; + int flush_on_error:1; + int get_immediate_in_v11:1; /* Enable a hack to bypass the cache of + this data object if it is used in 1.1 + and later versions of the card. This + does not work with composite DO and + is currently only useful for the CHV + status bytes. */ + int try_extlen:1; /* Large object; try to use an extended + length APDU. */ char *desc; } data_objects[] = { - { 0x005E, 0, 0, 1, 0, 0, 0, "Login Data" }, - { 0x5F50, 0, 0, 0, 0, 0, 0, "URL" }, - { 0x5F52, 0, 0, 1, 0, 0, 0, "Historical Bytes" }, - { 0x0065, 1, 0, 1, 0, 0, 0, "Cardholder Related Data"}, - { 0x005B, 0, 0x65, 0, 0, 0, 0, "Name" }, - { 0x5F2D, 0, 0x65, 0, 0, 0, 0, "Language preferences" }, - { 0x5F35, 0, 0x65, 0, 0, 0, 0, "Sex" }, - { 0x006E, 1, 0, 1, 0, 0, 0, "Application Related Data" }, - { 0x004F, 0, 0x6E, 1, 0, 0, 0, "AID" }, - { 0x0073, 1, 0, 1, 0, 0, 0, "Discretionary Data Objects" }, - { 0x0047, 0, 0x6E, 1, 1, 0, 0, "Card Capabilities" }, - { 0x00C0, 0, 0x6E, 1, 1, 0, 0, "Extended Card Capabilities" }, - { 0x00C1, 0, 0x6E, 1, 1, 0, 0, "Algorithm Attributes Signature" }, - { 0x00C2, 0, 0x6E, 1, 1, 0, 0, "Algorithm Attributes Decryption" }, - { 0x00C3, 0, 0x6E, 1, 1, 0, 0, "Algorithm Attributes Authentication" }, - { 0x00C4, 0, 0x6E, 1, 0, 1, 1, "CHV Status Bytes" }, - { 0x00C5, 0, 0x6E, 1, 0, 0, 0, "Fingerprints" }, - { 0x00C6, 0, 0x6E, 1, 0, 0, 0, "CA Fingerprints" }, - { 0x00CD, 0, 0x6E, 1, 0, 0, 0, "Generation time" }, - { 0x007A, 1, 0, 1, 0, 0, 0, "Security Support Template" }, - { 0x0093, 0, 0x7A, 1, 1, 0, 0, "Digital Signature Counter" }, - { 0x0101, 0, 0, 0, 0, 0, 0, "Private DO 1"}, - { 0x0102, 0, 0, 0, 0, 0, 0, "Private DO 2"}, - { 0x0103, 0, 0, 0, 0, 0, 0, "Private DO 3"}, - { 0x0104, 0, 0, 0, 0, 0, 0, "Private DO 4"}, - { 0x7F21, 1, 0, 1, 0, 0, 0, "Cardholder certificate"}, + { 0x005E, 0, 0, 1, 0, 0, 0, 0, "Login Data" }, + { 0x5F50, 0, 0, 0, 0, 0, 0, 0, "URL" }, + { 0x5F52, 0, 0, 1, 0, 0, 0, 0, "Historical Bytes" }, + { 0x0065, 1, 0, 1, 0, 0, 0, 0, "Cardholder Related Data"}, + { 0x005B, 0, 0x65, 0, 0, 0, 0, 0, "Name" }, + { 0x5F2D, 0, 0x65, 0, 0, 0, 0, 0, "Language preferences" }, + { 0x5F35, 0, 0x65, 0, 0, 0, 0, 0, "Sex" }, + { 0x006E, 1, 0, 1, 0, 0, 0, 0, "Application Related Data" }, + { 0x004F, 0, 0x6E, 1, 0, 0, 0, 0, "AID" }, + { 0x0073, 1, 0, 1, 0, 0, 0, 0, "Discretionary Data Objects" }, + { 0x0047, 0, 0x6E, 1, 1, 0, 0, 0, "Card Capabilities" }, + { 0x00C0, 0, 0x6E, 1, 1, 0, 0, 0, "Extended Card Capabilities" }, + { 0x00C1, 0, 0x6E, 1, 1, 0, 0, 0, "Algorithm Attributes Signature" }, + { 0x00C2, 0, 0x6E, 1, 1, 0, 0, 0, "Algorithm Attributes Decryption" }, + { 0x00C3, 0, 0x6E, 1, 1, 0, 0, 0, "Algorithm Attributes Authentication" }, + { 0x00C4, 0, 0x6E, 1, 0, 1, 1, 0, "CHV Status Bytes" }, + { 0x00C5, 0, 0x6E, 1, 0, 0, 0, 0, "Fingerprints" }, + { 0x00C6, 0, 0x6E, 1, 0, 0, 0, 0, "CA Fingerprints" }, + { 0x00CD, 0, 0x6E, 1, 0, 0, 0, 0, "Generation time" }, + { 0x007A, 1, 0, 1, 0, 0, 0, 0, "Security Support Template" }, + { 0x0093, 0, 0x7A, 1, 1, 0, 0, 0, "Digital Signature Counter" }, + { 0x0101, 0, 0, 0, 0, 0, 0, 0, "Private DO 1"}, + { 0x0102, 0, 0, 0, 0, 0, 0, 0, "Private DO 2"}, + { 0x0103, 0, 0, 0, 0, 0, 0, 0, "Private DO 3"}, + { 0x0104, 0, 0, 0, 0, 0, 0, 0, "Private DO 4"}, + { 0x7F21, 1, 0, 1, 0, 0, 0, 1, "Cardholder certificate"}, { 0 } }; @@ -244,17 +246,19 @@ /* Wrapper around iso7816_get_data which first tries to get the data from the cache. With GET_IMMEDIATE passed as true, the cache is - bypassed. */ + bypassed. With TRY_EXTLEN extended lengths APDUs are use if + supported by the card. */ static gpg_error_t get_cached_data (app_t app, int tag, unsigned char **result, size_t *resultlen, - int get_immediate) + int get_immediate, int try_extlen) { gpg_error_t err; int i; unsigned char *p; size_t len; struct cache_s *c; + int exmode; *result = NULL; *resultlen = 0; @@ -279,7 +283,12 @@ } } - err = iso7816_get_data (app->slot, tag, &p, &len); + if (try_extlen && app->app_local->cardcap.ext_lc_le) + exmode = app->app_local->extcap.max_rsp_data; + else + exmode = 0; + + err = iso7816_get_data (app->slot, exmode, tag, &p, &len); if (err) return err; *result = p; @@ -392,6 +401,7 @@ unsigned char *value; size_t valuelen; int dummyrc; + int exmode; if (!r_rc) r_rc = &dummyrc; @@ -404,7 +414,11 @@ if (app->card_version > 0x0100 && data_objects[i].get_immediate_in_v11) { - rc = iso7816_get_data (app->slot, tag, &buffer, &buflen); + if (data_objects[i].try_extlen && app->app_local->cardcap.ext_lc_le) + exmode = app->app_local->extcap.max_rsp_data; + else + exmode = 0; + rc = iso7816_get_data (app->slot, exmode, tag, &buffer, &buflen); if (rc) { *r_rc = rc; @@ -422,7 +436,8 @@ rc = get_cached_data (app, data_objects[i].get_from, &buffer, &buflen, (data_objects[i].dont_cache - || data_objects[i].get_immediate_in_v11)); + || data_objects[i].get_immediate_in_v11), + data_objects[i].try_extlen); if (!rc) { const unsigned char *s; @@ -445,7 +460,8 @@ { rc = get_cached_data (app, tag, &buffer, &buflen, (data_objects[i].dont_cache - || data_objects[i].get_immediate_in_v11)); + || data_objects[i].get_immediate_in_v11), + data_objects[i].try_extlen); if (!rc) { value = buffer; @@ -476,7 +492,9 @@ if (data_objects[i].get_from) continue; - rc = iso7816_get_data (slot, data_objects[i].tag, &buffer, &buflen); + /* We don't try extended length APDU because such large DO would + be pretty useless in a log file. */ + rc = iso7816_get_data (slot, 0, data_objects[i].tag, &buffer, &buflen); if (gpg_err_code (rc) == GPG_ERR_NO_OBJ) ; else if (rc) @@ -621,13 +639,14 @@ /* Note, that FPR must be at least 20 bytes. */ static gpg_error_t -store_fpr (int slot, int keynumber, u32 timestamp, +store_fpr (app_t app, int keynumber, u32 timestamp, const unsigned char *m, size_t mlen, const unsigned char *e, size_t elen, unsigned char *fpr, unsigned int card_version) { unsigned int n, nbits; unsigned char *buffer, *p; + int tag, tag2; int rc; for (; mlen && !*m; mlen--, m++) /* strip leading zeroes */ @@ -662,9 +681,12 @@ xfree (buffer); - rc = iso7816_put_data (slot, 0, - (card_version > 0x0007? 0xC7 : 0xC6) - + keynumber, fpr, 20); + tag = (card_version > 0x0007? 0xC7 : 0xC6) + keynumber; + flush_cache_item (app, tag); + tag2 = 0xCE + keynumber; + flush_cache_item (app, tag2); + + rc = iso7816_put_data (app->slot, 0, tag, fpr, 20); if (rc) log_error (_("failed to store the fingerprint: %s\n"),gpg_strerror (rc)); @@ -677,7 +699,7 @@ buf[2] = timestamp >> 8; buf[3] = timestamp; - rc = iso7816_put_data (slot, 0, 0xCE + keynumber, buf, 4); + rc = iso7816_put_data (app->slot, 0, tag2, buf, 4); if (rc) log_error (_("failed to store the creation date: %s\n"), gpg_strerror (rc)); @@ -2131,7 +2153,7 @@ assert (keyidx >=0 && keyidx <= 2); - if (iso7816_get_data (app->slot, 0x006E, &buffer, &buflen)) + if (iso7816_get_data (app->slot, 0, 0x006E, &buffer, &buflen)) { log_error (_("error reading application data\n")); return gpg_error (GPG_ERR_GENERAL); @@ -2623,7 +2645,7 @@ goto leave; } - err = store_fpr (app->slot, keyno, created_at, + err = store_fpr (app, keyno, created_at, rsa_n, rsa_n_len, rsa_e, rsa_e_len, fprbuf, app->card_version); if (err) @@ -2757,7 +2779,7 @@ send_status_info (ctrl, "KEY-CREATED-AT", numbuf, (size_t)strlen(numbuf), NULL, 0); - rc = store_fpr (app->slot, keyno, (u32)created_at, + rc = store_fpr (app, keyno, (u32)created_at, m, mlen, e, elen, fprbuf, app->card_version); if (rc) goto leave; @@ -2811,7 +2833,7 @@ assert (keyno >= 1 && keyno <= 3); - rc = get_cached_data (app, 0x006E, &buffer, &buflen, 0); + rc = get_cached_data (app, 0x006E, &buffer, &buflen, 0, 0); if (rc) { log_error (_("error reading application data\n")); @@ -3502,7 +3524,7 @@ replace a possibly already set one from a EF.GDO with this one. Note, that for current OpenPGP cards, no EF.GDO exists and thus it won't matter at all. */ - rc = iso7816_get_data (slot, 0x004F, &buffer, &buflen); + rc = iso7816_get_data (slot, 0, 0x004F, &buffer, &buflen); if (rc) goto leave; if (opt.verbose) Modified: trunk/scd/iso7816.c =================================================================== --- trunk/scd/iso7816.c 2009-06-09 23:07:48 UTC (rev 5042) +++ trunk/scd/iso7816.c 2009-06-17 09:45:50 UTC (rev 5043) @@ -420,19 +420,27 @@ a newly allocated buffer at the address passed by RESULT. Return the length of this data at the address of RESULTLEN. */ gpg_error_t -iso7816_get_data (int slot, int tag, +iso7816_get_data (int slot, int extended_mode, int tag, unsigned char **result, size_t *resultlen) { int sw; + int le; if (!result || !resultlen) return gpg_error (GPG_ERR_INV_VALUE); *result = NULL; *resultlen = 0; - sw = apdu_send (slot, 0, 0x00, CMD_GET_DATA, - ((tag >> 8) & 0xff), (tag & 0xff), -1, NULL, - result, resultlen); + if (extended_mode > 0 && extended_mode < 256) + le = 65534; /* Not 65535 in case it is used as some special flag. */ + else if (extended_mode > 0) + le = extended_mode; + else + le = 256; + + sw = apdu_send_le (slot, extended_mode, 0x00, CMD_GET_DATA, + ((tag >> 8) & 0xff), (tag & 0xff), -1, NULL, le, + result, resultlen); if (sw != SW_SUCCESS) { /* Make sure that pending buffers are released. */ Modified: trunk/scd/iso7816.h =================================================================== --- trunk/scd/iso7816.h 2009-06-09 23:07:48 UTC (rev 5042) +++ trunk/scd/iso7816.h 2009-06-17 09:45:50 UTC (rev 5043) @@ -84,7 +84,7 @@ gpg_error_t iso7816_reset_retry_counter_with_rc (int slot, int chvno, const char *data, size_t datalen); -gpg_error_t iso7816_get_data (int slot, int tag, +gpg_error_t iso7816_get_data (int slot, int extended_mode, int tag, unsigned char **result, size_t *resultlen); gpg_error_t iso7816_put_data (int slot, int extended_mode, int tag, const unsigned char *data, size_t datalen); From cvs at cvs.gnupg.org Wed Jun 17 12:19:50 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 17 Jun 2009 12:19:50 +0200 Subject: [svn] GnuPG - r5044 - trunk/agent Message-ID: Author: wk Date: 2009-06-17 12:19:50 +0200 (Wed, 17 Jun 2009) New Revision: 5044 Modified: trunk/agent/ChangeLog trunk/agent/agent.h trunk/agent/call-pinentry.c trunk/agent/command.c trunk/agent/divert-scd.c trunk/agent/findkey.c trunk/agent/genkey.c trunk/agent/trustlist.c Log: Use cancel button in confirmation only if requested. Modified: trunk/agent/ChangeLog =================================================================== --- trunk/agent/ChangeLog 2009-06-17 09:45:50 UTC (rev 5043) +++ trunk/agent/ChangeLog 2009-06-17 10:19:50 UTC (rev 5044) @@ -1,3 +1,9 @@ +2009-06-17 Werner Koch + + * call-pinentry.c (agent_get_confirmation): Add arg WITH_CANCEL. + Change all callers. + * trustlist.c (agent_marktrusted): Use WITH_CANCEL + 2009-06-09 Werner Koch * learncard.c (send_cert_back): Ignore certain error codes. Modified: trunk/agent/agent.h =================================================================== --- trunk/agent/agent.h 2009-06-17 09:45:50 UTC (rev 5043) +++ trunk/agent/agent.h 2009-06-17 10:19:50 UTC (rev 5044) @@ -256,7 +256,7 @@ const char *desc, const char *prompt, const char *errtext, int with_qualitybar); int agent_get_confirmation (ctrl_t ctrl, const char *desc, const char *ok, - const char *cancel); + const char *notokay, int with_cancel); int agent_show_message (ctrl_t ctrl, const char *desc, const char *ok_btn); int agent_popup_message_start (ctrl_t ctrl, const char *desc, const char *ok_btn); Modified: trunk/agent/call-pinentry.c =================================================================== --- trunk/agent/call-pinentry.c 2009-06-17 09:45:50 UTC (rev 5043) +++ trunk/agent/call-pinentry.c 2009-06-17 10:19:50 UTC (rev 5044) @@ -850,10 +850,14 @@ /* Pop up the PIN-entry, display the text and the prompt and ask the user to confirm this. We return 0 for success, ie. the user confirmed it, GPG_ERR_NOT_CONFIRMED for what the text says or an - other error. */ + other error. If WITH_CANCEL it true an extra cancel button is + displayed to allow the user to easily return a GPG_ERR_CANCELED. + if the Pinentry does not support this, the user can still cancel by + closing the Pinentry window. */ int agent_get_confirmation (ctrl_t ctrl, - const char *desc, const char *ok, const char *cancel) + const char *desc, const char *ok, + const char *notok, int with_cancel) { int rc; char line[ASSUAN_LINELENGTH]; @@ -881,26 +885,39 @@ { snprintf (line, DIM(line)-1, "SETOK %s", ok); line[DIM(line)-1] = 0; - rc = assuan_transact (entry_ctx, line, NULL, NULL, NULL, NULL, NULL, NULL); + rc = assuan_transact (entry_ctx, + line, NULL, NULL, NULL, NULL, NULL, NULL); if (rc) return unlock_pinentry (rc); } - if (cancel) + if (notok) { - snprintf (line, DIM(line)-1, "SETNOTOK %s", cancel); - line[DIM(line)-1] = 0; - rc = assuan_transact (entry_ctx, line, NULL, NULL, NULL, NULL, NULL, NULL); + /* Try to use the newer NOTOK feature if a cancel button is + requested. If no cacnel button is requested we keep on using + the standard cancel. */ + if (with_cancel) + { + snprintf (line, DIM(line)-1, "SETNOTOK %s", notok); + line[DIM(line)-1] = 0; + rc = assuan_transact (entry_ctx, + line, NULL, NULL, NULL, NULL, NULL, NULL); + } + else + rc = GPG_ERR_ASS_UNKNOWN_CMD; + if (gpg_err_code (rc) == GPG_ERR_ASS_UNKNOWN_CMD) { - snprintf (line, DIM(line)-1, "SETCANCEL %s", cancel); + snprintf (line, DIM(line)-1, "SETCANCEL %s", notok); line[DIM(line)-1] = 0; - rc = assuan_transact (entry_ctx, line, NULL, NULL, NULL, NULL, NULL, NULL); + rc = assuan_transact (entry_ctx, line, + NULL, NULL, NULL, NULL, NULL, NULL); } if (rc) return unlock_pinentry (rc); } - rc = assuan_transact (entry_ctx, "CONFIRM", NULL, NULL, NULL, NULL, NULL, NULL); + rc = assuan_transact (entry_ctx, "CONFIRM", + NULL, NULL, NULL, NULL, NULL, NULL); if (rc && gpg_err_source (rc) && gpg_err_code (rc) == GPG_ERR_ASS_CANCELED) rc = gpg_err_make (gpg_err_source (rc), GPG_ERR_CANCELED); Modified: trunk/agent/command.c =================================================================== --- trunk/agent/command.c 2009-06-17 09:45:50 UTC (rev 5043) +++ trunk/agent/command.c 2009-06-17 10:19:50 UTC (rev 5044) @@ -1229,7 +1229,7 @@ if (desc) plus_to_blank (desc); - rc = agent_get_confirmation (ctrl, desc, NULL, NULL); + rc = agent_get_confirmation (ctrl, desc, NULL, NULL, 0); if (rc) log_error ("command get_confirmation failed: %s\n", gpg_strerror (rc)); return rc; Modified: trunk/agent/divert-scd.c =================================================================== --- trunk/agent/divert-scd.c 2009-06-17 09:45:50 UTC (rev 5043) +++ trunk/agent/divert-scd.c 2009-06-17 10:19:50 UTC (rev 5044) @@ -97,7 +97,7 @@ } else { - rc = agent_get_confirmation (ctrl, desc, NULL, NULL); + rc = agent_get_confirmation (ctrl, desc, NULL, NULL, 0); xfree (desc); } } Modified: trunk/agent/findkey.c =================================================================== --- trunk/agent/findkey.c 2009-06-17 09:45:50 UTC (rev 5043) +++ trunk/agent/findkey.c 2009-06-17 10:19:50 UTC (rev 5044) @@ -183,7 +183,7 @@ if (opt.enforce_passphrase_constraints) { err = agent_get_confirmation (arg->ctrl, desc, - _("Change passphrase"), NULL); + _("Change passphrase"), NULL, 0); if (!err) arg->change_required = 1; } @@ -191,7 +191,7 @@ { err = agent_get_confirmation (arg->ctrl, desc, _("Change passphrase"), - _("I'll change it later")); + _("I'll change it later"), 0); if (!err) arg->change_required = 1; else if (gpg_err_code (err) == GPG_ERR_CANCELED) Modified: trunk/agent/genkey.c =================================================================== --- trunk/agent/genkey.c 2009-06-17 09:45:50 UTC (rev 5043) +++ trunk/agent/genkey.c 2009-06-17 10:19:50 UTC (rev 5044) @@ -156,7 +156,7 @@ } else err = agent_get_confirmation (ctrl, desc, - anyway_btn, _("Enter new passphrase")); + anyway_btn, _("Enter new passphrase"), 0); return err; } Modified: trunk/agent/trustlist.c =================================================================== --- trunk/agent/trustlist.c 2009-06-17 09:45:50 UTC (rev 5043) +++ trunk/agent/trustlist.c 2009-06-17 10:19:50 UTC (rev 5044) @@ -616,7 +616,7 @@ xfree (nameformatted); return out_of_core (); } - err = agent_get_confirmation (ctrl, desc, _("Yes"), _("No")); + err = agent_get_confirmation (ctrl, desc, _("Yes"), _("No"), 1); xfree (desc); if (!err) yes_i_trust = 1; @@ -664,7 +664,7 @@ /* TRANSLATORS: "Correct" is the label of a button and intended to 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"), _("Wrong")); + err = agent_get_confirmation (ctrl, desc, _("Correct"), _("Wrong"), 1); xfree (desc); if (gpg_err_code (err) == GPG_ERR_NOT_CONFIRMED) yes_i_trust = 0; From cvs at cvs.gnupg.org Wed Jun 17 12:36:12 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 17 Jun 2009 12:36:12 +0200 Subject: [svn] GnuPG - r5045 - branches/STABLE-BRANCH-1-4/g10 Message-ID: Author: wk Date: 2009-06-17 12:36:12 +0200 (Wed, 17 Jun 2009) New Revision: 5045 Modified: branches/STABLE-BRANCH-1-4/g10/ChangeLog branches/STABLE-BRANCH-1-4/g10/parse-packet.c Log: Fix bug#1040. Modified: branches/STABLE-BRANCH-1-4/g10/ChangeLog =================================================================== --- branches/STABLE-BRANCH-1-4/g10/ChangeLog 2009-06-17 10:19:50 UTC (rev 5044) +++ branches/STABLE-BRANCH-1-4/g10/ChangeLog 2009-06-17 10:36:12 UTC (rev 5045) @@ -1,3 +1,8 @@ +2009-06-17 Werner Koch + + * parse-packet.c (parse): Use a casted -1 instead of a 32 bit + constant to check for a garbled package. Fixes bug#1040. + 2009-06-05 David Shaw * gpg.c (main): Remove Camellia restriction. Modified: branches/STABLE-BRANCH-1-4/g10/parse-packet.c =================================================================== --- branches/STABLE-BRANCH-1-4/g10/parse-packet.c 2009-06-17 10:19:50 UTC (rev 5044) +++ branches/STABLE-BRANCH-1-4/g10/parse-packet.c 2009-06-17 10:36:12 UTC (rev 5045) @@ -441,8 +441,8 @@ } } - if (pktlen == 0xffffffff) { - /* with a some probability this is caused by a problem in the + if (pktlen == (unsigned long)(-1)) { + /* With some probability this is caused by a problem in the * the uncompressing layer - in some error cases it just loops * and spits out 0xff bytes. */ log_error ("%s: garbled packet detected\n", iobuf_where(inp) ); From cvs at cvs.gnupg.org Wed Jun 17 12:51:56 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 17 Jun 2009 12:51:56 +0200 Subject: [svn] GnuPG - r5046 - branches/STABLE-BRANCH-1-4/po Message-ID: Author: wk Date: 2009-06-17 12:51:55 +0200 (Wed, 17 Jun 2009) New Revision: 5046 Modified: branches/STABLE-BRANCH-1-4/po/ChangeLog branches/STABLE-BRANCH-1-4/po/fr.po Log: Update Modified: branches/STABLE-BRANCH-1-4/po/ChangeLog =================================================================== --- branches/STABLE-BRANCH-1-4/po/ChangeLog 2009-06-17 10:36:12 UTC (rev 5045) +++ branches/STABLE-BRANCH-1-4/po/ChangeLog 2009-06-17 10:51:55 UTC (rev 5046) @@ -1,3 +1,7 @@ +2009-06-17 Ga?l Qu?ri (up) + + * fr.po: Updated. + 2009-06-02 Werner Koch * de.po: Applied a patch from Daniel Leidert to fix a bunch of Modified: branches/STABLE-BRANCH-1-4/po/fr.po [not shown] From cvs at cvs.gnupg.org Wed Jun 17 13:18:31 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 17 Jun 2009 13:18:31 +0200 Subject: [svn] GnuPG - r5047 - in trunk: . doc g10 po Message-ID: Author: wk Date: 2009-06-17 13:18:26 +0200 (Wed, 17 Jun 2009) New Revision: 5047 Modified: trunk/NEWS trunk/configure.ac trunk/doc/help.txt trunk/g10/ChangeLog trunk/g10/parse-packet.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: Preparing for 2.0.12. Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2009-06-17 10:51:55 UTC (rev 5046) +++ trunk/g10/ChangeLog 2009-06-17 11:18:26 UTC (rev 5047) @@ -1,5 +1,8 @@ 2009-06-17 Werner Koch + * parse-packet.c (parse): Use a casted -1 instead of a 32 bit + constant to check for a garbled package. Fixes bug#1040. + * card-util.c (put_data_to_file, read_cert): New. (card_edit): Add command "readcert". (fetch_url): Allow code also for this gnupg major version 2. Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2009-06-17 10:51:55 UTC (rev 5046) +++ trunk/NEWS 2009-06-17 11:18:26 UTC (rev 5047) @@ -1,8 +1,6 @@ -Noteworthy changes in version 2.0.12 (not released) +Noteworthy changes in version 2.0.12 (2009-06-17) ------------------------------------------------- - This is a BETA version! - * GPGSM now always lists ephemeral certificates if specified by fingerprint or keygrip. @@ -10,10 +8,10 @@ information about smartcards. * Made sure not to leak file descriptors if running gpg-agent with a - command. Restores the signal mask to solve a problem in Mono. + command. Restore the signal mask to solve a problem in Mono. * Changed order of the confirmation questions for root certificates - and stores negative answers in trustlist.txt. + and store negative answers in trustlist.txt. * Better synchronization of concurrent smartcard sessions. Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2009-06-17 10:51:55 UTC (rev 5046) +++ trunk/configure.ac 2009-06-17 11:18:26 UTC (rev 5047) @@ -25,7 +25,7 @@ # 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], [2.0.12]) -m4_define([my_issvn], [yes]) +m4_define([my_issvn], [no]) m4_define([svn_revision], m4_esyscmd([printf "%d" $(svn info 2>/dev/null \ | sed -n '/^Revision:/ s/[^0-9]//gp'|head -1)])) Modified: trunk/doc/help.txt =================================================================== --- trunk/doc/help.txt 2009-06-17 10:51:55 UTC (rev 5046) +++ trunk/doc/help.txt 2009-06-17 11:18:26 UTC (rev 5047) @@ -168,6 +168,7 @@ .gpg.keygen.name Enter the name of the key holder. +The characters "<" and ">" are not allowed. Example: Heinrich Heine . @@ -179,6 +180,7 @@ .gpg.keygen.comment Please enter an optional comment. +The characters "(" and ")" are not allowed. In general there is no need for a comment. . Modified: trunk/g10/parse-packet.c =================================================================== --- trunk/g10/parse-packet.c 2009-06-17 10:51:55 UTC (rev 5046) +++ trunk/g10/parse-packet.c 2009-06-17 11:18:26 UTC (rev 5047) @@ -501,8 +501,8 @@ } } - if (pktlen == 0xffffffff) { - /* with a some probability this is caused by a problem in the + if (pktlen == (unsigned long)(-1)) { + /* With some probability this is caused by a problem in the * the uncompressing layer - in some error cases it just loops * and spits out 0xff bytes. */ log_error ("%s: garbled packet detected\n", iobuf_where(inp) ); 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 Wed Jun 17 13:51:07 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 17 Jun 2009 13:51:07 +0200 Subject: [svn] GnuPG - r5048 - tags Message-ID: Author: wk Date: 2009-06-17 13:51:06 +0200 (Wed, 17 Jun 2009) New Revision: 5048 Added: tags/gnupg-2.0.12/ Log: The 2.0.12 release. From cvs at cvs.gnupg.org Wed Jun 17 13:57:24 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 17 Jun 2009 13:57:24 +0200 Subject: [svn] GnuPG - r5049 - in trunk: . agent Message-ID: Author: wk Date: 2009-06-17 13:57:24 +0200 (Wed, 17 Jun 2009) New Revision: 5049 Modified: trunk/NEWS trunk/agent/gpg-agent.c trunk/configure.ac Log: Post release updates Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2009-06-17 11:51:06 UTC (rev 5048) +++ trunk/NEWS 2009-06-17 11:57:24 UTC (rev 5049) @@ -1,3 +1,11 @@ +Noteworthy changes in version 2.0.13 +------------------------------------------------- + + This is a BETA version! + + * + + Noteworthy changes in version 2.0.12 (2009-06-17) ------------------------------------------------- Modified: trunk/agent/gpg-agent.c =================================================================== --- trunk/agent/gpg-agent.c 2009-06-17 11:51:06 UTC (rev 5048) +++ trunk/agent/gpg-agent.c 2009-06-17 11:57:24 UTC (rev 5049) @@ -997,7 +997,7 @@ necessary but some programs falsely assume a cleared signal mask. */ if ( !pth_kill () ) - log_error ("pth_kill failed in foked process\n"); + log_error ("pth_kill failed in forked process\n"); #ifdef HAVE_SIGPROCMASK if (startup_signal_mask_valid) Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2009-06-17 11:51:06 UTC (rev 5048) +++ trunk/configure.ac 2009-06-17 11:57:24 UTC (rev 5049) @@ -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], [2.0.12]) -m4_define([my_issvn], [no]) +m4_define([my_version], [2.0.13]) +m4_define([my_issvn], [yes]) m4_define([svn_revision], m4_esyscmd([printf "%d" $(svn info 2>/dev/null \ | sed -n '/^Revision:/ s/[^0-9]//gp'|head -1)])) From cvs at cvs.gnupg.org Wed Jun 17 15:42:53 2009 From: cvs at cvs.gnupg.org (svn author marcus) Date: Wed, 17 Jun 2009 15:42:53 +0200 Subject: [svn] gpgme - r1379 - trunk/src Message-ID: Author: marcus Date: 2009-06-17 15:42:52 +0200 (Wed, 17 Jun 2009) New Revision: 1379 Modified: trunk/src/ChangeLog trunk/src/gpgme.c Log: 2009-06-16 Marcus Brinkmann * gpgme.c (gpgme_result_unref): Hot fix to release a lock. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2009-06-16 15:42:37 UTC (rev 1378) +++ trunk/src/ChangeLog 2009-06-17 13:42:52 UTC (rev 1379) @@ -1,5 +1,7 @@ 2009-06-16 Marcus Brinkmann + * gpgme.c (gpgme_result_unref): Hot fix to release a lock. + * gpgme.c (result_ref_lock): New global variable. (gpgme_result_ref, gpgme_result_unref): use it. Modified: trunk/src/gpgme.c =================================================================== --- trunk/src/gpgme.c 2009-06-16 15:42:37 UTC (rev 1378) +++ trunk/src/gpgme.c 2009-06-17 13:42:52 UTC (rev 1379) @@ -211,6 +211,7 @@ UNLOCK (result_ref_lock); return; } + UNLOCK (result_ref_lock); if (data->cleanup) (*data->cleanup) (data->hook); From cvs at cvs.gnupg.org Wed Jun 17 16:23:25 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 17 Jun 2009 16:23:25 +0200 Subject: [svn] dirmngr - r314 - in trunk: . po Message-ID: Author: wk Date: 2009-06-17 16:23:25 +0200 (Wed, 17 Jun 2009) New Revision: 314 Modified: trunk/ChangeLog trunk/NEWS trunk/README trunk/configure.ac trunk/po/de.po trunk/po/dirmngr.pot Log: Prepare 1.0.3. Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-05-26 15:12:55 UTC (rev 313) +++ trunk/ChangeLog 2009-06-17 14:23:25 UTC (rev 314) @@ -1,3 +1,7 @@ +2009-06-17 Werner Koch + + Released 1.0.3. + 2008-10-29 Marcus Brinkmann * tests/asschk.c (interpreter): Add missing initializer to silence Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2009-05-26 15:12:55 UTC (rev 313) +++ trunk/NEWS 2009-06-17 14:23:25 UTC (rev 314) @@ -1,4 +1,4 @@ -Noteworthy changes in version 1.0.3 +Noteworthy changes in version 1.0.3 (2009-06-17) ------------------------------------------------ * Client based trust anchors are now supported. Modified: trunk/README =================================================================== --- trunk/README 2009-05-26 15:12:55 UTC (rev 313) +++ trunk/README 2009-06-17 14:23:25 UTC (rev 314) @@ -1,7 +1,7 @@ DirMngr - X.509 Directory Manager ------------------------------------- - Version 1.0.2 + Version 1.0.3 Intro Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2009-05-26 15:12:55 UTC (rev 313) +++ trunk/configure.ac 2009-06-17 14:23:25 UTC (rev 314) @@ -1,6 +1,7 @@ # configure.ac - for DirMngr # Copyright (C) 2002 Klar?lvdalens Datakonsult AB -# Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 g10 Code GmbH +# Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, +# 2009 g10 Code GmbH # # This file is part of DirMngr. # @@ -27,7 +28,7 @@ # 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.3]) -m4_define([my_issvn], [yes]) +m4_define([my_issvn], [no]) m4_define([svn_revision], m4_esyscmd([echo -n $( (svn info 2>/dev/null \ || echo 'Revision: 0')|sed -n '/^Revision:/ {s/[^0-9]//gp;q;}')])) @@ -46,7 +47,7 @@ NEED_KSBA_API=1 NEED_KSBA_VERSION=1.0.2 -COPYRIGHT_YEAR_NAME="2008 g10 Code GmbH" +COPYRIGHT_YEAR_NAME="2009 g10 Code GmbH" PACKAGE=$PACKAGE_NAME VERSION=$PACKAGE_VERSION Modified: trunk/po/de.po [not shown] Modified: trunk/po/dirmngr.pot =================================================================== --- trunk/po/dirmngr.pot 2009-05-26 15:12:55 UTC (rev 313) +++ trunk/po/dirmngr.pot 2009-06-17 14:23:25 UTC (rev 314) @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: gpa-dev at gnupg.org\n" -"POT-Creation-Date: 2008-10-21 16:03+0200\n" +"POT-Creation-Date: 2009-06-17 15:10+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -51,7 +51,7 @@ msgid "can't access directory `%s': %s\n" msgstr "" -#: src/certcache.c:390 src/crlcache.c:2366 src/dirmngr.c:1433 +#: src/certcache.c:390 src/crlcache.c:2367 src/dirmngr.c:1433 #, c-format msgid "can't open `%s': %s\n" msgstr "" @@ -582,52 +582,47 @@ msgid " ERROR: This cached CRL may has been tampered with!\n" msgstr "" -#: src/crlcache.c:2277 +#: src/crlcache.c:2278 msgid " WARNING: invalid cache record length\n" msgstr "" -#: src/crlcache.c:2284 +#: src/crlcache.c:2285 #, c-format msgid "problem reading cache record: %s\n" msgstr "" -#: src/crlcache.c:2295 +#: src/crlcache.c:2296 #, c-format msgid "problem reading cache key: %s\n" msgstr "" -#: src/crlcache.c:2326 +#: src/crlcache.c:2327 #, c-format msgid "error reading cache entry from db: %s\n" msgstr "" -#: src/crlcache.c:2329 +#: src/crlcache.c:2330 #, c-format msgid "End CRL dump\n" msgstr "" -#: src/crlcache.c:2375 src/crlfetch.c:213 src/ldap.c:656 +#: src/crlcache.c:2376 src/crlfetch.c:213 src/ldap.c:656 #, c-format msgid "error initializing reader object: %s\n" msgstr "" -#: src/crlcache.c:2456 +#: src/crlcache.c:2457 #, c-format msgid "crl_fetch via DP failed: %s\n" msgstr "" -#: src/crlcache.c:2467 +#: src/crlcache.c:2468 #, c-format msgid "crl_cache_insert via DP failed: %s\n" msgstr "" -#: src/crlcache.c:2517 +#: src/crlcache.c:2528 #, c-format -msgid "crl_fetch via issuer failed: %s\n" -msgstr "" - -#: src/crlcache.c:2527 -#, c-format msgid "crl_cache_insert via issuer failed: %s\n" msgstr "" @@ -1100,17 +1095,12 @@ msgid "error allocating memory: %s\n" msgstr "" -#: src/ldap.c:669 +#: src/ldap.c:1189 #, c-format -msgid "ldap wrapper %d started\n" -msgstr "" - -#: src/ldap.c:1188 -#, c-format msgid "start_cert_fetch: invalid pattern `%s'\n" msgstr "" -#: src/ldap.c:1394 +#: src/ldap.c:1395 msgid "ldap_search hit the size limit of the server\n" msgstr "" @@ -1301,80 +1291,80 @@ msgid "OCSP responder returned an too old status\n" msgstr "" -#: src/server.c:174 src/server.c:286 src/server.c:332 +#: src/server.c:200 src/server.c:312 src/server.c:358 #, c-format msgid "assuan_inquire(%s) failed: %s\n" msgstr "" -#: src/server.c:425 +#: src/server.c:451 msgid "ldapserver missing" msgstr "" -#: src/server.c:496 +#: src/server.c:522 msgid "serialno missing in cert ID" msgstr "" -#: src/server.c:549 src/server.c:663 src/server.c:748 src/server.c:1043 -#: src/server.c:1071 src/server.c:1097 src/server.c:1150 src/server.c:1219 +#: src/server.c:575 src/server.c:689 src/server.c:774 src/server.c:1069 +#: src/server.c:1097 src/server.c:1123 src/server.c:1176 src/server.c:1245 #, c-format msgid "command %s failed: %s\n" msgstr "" -#: src/server.c:634 src/server.c:722 src/server.c:1130 src/server.c:1183 +#: src/server.c:660 src/server.c:748 src/server.c:1156 src/server.c:1209 #, c-format msgid "assuan_inquire failed: %s\n" msgstr "" -#: src/server.c:767 +#: src/server.c:793 #, c-format msgid "fetch_cert_by_url failed: %s\n" msgstr "" -#: src/server.c:779 src/server.c:810 src/server.c:966 +#: src/server.c:805 src/server.c:836 src/server.c:992 #, c-format msgid "error sending data: %s\n" msgstr "" -#: src/server.c:914 +#: src/server.c:940 #, c-format msgid "start_cert_fetch failed: %s\n" msgstr "" -#: src/server.c:947 +#: src/server.c:973 #, c-format msgid "fetch_next_cert failed: %s\n" msgstr "" -#: src/server.c:974 +#: src/server.c:1000 #, c-format msgid "max_replies %d exceeded\n" msgstr "" -#: src/server.c:1093 +#: src/server.c:1119 msgid "no data stream" msgstr "" -#: src/server.c:1285 +#: src/server.c:1311 #, c-format msgid "can't allocate control structure: %s\n" msgstr "" -#: src/server.c:1308 +#: src/server.c:1334 #, c-format msgid "failed to initialize the server: %s\n" msgstr "" -#: src/server.c:1316 +#: src/server.c:1342 #, c-format msgid "failed to the register commands with Assuan: %s\n" msgstr "" -#: src/server.c:1359 +#: src/server.c:1385 #, c-format msgid "Assuan accept problem: %s\n" msgstr "" -#: src/server.c:1379 +#: src/server.c:1405 #, c-format msgid "Assuan processing failed: %s\n" msgstr "" @@ -1735,8 +1725,8 @@ msgid "scanning result for attribute `%s'\n" msgstr "" -#: src/dirmngr_ldap.c:335 src/dirmngr_ldap.c:406 src/dirmngr_ldap.c:430 -#: src/dirmngr_ldap.c:445 src/dirmngr_ldap.c:468 src/dirmngr_ldap.c:584 +#: src/dirmngr_ldap.c:335 src/dirmngr_ldap.c:413 src/dirmngr_ldap.c:437 +#: src/dirmngr_ldap.c:452 src/dirmngr_ldap.c:475 src/dirmngr_ldap.c:594 #, c-format msgid "error writing to stdout: %s\n" msgstr "" @@ -1751,86 +1741,86 @@ msgid "attribute `%s' not found\n" msgstr "" -#: src/dirmngr_ldap.c:391 +#: src/dirmngr_ldap.c:392 #, c-format msgid "found attribute `%s'\n" msgstr "" -#: src/dirmngr_ldap.c:519 +#: src/dirmngr_ldap.c:529 #, c-format msgid "processing url `%s'\n" msgstr "" -#: src/dirmngr_ldap.c:521 +#: src/dirmngr_ldap.c:531 #, c-format msgid " user `%s'\n" msgstr "" -#: src/dirmngr_ldap.c:523 +#: src/dirmngr_ldap.c:533 #, c-format msgid " pass `%s'\n" msgstr "" -#: src/dirmngr_ldap.c:525 +#: src/dirmngr_ldap.c:535 #, c-format msgid " host `%s'\n" msgstr "" -#: src/dirmngr_ldap.c:526 +#: src/dirmngr_ldap.c:536 #, c-format msgid " port %d\n" msgstr "" -#: src/dirmngr_ldap.c:528 +#: src/dirmngr_ldap.c:538 #, c-format msgid " DN `%s'\n" msgstr "" -#: src/dirmngr_ldap.c:530 +#: src/dirmngr_ldap.c:540 #, c-format msgid " filter `%s'\n" msgstr "" -#: src/dirmngr_ldap.c:535 src/dirmngr_ldap.c:538 +#: src/dirmngr_ldap.c:545 src/dirmngr_ldap.c:548 #, c-format msgid " attr `%s'\n" msgstr "" -#: src/dirmngr_ldap.c:544 +#: src/dirmngr_ldap.c:554 #, c-format msgid "no host name in `%s'\n" msgstr "" -#: src/dirmngr_ldap.c:549 +#: src/dirmngr_ldap.c:559 #, c-format msgid "no attribute given for query `%s'\n" msgstr "" -#: src/dirmngr_ldap.c:555 +#: src/dirmngr_ldap.c:565 msgid "WARNING: using first attribute only\n" msgstr "" -#: src/dirmngr_ldap.c:562 +#: src/dirmngr_ldap.c:572 #, c-format msgid "LDAP init to `%s:%d' failed: %s\n" msgstr "" -#: src/dirmngr_ldap.c:568 +#: src/dirmngr_ldap.c:578 #, c-format msgid "binding to `%s:%d' failed: %s\n" msgstr "" -#: src/dirmngr_ldap.c:591 +#: src/dirmngr_ldap.c:601 #, c-format msgid "searching `%s' failed: %s\n" msgstr "" -#: src/dirmngr_ldap.c:622 +#: src/dirmngr_ldap.c:632 #, c-format msgid "`%s' is not an LDAP URL\n" msgstr "" -#: src/dirmngr_ldap.c:628 +#: src/dirmngr_ldap.c:638 #, c-format msgid "`%s' is an invalid LDAP URL\n" msgstr "" From cvs at cvs.gnupg.org Wed Jun 17 16:37:31 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 17 Jun 2009 16:37:31 +0200 Subject: [svn] dirmngr - r315 - tags Message-ID: Author: wk Date: 2009-06-17 16:37:31 +0200 (Wed, 17 Jun 2009) New Revision: 315 Added: tags/dirmngr-1.0.3/ Log: Released 1.0.3 From cvs at cvs.gnupg.org Wed Jun 17 16:52:40 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 17 Jun 2009 16:52:40 +0200 Subject: [svn] dirmngr - r316 - trunk Message-ID: Author: wk Date: 2009-06-17 16:52:40 +0200 (Wed, 17 Jun 2009) New Revision: 316 Added: trunk/announce.txt Modified: trunk/NEWS trunk/configure.ac Log: Post release updates. Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2009-06-17 14:37:31 UTC (rev 315) +++ trunk/NEWS 2009-06-17 14:52:40 UTC (rev 316) @@ -1,3 +1,7 @@ +Noteworthy changes in version 1.0.4 +------------------------------------------------ + + Noteworthy changes in version 1.0.3 (2009-06-17) ------------------------------------------------ Added: trunk/announce.txt =================================================================== --- trunk/announce.txt (rev 0) +++ trunk/announce.txt 2009-06-17 14:52:40 UTC (rev 316) @@ -0,0 +1,84 @@ +To: gnupg-announce at gnupg.org +Mail-Followup-To: gnupg-users at gnupg.org + +Hi! + +We are pleased to announce the availability of Dirmngr version 1.0.3. + +Dirmngr is a server for managing and downloading certificate +revocation lists (CRLs) for X.509 certificates and for downloading the +certificates themselves. Dirmngr also handles OCSP requests as an +alternative to CRLs. Although Dirmngr can be invoked on demand, it +should in general be installed as a system daemon. + +Get it from: + + ftp://ftp.gnupg.org/gcrypt/dirmngr/dirmngr-1.0.3.tar.bz2 (542k) + ftp://ftp.gnupg.org/gcrypt/dirmngr/dirmngr-1.0.3.tar.bz2.sig + +or as a patch against the last beta version: + + ftp://ftp.gnupg.org/gcrypt/dirmngr/dirmngr-1.0.2-1.0.3.diff.bz2 (25k) + + +SHA-1 checksums are: + +437d381c937b1f1d0699d1ed37cf50f14bfbcd32 dirmngr-1.0.3.tar.bz2 +e139db6205145066b6bb13686121d07f241bacb4 dirmngr-1.0.2-1.0.3.diff.bz2 + + + +Whats new in this release +========================= + + * Client based trust anchors are now supported. + + * Configured certificates with the suffix ".der" are now also used. + + * Libgcrypt 1.4 is now required. + + +Documentation +============= + +Dirmngr comes with man pages and as well as with a texinfo based +manual. Run "info dirmngr" to read the manual or run + + make -C doc dirmngr.pdf + +to build a printable version. If you have questions on the use of +Dirmngr, feel free to ask at gnupg-users at gnupg.org. + + +Support +======= + +Improving Dirmngr is costly, but you can help! We are looking for +organizations that find Dirmngr useful and wish to contribute back. +You can contribute by reporting bugs, improve the software, or by +donating money. + +Commercial support contracts for Dirmngr are available, and they help +finance continued maintenance. g10 Code GmbH, a Duesseldorf based +company owned and headed by GnuPG's principal author, is currently +funding Dirmngr development. We are always looking for interesting +development projects. + +A service directory is available at: + + http://www.gnupg.org/service.html + + +Thanks +====== + +We have to thank all the people who helped with this release. The +folks at Intevation helped a lot to track down bugs and to define new +features. Marcus Brinkmann is mainly responsible for completing the +Windows port. + + + +Happy Hacking, + + Werner Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2009-06-17 14:37:31 UTC (rev 315) +++ trunk/configure.ac 2009-06-17 14:52:40 UTC (rev 316) @@ -27,8 +27,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.3]) -m4_define([my_issvn], [no]) +m4_define([my_version], [1.0.4]) +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;}')])) From cvs at cvs.gnupg.org Wed Jun 17 16:57:14 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 17 Jun 2009 16:57:14 +0200 Subject: [svn] dirmngr - r317 - in trunk: . jnlib src Message-ID: Author: wk Date: 2009-06-17 16:57:14 +0200 (Wed, 17 Jun 2009) New Revision: 317 Removed: trunk/jnlib/dotlock.c trunk/jnlib/dotlock.h Modified: trunk/announce.txt trunk/jnlib/ChangeLog trunk/jnlib/Makefile.am trunk/src/ChangeLog trunk/src/util.h Log: Remove unused code. Modified: trunk/jnlib/ChangeLog =================================================================== --- trunk/jnlib/ChangeLog 2009-06-17 14:52:40 UTC (rev 316) +++ trunk/jnlib/ChangeLog 2009-06-17 14:57:14 UTC (rev 317) @@ -1,3 +1,7 @@ +2009-06-17 Werner Koch + + * Makefile.am (libjnlib_a_SOURCES): Remove unused dotlock module. + 2008-10-30 Marcus Brinkmann * logging.c (set_file_fd): Add missing initializer to silence gcc Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2009-06-17 14:52:40 UTC (rev 316) +++ trunk/src/ChangeLog 2009-06-17 14:57:14 UTC (rev 317) @@ -1,3 +1,7 @@ +2009-06-17 Werner Koch + + * util.h: Remove unused dotlock.h. + 2009-05-26 Werner Koch * ldap.c (ldap_wrapper): Show reader object in diagnostics. Modified: trunk/announce.txt =================================================================== --- trunk/announce.txt 2009-06-17 14:52:40 UTC (rev 316) +++ trunk/announce.txt 2009-06-17 14:57:14 UTC (rev 317) @@ -16,7 +16,7 @@ ftp://ftp.gnupg.org/gcrypt/dirmngr/dirmngr-1.0.3.tar.bz2 (542k) ftp://ftp.gnupg.org/gcrypt/dirmngr/dirmngr-1.0.3.tar.bz2.sig -or as a patch against the last beta version: +or as a patch against the last version: ftp://ftp.gnupg.org/gcrypt/dirmngr/dirmngr-1.0.2-1.0.3.diff.bz2 (25k) Modified: trunk/jnlib/Makefile.am =================================================================== --- trunk/jnlib/Makefile.am 2009-06-17 14:52:40 UTC (rev 316) +++ trunk/jnlib/Makefile.am 2009-06-17 14:57:14 UTC (rev 317) @@ -36,7 +36,6 @@ utf8conv.c utf8conv.h \ argparse.c argparse.h \ logging.c logging.h \ - dotlock.c dotlock.h \ types.h mischelp.h dynload.h w32help.h if HAVE_W32_SYSTEM Deleted: trunk/jnlib/dotlock.c Deleted: trunk/jnlib/dotlock.h Modified: trunk/src/util.h =================================================================== --- trunk/src/util.h 2009-06-17 14:52:40 UTC (rev 316) +++ trunk/src/util.h 2009-06-17 14:57:14 UTC (rev 317) @@ -31,7 +31,6 @@ #include "../jnlib/stringhelp.h" #include "../jnlib/mischelp.h" #include "../jnlib/strlist.h" -#include "../jnlib/dotlock.h" /*-- b64enc.c and b64dec.c --*/ From cvs at cvs.gnupg.org Thu Jun 18 14:38:55 2009 From: cvs at cvs.gnupg.org (svn author marcus) Date: Thu, 18 Jun 2009 14:38:55 +0200 Subject: [svn] gpgme - r1380 - trunk/src Message-ID: Author: marcus Date: 2009-06-18 14:38:55 +0200 (Thu, 18 Jun 2009) New Revision: 1380 Modified: trunk/src/ChangeLog trunk/src/context.h trunk/src/gpgme.c trunk/src/op-support.c Log: 2009-06-18 Marcus Brinkmann * context.h (CTX_OP_DATA_MAGIC): New macro. (struct ctx_op_data): New member MAGIC. * op-support.c (_gpgme_op_data_lookup): Initialize magic. * gpgme.c (gpgme_result_unref, gpgme_result_ref): Check magic. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2009-06-17 13:42:52 UTC (rev 1379) +++ trunk/src/ChangeLog 2009-06-18 12:38:55 UTC (rev 1380) @@ -1,3 +1,10 @@ +2009-06-18 Marcus Brinkmann + + * context.h (CTX_OP_DATA_MAGIC): New macro. + (struct ctx_op_data): New member MAGIC. + * op-support.c (_gpgme_op_data_lookup): Initialize magic. + * gpgme.c (gpgme_result_unref, gpgme_result_ref): Check magic. + 2009-06-16 Marcus Brinkmann * gpgme.c (gpgme_result_unref): Hot fix to release a lock. Modified: trunk/src/context.h =================================================================== --- trunk/src/context.h 2009-06-17 13:42:52 UTC (rev 1379) +++ trunk/src/context.h 2009-06-18 12:38:55 UTC (rev 1380) @@ -42,8 +42,14 @@ } ctx_op_data_id_t; +/* "gpgmeres" in ASCII. */ +#define CTX_OP_DATA_MAGIC 0x736572656d677067ULL struct ctx_op_data { + /* A magic word just to make sure people don't deallocate something + that ain't a result structure. */ + unsigned long long magic; + /* The next element in the linked list, or NULL if this is the last element. Used by op data structures linked into a context. */ struct ctx_op_data *next; Modified: trunk/src/gpgme.c =================================================================== --- trunk/src/gpgme.c 2009-06-17 13:42:52 UTC (rev 1379) +++ trunk/src/gpgme.c 2009-06-18 12:38:55 UTC (rev 1380) @@ -189,6 +189,8 @@ data = result - sizeof (struct ctx_op_data); + assert (data->magic == CTX_OP_DATA_MAGIC); + LOCK (result_ref_lock); data->references++; UNLOCK (result_ref_lock); @@ -205,6 +207,8 @@ data = result - sizeof (struct ctx_op_data); + assert (data->magic == CTX_OP_DATA_MAGIC); + LOCK (result_ref_lock); if (--data->references) { Modified: trunk/src/op-support.c =================================================================== --- trunk/src/op-support.c 2009-06-17 13:42:52 UTC (rev 1379) +++ trunk/src/op-support.c 2009-06-18 12:38:55 UTC (rev 1380) @@ -48,6 +48,7 @@ data = calloc (1, sizeof (struct ctx_op_data) + size); if (!data) return gpg_error_from_errno (errno); + data->magic = CTX_OP_DATA_MAGIC; data->next = ctx->op_data; data->type = type; data->cleanup = cleanup; From cvs at cvs.gnupg.org Thu Jun 18 15:41:48 2009 From: cvs at cvs.gnupg.org (svn author marcus) Date: Thu, 18 Jun 2009 15:41:48 +0200 Subject: [svn] gpgme - r1381 - in trunk: . src Message-ID: Author: marcus Date: 2009-06-18 15:41:48 +0200 (Thu, 18 Jun 2009) New Revision: 1381 Modified: trunk/TODO trunk/src/ChangeLog trunk/src/gpgme.h.in trunk/src/w32-io.c Log: 2009-06-18 Marcus Brinkmann * gpgme.h.in (GPGME_CONF_PATHNAME): Remove obsolete macro. * w32-io.c (_gpgme_io_pipe): Allocate reader/writer thread right away. (_gpgme_io_read, _gpgme_io_write, _gpgme_io_select) (_gpgme_io_dup): Never allocate threads here. (find_writer, find_reader): Check return value of thread creation function. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2009-06-18 12:38:55 UTC (rev 1380) +++ trunk/src/ChangeLog 2009-06-18 13:41:48 UTC (rev 1381) @@ -1,5 +1,14 @@ 2009-06-18 Marcus Brinkmann + * gpgme.h.in (GPGME_CONF_PATHNAME): Remove obsolete macro. + + * w32-io.c (_gpgme_io_pipe): Allocate reader/writer thread right + away. + (_gpgme_io_read, _gpgme_io_write, _gpgme_io_select) + (_gpgme_io_dup): Never allocate threads here. + (find_writer, find_reader): Check return value of thread creation + function. + * context.h (CTX_OP_DATA_MAGIC): New macro. (struct ctx_op_data): New member MAGIC. * op-support.c (_gpgme_op_data_lookup): Initialize magic. Modified: trunk/TODO =================================================================== --- trunk/TODO 2009-06-18 12:38:55 UTC (rev 1380) +++ trunk/TODO 2009-06-18 13:41:48 UTC (rev 1381) @@ -8,24 +8,20 @@ we block reading the next line with assuan. * Before release: -** Figure out if _gpgme_io_pipe should pre-create reader/writer and if we - then can use !start_it in most invocations. Note that gpgme_io_dup - probably should always use !start_it, because currently it will - always create reader/writer if they don't exist(!?). ** Some gpg tests fail with gpg 1.3.4-cvs (gpg/t-keylist-sig) The test is currently disabled there and in gpg/t-import. ** When gpg supports it, write binary subpackets directly, and parse SUBPACKET status lines. -** A few months after 1.1.7: - Remove GPGME_CONF_PATHNAME macro. * ABI's to break: +** Implementation: Remove support for old style error codes in + conversion.c::_gpgme_map_gnupg_error. ** gpgme_edit_cb_t: Add "processed" return argument (see edit.c::command_handler). ** I/O and User Data could be made extensible. But this can be done without breaking the ABI hopefully. -** All enums that should be enums need to have a maximum value to ensure - a certain minimum width for extensibility. +** All enums should be replaced by ints and simple macros for + maximum compatibility. ** Compatibility interfaces that can be removed in future versions: *** gpgme_data_new_from_filepart *** gpgme_data_new_from_file @@ -109,7 +105,7 @@ the fds unregistered immediately - i think so?) Note that we need support in gpgsm to set include-certs to default as RESET does not reset it. -** Optimize the case where a data object has 0an underlying fd we can pass +** Optimize the case where a data object has an underlying fd we can pass directly to the engine. This will be automatic with socket I/O and descriptor passing. ** Move code common to all engines up from gpg to engine. Modified: trunk/src/gpgme.h.in =================================================================== --- trunk/src/gpgme.h.in 2009-06-18 12:38:55 UTC (rev 1380) +++ trunk/src/gpgme.h.in 2009-06-18 13:41:48 UTC (rev 1381) @@ -1793,9 +1793,6 @@ GPGME_CONF_ALIAS_LIST = 37 } gpgme_conf_type_t; -/* Macro for backward compatibility (even though it was undocumented - and marked as experimental in 1.1.6 - will be removed after 1.1.7): */ -#define GPGME_CONF_PATHNAME GPGME_CONF_FILENAME /* This represents a single argument for a configuration option. Modified: trunk/src/w32-io.c =================================================================== --- trunk/src/w32-io.c 2009-06-18 12:38:55 UTC (rev 1380) +++ trunk/src/w32-io.c 2009-06-18 13:41:48 UTC (rev 1381) @@ -389,9 +389,12 @@ if (i != reader_table_size) { rd = create_reader (fd_to_handle (fd)); - reader_table[i].fd = fd; - reader_table[i].context = rd; - reader_table[i].used = 1; + if (rd) + { + reader_table[i].fd = fd; + reader_table[i].context = rd; + reader_table[i].used = 1; + } } UNLOCK (reader_table_lock); @@ -692,9 +695,12 @@ if (i != writer_table_size) { wt = create_writer (fd_to_handle (fd)); - writer_table[i].fd = fd; - writer_table[i].context = wt; - writer_table[i].used = 1; + if (wt) + { + writer_table[i].fd = fd; + writer_table[i].context = wt; + writer_table[i].used = 1; + } } UNLOCK (writer_table_lock); @@ -733,7 +739,7 @@ if (count == 0) return TRACE_SYSRES (0); - ctx = find_writer (fd, 1); + ctx = find_writer (fd, 0); if (!ctx) return TRACE_SYSRES (-1); @@ -826,6 +832,7 @@ /* Make one end inheritable. */ if (inherit_idx == 0) { + struct writer_context_s *ctx; HANDLE hd; if (!DuplicateHandle (GetCurrentProcess(), rh, GetCurrentProcess(), &hd, 0, @@ -841,6 +848,18 @@ } CloseHandle (rh); rh = hd; + + ctx = find_writer (handle_to_fd (wh), 0); + assert (ctx == NULL); + ctx = find_writer (handle_to_fd (wh), 1); + if (!ctx) + { + CloseHandle (rh); + CloseHandle (wh); + /* FIXME: Should translate the error code. */ + errno = EIO; + return TRACE_SYSRES (-1); + } } else if (inherit_idx == 1) { @@ -859,6 +878,18 @@ } CloseHandle (wh); wh = hd; + + ctx = find_reader (handle_to_fd (rh), 0); + assert (ctx == NULL); + ctx = find_reader (handle_to_fd (rh), 1); + if (!ctx) + { + CloseHandle (rh); + CloseHandle (wh); + /* FIXME: Should translate the error code. */ + errno = EIO; + return TRACE_SYSRES (-1); + } } filedes[0] = handle_to_fd (rh); @@ -1248,7 +1279,7 @@ { if (fds[i].for_read) { - struct reader_context_s *ctx = find_reader (fds[i].fd,1); + struct reader_context_s *ctx = find_reader (fds[i].fd,0); if (!ctx) TRACE_LOG1 ("error: no reader for FD 0x%x (ignored)", @@ -1271,7 +1302,7 @@ } else if (fds[i].for_write) { - struct writer_context_s *ctx = find_writer (fds[i].fd,1); + struct writer_context_s *ctx = find_writer (fds[i].fd,0); if (!ctx) TRACE_LOG1 ("error: no writer for FD 0x%x (ignored)", @@ -1417,7 +1448,7 @@ return TRACE_SYSRES (-1); } - rd_ctx = find_reader (fd, 1); + rd_ctx = find_reader (fd, 0); if (rd_ctx) { /* No need for locking, as the only races are against the reader @@ -1436,7 +1467,7 @@ UNLOCK (reader_table_lock); } - wt_ctx = find_writer (fd, 1); + wt_ctx = find_writer (fd, 0); if (wt_ctx) { /* No need for locking, as the only races are against the writer From cvs at cvs.gnupg.org Thu Jun 18 18:51:56 2009 From: cvs at cvs.gnupg.org (svn author marcus) Date: Thu, 18 Jun 2009 18:51:56 +0200 Subject: [svn] gpgme - r1382 - trunk/src Message-ID: Author: marcus Date: 2009-06-18 18:51:56 +0200 (Thu, 18 Jun 2009) New Revision: 1382 Modified: trunk/src/ChangeLog trunk/src/gpgme.def trunk/src/w32-io.c Log: 2009-06-18 Marcus Brinkmann * gpgme.def: Fix stupid typo. * w32-io.c (_gpgme_io_pipe): Add missing declaration. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2009-06-18 13:41:48 UTC (rev 1381) +++ trunk/src/ChangeLog 2009-06-18 16:51:56 UTC (rev 1382) @@ -1,5 +1,8 @@ 2009-06-18 Marcus Brinkmann + * gpgme.def: Fix stupid typo. + * w32-io.c (_gpgme_io_pipe): Add missing declaration. + * gpgme.h.in (GPGME_CONF_PATHNAME): Remove obsolete macro. * w32-io.c (_gpgme_io_pipe): Allocate reader/writer thread right Modified: trunk/src/gpgme.def =================================================================== --- trunk/src/gpgme.def 2009-06-18 13:41:48 UTC (rev 1381) +++ trunk/src/gpgme.def 2009-06-18 16:51:56 UTC (rev 1382) @@ -177,8 +177,8 @@ gpgme_io_read @136 gpgme_io_write @137 - gpgme_release_ref @138 - gpgme_release_unref @139 + gpgme_result_ref @138 + gpgme_result_unref @139 gpgme_op_import_keys @140 gpgme_op_import_keys_start @141 Modified: trunk/src/w32-io.c =================================================================== --- trunk/src/w32-io.c 2009-06-18 13:41:48 UTC (rev 1381) +++ trunk/src/w32-io.c 2009-06-18 16:51:56 UTC (rev 1382) @@ -863,6 +863,7 @@ } else if (inherit_idx == 1) { + struct reader_context_s *ctx; HANDLE hd; if (!DuplicateHandle( GetCurrentProcess(), wh, GetCurrentProcess(), &hd, 0, From cvs at cvs.gnupg.org Thu Jun 18 19:04:13 2009 From: cvs at cvs.gnupg.org (svn author marcus) Date: Thu, 18 Jun 2009 19:04:13 +0200 Subject: [svn] gpgme - r1383 - trunk/src Message-ID: Author: marcus Date: 2009-06-18 19:04:12 +0200 (Thu, 18 Jun 2009) New Revision: 1383 Modified: trunk/src/ChangeLog trunk/src/gpgme.h.in Log: 2009-06-18 Marcus Brinkmann * gpgme.h.in (GPGME_CONF_PATHNAME): Revert last change, it's back! (GPA still uses it...). Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2009-06-18 16:51:56 UTC (rev 1382) +++ trunk/src/ChangeLog 2009-06-18 17:04:12 UTC (rev 1383) @@ -1,5 +1,8 @@ 2009-06-18 Marcus Brinkmann + * gpgme.h.in (GPGME_CONF_PATHNAME): Revert last change, it's + back! (GPA still uses it...). + * gpgme.def: Fix stupid typo. * w32-io.c (_gpgme_io_pipe): Add missing declaration. Modified: trunk/src/gpgme.h.in =================================================================== --- trunk/src/gpgme.h.in 2009-06-18 16:51:56 UTC (rev 1382) +++ trunk/src/gpgme.h.in 2009-06-18 17:04:12 UTC (rev 1383) @@ -1794,7 +1794,10 @@ } gpgme_conf_type_t; +/* For now, compatibility. */ +#define GPGME_CONF_PATHNAME GPGME_CONF_FILENAME + /* This represents a single argument for a configuration option. Which of the members of value is used depends on the ALT_TYPE. */ typedef struct gpgme_conf_arg From cvs at cvs.gnupg.org Thu Jun 18 19:16:47 2009 From: cvs at cvs.gnupg.org (svn author marcus) Date: Thu, 18 Jun 2009 19:16:47 +0200 Subject: [svn] gpgme - r1384 - trunk Message-ID: Author: marcus Date: 2009-06-18 19:16:47 +0200 (Thu, 18 Jun 2009) New Revision: 1384 Modified: trunk/ChangeLog trunk/NEWS trunk/configure.ac Log: 2009-06-18 Marcus Brinkmann * configure.ac (my_version): Set to 1.2.0. (LIBGPGME_LT_CURRENT, LIBGPGME_LT_AGE): Bump. (LIBGPGME_LT_REVISION): Reset. Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-06-18 17:04:12 UTC (rev 1383) +++ trunk/ChangeLog 2009-06-18 17:16:47 UTC (rev 1384) @@ -1,3 +1,9 @@ +2009-06-18 Marcus Brinkmann + + * configure.ac (my_version): Set to 1.2.0. + (LIBGPGME_LT_CURRENT, LIBGPGME_LT_AGE): Bump. + (LIBGPGME_LT_REVISION): Reset. + 2009-05-05 Marcus Brinkmann * configure.ac: Add infrastructure for compile time check of Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2009-06-18 17:04:12 UTC (rev 1383) +++ trunk/NEWS 2009-06-18 17:16:47 UTC (rev 1384) @@ -1,4 +1,4 @@ -Noteworthy changes in version 1.2.0 (unreleased) +Noteworthy changes in version 1.2.0 (2009-06-18) ------------------------------------------------ * New encryption flag GPGME_ENCRYPT_NO_ENCRYPT_TO to disable default Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2009-06-18 17:04:12 UTC (rev 1383) +++ trunk/configure.ac 2009-06-18 17:16:47 UTC (rev 1384) @@ -31,8 +31,8 @@ # specific feature can already be done under the assumption that the # SVN version is the most recent one in a branch. To disable the SVN # version for the real release, set the my_issvn macro to no. -m4_define(my_version, [1.1.9]) -m4_define(my_issvn, [yes]) +m4_define(my_version, [1.2.0]) +m4_define(my_issvn, [no]) m4_define([svn_revision], m4_esyscmd([echo -n $( (svn info 2>/dev/null \ || echo 'Revision: 0')|sed -n '/^Revision:/ {s/[^0-9]//gp;q;}')])) @@ -47,11 +47,11 @@ # (Interfaces added: AGE++) # (Interfaces removed/changed: AGE=0) # -LIBGPGME_LT_CURRENT=17 +LIBGPGME_LT_CURRENT=18 # Subtract 2 from this value if you want to make the LFS transition an # ABI break. [Note to self: Remove this comment with the next regular break.] -LIBGPGME_LT_AGE=6 -LIBGPGME_LT_REVISION=6 +LIBGPGME_LT_AGE=7 +LIBGPGME_LT_REVISION=0` # If the API is changed in an incompatible way: increment the next counter. GPGME_CONFIG_API_VERSION=1 From cvs at cvs.gnupg.org Thu Jun 18 19:18:41 2009 From: cvs at cvs.gnupg.org (svn author marcus) Date: Thu, 18 Jun 2009 19:18:41 +0200 Subject: [svn] gpgme - r1385 - trunk Message-ID: Author: marcus Date: 2009-06-18 19:18:41 +0200 (Thu, 18 Jun 2009) New Revision: 1385 Modified: trunk/configure.ac Log: Fix last change, how did that happen? Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2009-06-18 17:16:47 UTC (rev 1384) +++ trunk/configure.ac 2009-06-18 17:18:41 UTC (rev 1385) @@ -51,7 +51,7 @@ # Subtract 2 from this value if you want to make the LFS transition an # ABI break. [Note to self: Remove this comment with the next regular break.] LIBGPGME_LT_AGE=7 -LIBGPGME_LT_REVISION=0` +LIBGPGME_LT_REVISION=0 # If the API is changed in an incompatible way: increment the next counter. GPGME_CONFIG_API_VERSION=1 From cvs at cvs.gnupg.org Thu Jun 18 19:41:19 2009 From: cvs at cvs.gnupg.org (svn author marcus) Date: Thu, 18 Jun 2009 19:41:19 +0200 Subject: [svn] gpgme - r1386 - tags Message-ID: Author: marcus Date: 2009-06-18 19:41:18 +0200 (Thu, 18 Jun 2009) New Revision: 1386 Added: tags/gpgme-1.2.0/ Log: Tagging release 1.2.0. From cvs at cvs.gnupg.org Thu Jun 18 20:32:37 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Thu, 18 Jun 2009 20:32:37 +0200 Subject: [svn] GpgOL - r300 - in trunk: . po src Message-ID: Author: wk Date: 2009-06-18 20:32:36 +0200 (Thu, 18 Jun 2009) New Revision: 300 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/main.c trunk/src/mimeparser.c trunk/src/olflange.cpp Log: About to release 1.0. Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-02-27 11:20:26 UTC (rev 299) +++ trunk/ChangeLog 2009-06-18 18:32:36 UTC (rev 300) @@ -1,3 +1,7 @@ +2009-06-18 Werner Koch + + Release 1.0.0. + 2009-02-27 Werner Koch Release 0.10.19. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2009-02-27 11:20:26 UTC (rev 299) +++ trunk/src/ChangeLog 2009-06-18 18:32:36 UTC (rev 300) @@ -1,3 +1,8 @@ +2009-06-18 Werner Koch + + * common.h (struct opt): Add ANNOUNCE_NUMBER. + * main.c (write_options, read_options): Store and load that number. + 2009-02-26 Werner Koch * mimeparser.c (start_attachment): Try to figure out a good file Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2009-02-27 11:20:26 UTC (rev 299) +++ trunk/NEWS 2009-06-18 18:32:36 UTC (rev 300) @@ -1,3 +1,11 @@ +Noteworthy changes for version 1.0.0 (2009-06-18) +================================================= + + * Show a notice about portential problems. + + * After about 2 years of development, the 1.0 version is now due. + + Noteworthy changes for version 0.10.19 (2009-02-27) =================================================== Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2009-02-27 11:20:26 UTC (rev 299) +++ trunk/configure.ac 2009-06-18 18:32:36 UTC (rev 300) @@ -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.19]) +m4_define([my_version], [1.0.0]) 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/common.h =================================================================== --- trunk/src/common.h 2009-02-27 11:20:26 UTC (rev 299) +++ trunk/src/common.h 2009-06-18 18:32:36 UTC (rev 300) @@ -135,9 +135,12 @@ /* The SVN revision as stored in the registry. */ int svn_revision; - /* The SVN revision of the the binary used to install the forms. */ + /* The SVN revision of the binary used to install the forms. */ int forms_revision; + /* The stored number of the binary which showed the last announcement. */ + int announce_number; + /* Disable message processing until restart. This is required to implement message reverting as a perparation to remove GpgOL. */ int disable_gpgol; Modified: trunk/src/main.c =================================================================== --- trunk/src/main.c 2009-02-27 11:20:26 UTC (rev 299) +++ trunk/src/main.c 2009-06-18 18:32:36 UTC (rev 300) @@ -639,6 +639,10 @@ opt.forms_revision = val? atol (val) : 0; xfree (val); val = NULL; + load_extension_value ("announceNumber", &val); + opt.announce_number = 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; @@ -717,6 +721,7 @@ {"preferHtml", 0, opt.prefer_html}, {"svnRevision", 1, opt.svn_revision}, {"formsRevision", 1, opt.forms_revision}, + {"announceNumber", 1, opt.announce_number}, {"bodyAsAttachment", 0, opt.body_as_attachment}, {NULL, 0} }; Modified: trunk/src/mimeparser.c =================================================================== --- trunk/src/mimeparser.c 2009-02-27 11:20:26 UTC (rev 299) +++ trunk/src/mimeparser.c 2009-06-18 18:32:36 UTC (rev 300) @@ -405,7 +405,7 @@ } } - snprintf (buf, 100, "gpgol%03d.%s", ctx->part_counter, suffix); + snprintf (buf, sizeof buf, "gpgol%03d.%s", ctx->part_counter, suffix); prop.Value.lpszA = buf; } hr = HrSetOneProp ((LPMAPIPROP)newatt, &prop); Modified: trunk/src/olflange.cpp =================================================================== --- trunk/src/olflange.cpp 2009-02-27 11:20:26 UTC (rev 299) +++ trunk/src/olflange.cpp 2009-06-18 18:32:36 UTC (rev 300) @@ -430,6 +430,40 @@ g_initdll = TRUE; log_debug ("%s:%s: first time initialization done\n", SRCNAME, __func__); + +#define ANNOUNCE_NUMBER 1 + if ( ANNOUNCE_NUMBER > opt.announce_number ) + { + /* Note: If you want to change the announcment, you need to + increment the ANNOUNCE_NUMBER above. The number assures + that a user will see this message only once. */ + MessageBox + (NULL, + _("Welcome to GpgOL 1.0\n" + "\n" + "GpgOL adds integrated OpenPGP and S/MIME encryption " + "and digital signing support to Outlook 2003 and 2007.\n" + "\n" + "Although we tested this software extensively, we can't " + "give you any guarantee that it will work as expected. " + "The programming interface we are using has not been properly " + "documented by Microsoft and thus the functionality of GpgOL " + "may cease to work with an update of your Windows system.\n" + "\n" + "WE STRONGLY ADVISE TO RUN ENCRYPTION TESTS BEFORE YOU START " + "TO USE GPGOL ON ANY SENSITIVE DATA!\n" + "\n" + "There are some known problems, the most severe being " + "that sending encrypted or signed mails using an Exchange " + "based account does not work. Using GpgOL along with " + "other Outlook plugins may in some cases not work." + "\n"), + "GpgOL", MB_ICONINFORMATION|MB_OK); + /* Show this warning only once. */ + opt.announce_number = ANNOUNCE_NUMBER; + write_options (); + } + if ( SVN_REVISION > opt.svn_revision ) { MessageBox (NULL, From cvs at cvs.gnupg.org Fri Jun 19 02:09:53 2009 From: cvs at cvs.gnupg.org (svn author marcus) Date: Fri, 19 Jun 2009 02:09:53 +0200 Subject: [svn] pinentry - r205 - in trunk: . gtk+-2 Message-ID: Author: marcus Date: 2009-06-19 02:09:52 +0200 (Fri, 19 Jun 2009) New Revision: 205 Modified: trunk/ChangeLog trunk/gtk+-2/gtksecentry.c trunk/gtk+-2/gtksecentry.h trunk/gtk+-2/pinentry-gtk-2.c Log: 2009-06-19 Marcus Brinkmann Suggested by Simon McVittie: * gtk+-2/gtksecentry.c (g_malloc, g_realloc, g_free): Renamed to secentry_malloc, secentry_realloc. (g_malloc0): Removed. (GMALLOC_SIZE): Move to ... * gtk+-2/gtksecentry.h (GMALLOC_SIZE): ... here. (secentry_malloc, secentry_realloc, secentry_free): New prototypes. * gtk+-2/pinentry-gtk-2.c (main): Set memory allocation vtable. Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-05-04 14:06:30 UTC (rev 204) +++ trunk/ChangeLog 2009-06-19 00:09:52 UTC (rev 205) @@ -1,3 +1,14 @@ +2009-06-19 Marcus Brinkmann + + Suggested by Simon McVittie: + * gtk+-2/gtksecentry.c (g_malloc, g_realloc, g_free): Renamed to + secentry_malloc, secentry_realloc. + (g_malloc0): Removed. + (GMALLOC_SIZE): Move to ... + * gtk+-2/gtksecentry.h (GMALLOC_SIZE): ... here. + (secentry_malloc, secentry_realloc, secentry_free): New prototypes. + * gtk+-2/pinentry-gtk-2.c (main): Set memory allocation vtable. + 2009-05-04 Till Adam * qt4/main.cpp (qt_cmd_handler): Use WId instead of HWND. Modified: trunk/gtk+-2/gtksecentry.c =================================================================== --- trunk/gtk+-2/gtksecentry.c 2009-05-04 14:06:30 UTC (rev 204) +++ trunk/gtk+-2/gtksecentry.c 2009-06-19 00:09:52 UTC (rev 205) @@ -269,14 +269,8 @@ } while(0) -#if GLIB_CHECK_VERSION (2,15,5) -#define GMALLOC_SIZE gsize -#else -#define GMALLOC_SIZE gulong -#endif - gpointer -g_malloc (GMALLOC_SIZE size) +secentry_malloc (GMALLOC_SIZE size) { gpointer p; @@ -293,28 +287,9 @@ return p; } -gpointer -g_malloc0 (GMALLOC_SIZE size) -{ - gpointer p; - if (size == 0) - return NULL; - - if (g_use_secure_mem) { - p = (gpointer) secmem_malloc(size); - if (p) - memset(p, 0, size); - } else - p = (gpointer) calloc(size, 1); - if (!p) - g_error("could not allocate %ld bytes", size); - - return p; -} - gpointer -g_realloc (gpointer mem, GMALLOC_SIZE size) +secentry_realloc (gpointer mem, GMALLOC_SIZE size) { gpointer p; @@ -344,7 +319,7 @@ } void -g_free(gpointer mem) +secentry_free(gpointer mem) { if (mem) { if (m_is_secure(mem)) Modified: trunk/gtk+-2/gtksecentry.h =================================================================== --- trunk/gtk+-2/gtksecentry.h 2009-05-04 14:06:30 UTC (rev 204) +++ trunk/gtk+-2/gtksecentry.h 2009-06-19 00:09:52 UTC (rev 205) @@ -173,6 +173,16 @@ gtk_secure_entry_get_layout_offsets(GtkSecureEntry * entry, gint * x, gint * y); +#if GLIB_CHECK_VERSION (2,15,5) +#define GMALLOC_SIZE gsize +#else +#define GMALLOC_SIZE gulong +#endif + +gpointer secentry_malloc (GMALLOC_SIZE size); +gpointer secentry_realloc (gpointer mem, GMALLOC_SIZE size); +void secentry_free (gpointer mem); + #ifdef __cplusplus } #endif /* __cplusplus */ Modified: trunk/gtk+-2/pinentry-gtk-2.c =================================================================== --- trunk/gtk+-2/pinentry-gtk-2.c 2009-05-04 14:06:30 UTC (rev 204) +++ trunk/gtk+-2/pinentry-gtk-2.c 2009-06-19 00:09:52 UTC (rev 205) @@ -531,6 +531,18 @@ int main (int argc, char *argv[]) { + static GMemVTable secure_mem = + { + secentry_malloc, + secentry_realloc, + secentry_free, + NULL, + NULL, + NULL + }; + + g_mem_set_vtable (&secure_mem); + pinentry_init (PGMNAME); #ifdef FALLBACK_CURSES From cvs at cvs.gnupg.org Fri Jun 19 03:25:46 2009 From: cvs at cvs.gnupg.org (svn author marcus) Date: Fri, 19 Jun 2009 03:25:46 +0200 Subject: [svn] pinentry - r206 - in trunk: . gtk+-2 Message-ID: Author: marcus Date: 2009-06-19 03:25:45 +0200 (Fri, 19 Jun 2009) New Revision: 206 Modified: trunk/ChangeLog trunk/gtk+-2/gtksecentry.c Log: 2009-04-24 Guido Guenther * gtk+-2/gtksecentry.c (gtk_secure_entry_class_init): Don't install "gtk-entry-select-on-focus" settings property since it clashes with the one from GtkEntry. (gtk_secure_entry_grab_focus): Create a temporary GtkEntry widget to read that value instead. Allows to have GtkEntry and GtkSecureEntry in the same process. Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-06-19 00:09:52 UTC (rev 205) +++ trunk/ChangeLog 2009-06-19 01:25:45 UTC (rev 206) @@ -1,3 +1,12 @@ +2009-04-24 Guido Guenther + + * gtk+-2/gtksecentry.c (gtk_secure_entry_class_init): Don't + install "gtk-entry-select-on-focus" settings property since it + clashes with the one from GtkEntry. + (gtk_secure_entry_grab_focus): Create a temporary GtkEntry widget + to read that value instead. Allows to have GtkEntry and + GtkSecureEntry in the same process. + 2009-06-19 Marcus Brinkmann Suggested by Simon McVittie: Modified: trunk/gtk+-2/gtksecentry.c =================================================================== --- trunk/gtk+-2/gtksecentry.c 2009-06-19 00:09:52 UTC (rev 205) +++ trunk/gtk+-2/gtksecentry.c 2009-06-19 01:25:45 UTC (rev 206) @@ -665,13 +665,6 @@ GDK_CONTROL_MASK, "delete_from_cursor", 2, G_TYPE_ENUM, GTK_DELETE_WORD_ENDS, G_TYPE_INT, -1); - - gtk_settings_install_property(g_param_spec_boolean - ("gtk-entry-select-on-focus", - _("Select on focus"), - _ - ("Whether to select the contents of an entry when it is focused"), - TRUE, G_PARAM_READWRITE)); } static void @@ -1349,14 +1342,18 @@ static void gtk_secure_entry_grab_focus(GtkWidget * widget) { + GtkWidget *tmp; GtkSecureEntry *entry = GTK_SECURE_ENTRY(widget); gboolean select_on_focus; GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_DEFAULT); GTK_WIDGET_CLASS(parent_class)->grab_focus(widget); - g_object_get(gtk_widget_get_settings(widget), + /* read current select on focus setting from GtkEntry */ + tmp = gtk_entry_new (); + g_object_get(gtk_widget_get_settings(tmp), "gtk-entry-select-on-focus", &select_on_focus, NULL); + gtk_widget_destroy (tmp); if (select_on_focus && !entry->in_click) gtk_editable_select_region(GTK_EDITABLE(widget), 0, -1); From cvs at cvs.gnupg.org Fri Jun 19 03:29:56 2009 From: cvs at cvs.gnupg.org (svn author marcus) Date: Fri, 19 Jun 2009 03:29:56 +0200 Subject: [svn] pinentry - r207 - in trunk: . doc Message-ID: Author: marcus Date: 2009-06-19 03:29:55 +0200 (Fri, 19 Jun 2009) New Revision: 207 Modified: trunk/ChangeLog trunk/doc/pinentry.texi Log: 2009-01-29 Bernhard Reiter * doc/pinentry.texi (Using pinentry): Fix typo. Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-06-19 01:25:45 UTC (rev 206) +++ trunk/ChangeLog 2009-06-19 01:29:55 UTC (rev 207) @@ -1,3 +1,7 @@ +2009-01-29 Bernhard Reiter + + * doc/pinentry.texi (Using pinentry): Fix typo. + 2009-04-24 Guido Guenther * gtk+-2/gtksecentry.c (gtk_secure_entry_class_init): Don't Modified: trunk/doc/pinentry.texi =================================================================== --- trunk/doc/pinentry.texi 2009-06-19 01:25:45 UTC (rev 206) +++ trunk/doc/pinentry.texi 2009-06-19 01:29:55 UTC (rev 207) @@ -191,12 +191,12 @@ @item --display @var{string} @itemx --ttyname @var{string} @itemx --ttytype @var{string} - at itemx --lc-type @var{string} + at itemx --lc-ctype @var{string} @itemx --lc-messages @var{string} @opindex display @opindex ttyname @opindex ttytype - at opindex lc-type + at opindex lc-ctype @opindex lc-messa These options are used to pass localization information to @pinentry{}. They are required because @pinentry{} is usually called From cvs at cvs.gnupg.org Fri Jun 19 04:02:51 2009 From: cvs at cvs.gnupg.org (svn author marcus) Date: Fri, 19 Jun 2009 04:02:51 +0200 Subject: [svn] pinentry - r208 - trunk Message-ID: Author: marcus Date: 2009-06-19 04:02:51 +0200 (Fri, 19 Jun 2009) New Revision: 208 Modified: trunk/ChangeLog trunk/NEWS trunk/configure.ac Log: 2009-06-19 Marcus Brinkmann Release version 0.7.6. * configure.ac: Bump version. Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-06-19 01:29:55 UTC (rev 207) +++ trunk/ChangeLog 2009-06-19 02:02:51 UTC (rev 208) @@ -1,3 +1,9 @@ +2009-06-19 Marcus Brinkmann + + Release version 0.7.6. + + * configure.ac: Bump version. + 2009-01-29 Bernhard Reiter * doc/pinentry.texi (Using pinentry): Fix typo. Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2009-06-19 01:29:55 UTC (rev 207) +++ trunk/NEWS 2009-06-19 02:02:51 UTC (rev 208) @@ -1,15 +1,18 @@ -Noteworthy changes in version 0.7.6 +Noteworthy changes in version 0.7.6 (2009-06-19) ------------------------------------------------ * Make Gtk+-2 pinentry transient to the root window. * Add Qt4 pinentry. + * Add native W32 pinentry. + * Fix utf-8 problem in Qt pinentries. * Return GPG_ERR_CANCELED if during a "CONFIRM" command the user closed the window. + * Add quality bar. Noteworthy changes in version 0.7.5 (2008-02-15) ------------------------------------------------ Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2009-06-19 01:29:55 UTC (rev 207) +++ trunk/configure.ac 2009-06-19 02:02:51 UTC (rev 208) @@ -32,7 +32,7 @@ # SVN version is the most recent one in a branch. To disable the SVN # version for the real release, set the my_issvn macro to no. m4_define(my_version, [0.7.6]) -m4_define(my_issvn, [yes]) +m4_define(my_issvn, [no]) m4_define([svn_revision], m4_esyscmd([printf "%d" $(svn info 2>/dev/null \ | sed -n '/^Revision:/ s/[^0-9]//gp'|head -1)])) From cvs at cvs.gnupg.org Fri Jun 19 04:04:24 2009 From: cvs at cvs.gnupg.org (svn author marcus) Date: Fri, 19 Jun 2009 04:04:24 +0200 Subject: [svn] gpgme - r1387 - trunk Message-ID: Author: marcus Date: 2009-06-19 04:04:24 +0200 (Fri, 19 Jun 2009) New Revision: 1387 Modified: trunk/ChangeLog trunk/NEWS trunk/configure.ac Log: 2009-06-18 Marcus Brinkmann Released GPGME 1.2.0. Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-06-18 17:41:18 UTC (rev 1386) +++ trunk/ChangeLog 2009-06-19 02:04:24 UTC (rev 1387) @@ -1,5 +1,7 @@ 2009-06-18 Marcus Brinkmann + Released GPGME 1.2.0. + * configure.ac (my_version): Set to 1.2.0. (LIBGPGME_LT_CURRENT, LIBGPGME_LT_AGE): Bump. (LIBGPGME_LT_REVISION): Reset. Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2009-06-18 17:41:18 UTC (rev 1386) +++ trunk/NEWS 2009-06-19 02:04:24 UTC (rev 1387) @@ -1,3 +1,8 @@ +Noteworthy changes in version 1.2.1 (unreleased) +------------------------------------------------ + + * (none yet) + Noteworthy changes in version 1.2.0 (2009-06-18) ------------------------------------------------ Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2009-06-18 17:41:18 UTC (rev 1386) +++ trunk/configure.ac 2009-06-19 02:04:24 UTC (rev 1387) @@ -31,8 +31,8 @@ # specific feature can already be done under the assumption that the # SVN version is the most recent one in a branch. To disable the SVN # version for the real release, set the my_issvn macro to no. -m4_define(my_version, [1.2.0]) -m4_define(my_issvn, [no]) +m4_define(my_version, [1.2.1]) +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;}')])) From cvs at cvs.gnupg.org Fri Jun 19 09:39:11 2009 From: cvs at cvs.gnupg.org (svn author marcus) Date: Fri, 19 Jun 2009 09:39:11 +0200 Subject: [svn] pinentry - r209 - trunk Message-ID: Author: marcus Date: 2009-06-19 09:39:10 +0200 (Fri, 19 Jun 2009) New Revision: 209 Modified: trunk/ChangeLog trunk/NEWS trunk/configure.ac Log: 2009-06-19 Marcus Brinkmann * configure.ac: Post-release changes. Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-06-19 02:02:51 UTC (rev 208) +++ trunk/ChangeLog 2009-06-19 07:39:10 UTC (rev 209) @@ -1,5 +1,7 @@ 2009-06-19 Marcus Brinkmann + * configure.ac: Post-release changes. + Release version 0.7.6. * configure.ac: Bump version. Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2009-06-19 02:02:51 UTC (rev 208) +++ trunk/NEWS 2009-06-19 07:39:10 UTC (rev 209) @@ -1,3 +1,7 @@ +Noteworthy changes in version 0.7.7 (unreleased) +------------------------------------------------ + + Noteworthy changes in version 0.7.6 (2009-06-19) ------------------------------------------------ Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2009-06-19 02:02:51 UTC (rev 208) +++ trunk/configure.ac 2009-06-19 07:39:10 UTC (rev 209) @@ -31,8 +31,8 @@ # specific feature can already be done under the assumption that the # SVN version is the most recent one in a branch. To disable the SVN # version for the real release, set the my_issvn macro to no. -m4_define(my_version, [0.7.6]) -m4_define(my_issvn, [no]) +m4_define(my_version, [0.7.7]) +m4_define(my_issvn, [yes]) m4_define([svn_revision], m4_esyscmd([printf "%d" $(svn info 2>/dev/null \ | sed -n '/^Revision:/ s/[^0-9]//gp'|head -1)])) From cvs at cvs.gnupg.org Sat Jun 20 01:03:39 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Sat, 20 Jun 2009 01:03:39 +0200 Subject: [svn] GpgOL - r301 - tags Message-ID: Author: wk Date: 2009-06-20 01:03:39 +0200 (Sat, 20 Jun 2009) New Revision: 301 Added: tags/gpgol-1.0.0/ Log: Released 1.0.0. From cvs at cvs.gnupg.org Mon Jun 22 16:50:17 2009 From: cvs at cvs.gnupg.org (svn author marcus) Date: Mon, 22 Jun 2009 16:50:17 +0200 Subject: [svn] gpgme - r1388 - in trunk: . assuan src tests tests/gpg tests/gpgsm Message-ID: Author: marcus Date: 2009-06-22 16:50:17 +0200 (Mon, 22 Jun 2009) New Revision: 1388 Modified: trunk/ChangeLog trunk/assuan/assuan.h trunk/configure.ac trunk/src/ChangeLog trunk/src/debug.c trunk/src/debug.h trunk/src/gpgme.h.in trunk/src/keylist.c trunk/src/priv-io.h trunk/src/sign.c trunk/tests/ChangeLog trunk/tests/gpg/t-support.h trunk/tests/gpgsm/t-support.h Log: 2009-06-22 Marcus Brinkmann * configure.ac: Add AC_TYPE_UINTPTR_T. * assuan/assuan.h [_ASSUAN_IN_GPGME_BUILD_ASSUAN]: Declare _gpgme_io_connect. src/ 2009-06-22 Marcus Brinkmann * debug.h: Everywhere, use %p instead of 0x%x to print pointer. [HAVE_STDINT_H]: Include . (_TRACE, TRACE, TRACE0, TRACE1, TRACE2, TRACE3, TRACE6): Cast tag to (uintptr_t) before casting it to (void*) to silence GCC warning. * gpgme.h.in (_GPGME_DEPRECATED_OUTSIDE_GPGME): New macro. * sign.c (_GPGME_IN_GPGME): Define it. * keylist.c (_GPGME_IN_GPGME): Define it. * debug.c (_gpgme_debug_begin, _gpgme_debug_add): Handle error in vasprintf and asprintf. * priv-io.h: Include . Declare _gpgme_io_connect. tests/ 2009-06-22 Marcus Brinkmann * gpg/t-support.h (passphrase_cb): Implement write() according to the book to silence compiler warning. * gpgsm/t-support.h (passphrase_cb): Likewise. Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-06-19 02:04:24 UTC (rev 1387) +++ trunk/ChangeLog 2009-06-22 14:50:17 UTC (rev 1388) @@ -1,3 +1,10 @@ +2009-06-22 Marcus Brinkmann + + * configure.ac: Add AC_TYPE_UINTPTR_T. + + * assuan/assuan.h [_ASSUAN_IN_GPGME_BUILD_ASSUAN]: Declare + _gpgme_io_connect. + 2009-06-18 Marcus Brinkmann Released GPGME 1.2.0. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2009-06-19 02:04:24 UTC (rev 1387) +++ trunk/src/ChangeLog 2009-06-22 14:50:17 UTC (rev 1388) @@ -1,3 +1,20 @@ +2009-06-22 Marcus Brinkmann + + * debug.h: Everywhere, use %p instead of 0x%x to print pointer. + [HAVE_STDINT_H]: Include . + (_TRACE, TRACE, TRACE0, TRACE1, TRACE2, TRACE3, TRACE6): Cast tag + to (uintptr_t) before casting it to (void*) to silence GCC + warning. + + * gpgme.h.in (_GPGME_DEPRECATED_OUTSIDE_GPGME): New macro. + * sign.c (_GPGME_IN_GPGME): Define it. + * keylist.c (_GPGME_IN_GPGME): Define it. + + * debug.c (_gpgme_debug_begin, _gpgme_debug_add): Handle error in + vasprintf and asprintf. + + * priv-io.h: Include . Declare _gpgme_io_connect. + 2009-06-18 Marcus Brinkmann * gpgme.h.in (GPGME_CONF_PATHNAME): Revert last change, it's Modified: trunk/tests/ChangeLog =================================================================== --- trunk/tests/ChangeLog 2009-06-19 02:04:24 UTC (rev 1387) +++ trunk/tests/ChangeLog 2009-06-22 14:50:17 UTC (rev 1388) @@ -1,3 +1,9 @@ +2009-06-22 Marcus Brinkmann + + * gpg/t-support.h (passphrase_cb): Implement write() according to + the book to silence compiler warning. + * gpgsm/t-support.h (passphrase_cb): Likewise. + 2009-06-16 Werner Koch * gpg/pgp-import.c: New. Modified: trunk/assuan/assuan.h =================================================================== --- trunk/assuan/assuan.h 2009-06-19 02:04:24 UTC (rev 1387) +++ trunk/assuan/assuan.h 2009-06-22 14:50:17 UTC (rev 1388) @@ -75,6 +75,7 @@ int _gpgme_io_close (int fd); int _gpgme_io_read (int fd, void *buffer, size_t count); int _gpgme_io_write (int fd, const void *buffer, size_t count); +int _gpgme_io_connect (int fd, struct sockaddr *addr, int addrlen); int _gpgme_io_sendmsg (int sock, const struct msghdr *msg, int flags); int _gpgme_io_recvmsg (int sock, struct msghdr *msg, int flags); int _gpgme_io_socket (int domain, int type, int proto); Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2009-06-19 02:04:24 UTC (rev 1387) +++ trunk/configure.ac 2009-06-22 14:50:17 UTC (rev 1388) @@ -197,6 +197,7 @@ AC_CHECK_SIZEOF(unsigned int) AC_SYS_LARGEFILE AC_TYPE_OFF_T +AC_TYPE_UINTPTR_T # A simple compile time check in gpgme.h for GNU/Linux systems that # prevents a file offset bits mismatch between gpgme and the application. Modified: trunk/src/debug.c =================================================================== --- trunk/src/debug.c 2009-06-19 02:04:24 UTC (rev 1387) +++ trunk/src/debug.c 2009-06-22 14:50:17 UTC (rev 1388) @@ -1,6 +1,6 @@ /* debug.c - helpful output in desperate situations 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, 2009 g10 Code GmbH This file is part of GPGME. @@ -197,6 +197,7 @@ _gpgme_debug_begin (void **line, int level, const char *format, ...) { va_list arg_ptr; + int res; debug_init (); if (debug_level < level) @@ -207,8 +208,10 @@ } va_start (arg_ptr, format); - vasprintf ((char **) line, format, arg_ptr); + res = vasprintf ((char **) line, format, arg_ptr); va_end (arg_ptr); + if (res < 0) + *line = NULL; } @@ -219,17 +222,26 @@ va_list arg_ptr; char *toadd; char *result; + int res; if (!*line) return; va_start (arg_ptr, format); - vasprintf (&toadd, format, arg_ptr); + res = vasprintf (&toadd, format, arg_ptr); va_end (arg_ptr); - asprintf (&result, "%s%s", *(char **) line, toadd); + if (res < 0) + { + free (*line); + *line = NULL; + } + res = asprintf (&result, "%s%s", *(char **) line, toadd); + free (toadd); free (*line); - free (toadd); - *line = result; + if (res < 0) + *line = NULL; + else + *line = result; } Modified: trunk/src/debug.h =================================================================== --- trunk/src/debug.h 2009-06-19 02:04:24 UTC (rev 1387) +++ trunk/src/debug.h 2009-06-22 14:50:17 UTC (rev 1388) @@ -22,6 +22,9 @@ #define DEBUG_H #include +#ifdef HAVE_STDINT_H +#include +#endif /* Indirect stringification, requires __STDC__ to work. */ #define STRINGIFY(v) #v @@ -81,133 +84,134 @@ int _gpgme_trace_level = lvl; \ const char *const _gpgme_trace_func = name; \ const char *const _gpgme_trace_tagname = STRINGIFY (tag); \ - void *_gpgme_trace_tag = (void *) tag + void *_gpgme_trace_tag = (void *) (uintptr_t) tag #define TRACE_BEG(lvl, name, tag) \ _TRACE (lvl, name, tag); \ - _gpgme_debug (_gpgme_trace_level, "%s (%s=0x%x): enter\n", \ + _gpgme_debug (_gpgme_trace_level, "%s (%s=%p): enter\n", \ _gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tag), 0 #define TRACE_BEG0(lvl, name, tag, fmt) \ _TRACE (lvl, name, tag); \ - _gpgme_debug (_gpgme_trace_level, "%s (%s=0x%x): enter: " fmt "\n", \ + _gpgme_debug (_gpgme_trace_level, "%s (%s=%p): enter: " fmt "\n", \ _gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tag), 0 #define TRACE_BEG1(lvl, name, tag, fmt, arg1) \ _TRACE (lvl, name, tag); \ - _gpgme_debug (_gpgme_trace_level, "%s (%s=0x%x): enter: " fmt "\n", \ + _gpgme_debug (_gpgme_trace_level, "%s (%s=%p): enter: " fmt "\n", \ _gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tag, arg1), 0 #define TRACE_BEG2(lvl, name, tag, fmt, arg1, arg2) \ _TRACE (lvl, name, tag); \ - _gpgme_debug (_gpgme_trace_level, "%s (%s=0x%x): enter: " fmt "\n", \ + _gpgme_debug (_gpgme_trace_level, "%s (%s=%p): enter: " fmt "\n", \ _gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tag, arg1, arg2), 0 #define TRACE_BEG3(lvl, name, tag, fmt, arg1, arg2, arg3) \ _TRACE (lvl, name, tag); \ - _gpgme_debug (_gpgme_trace_level, "%s (%s=0x%x): enter: " fmt "\n", \ + _gpgme_debug (_gpgme_trace_level, "%s (%s=%p): enter: " fmt "\n", \ _gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tag, arg1, arg2, arg3), 0 #define TRACE_BEG4(lvl, name, tag, fmt, arg1, arg2, arg3, arg4) \ _TRACE (lvl, name, tag); \ - _gpgme_debug (_gpgme_trace_level, "%s (%s=0x%x): enter: " fmt "\n", \ + _gpgme_debug (_gpgme_trace_level, "%s (%s=%p): enter: " fmt "\n", \ _gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tag, arg1, arg2, arg3, arg4), 0 #define TRACE(lvl, name, tag) \ - _gpgme_debug (lvl, "%s (%s=0x%x): call\n", \ - name, STRINGIFY (tag), (void *) tag), 0 + _gpgme_debug (lvl, "%s (%s=%p): call\n", \ + name, STRINGIFY (tag), (void *) (uintptr_t) tag), 0 #define TRACE0(lvl, name, tag, fmt) \ - _gpgme_debug (lvl, "%s (%s=0x%x): call: " fmt "\n", \ - name, STRINGIFY (tag), (void *) tag), 0 + _gpgme_debug (lvl, "%s (%s=%p): call: " fmt "\n", \ + name, STRINGIFY (tag), (void *) (uintptr_t) tag), 0 #define TRACE1(lvl, name, tag, fmt, arg1) \ - _gpgme_debug (lvl, "%s (%s=0x%x): call: " fmt "\n", \ - name, STRINGIFY (tag), (void *) tag, arg1), 0 + _gpgme_debug (lvl, "%s (%s=%p): call: " fmt "\n", \ + name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1), 0 #define TRACE2(lvl, name, tag, fmt, arg1, arg2) \ - _gpgme_debug (lvl, "%s (%s=0x%x): call: " fmt "\n", \ - name, STRINGIFY (tag), (void *) tag, arg1, arg2), 0 + _gpgme_debug (lvl, "%s (%s=%p): call: " fmt "\n", \ + name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1, \ + arg2), 0 #define TRACE3(lvl, name, tag, fmt, arg1, arg2, arg3) \ - _gpgme_debug (lvl, "%s (%s=0x%x): call: " fmt "\n", \ - name, STRINGIFY (tag), (void *) tag, arg1, arg2, \ - arg3), 0 + _gpgme_debug (lvl, "%s (%s=%p): call: " fmt "\n", \ + name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1, \ + arg2, arg3), 0 #define TRACE6(lvl, name, tag, fmt, arg1, arg2, arg3, arg4, arg5, arg6) \ - _gpgme_debug (lvl, "%s (%s=0x%x): call: " fmt "\n", \ - name, STRINGIFY (tag), (void *) tag, arg1, arg2, arg3, \ - arg4, arg5, arg6), 0 + _gpgme_debug (lvl, "%s (%s=%p): call: " fmt "\n", \ + name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1, \ + arg2, arg3, arg4, arg5, arg6), 0 #define TRACE_ERR(err) \ err == 0 ? (TRACE_SUC ()) : \ - (_gpgme_debug (_gpgme_trace_level, "%s (%s=0x%x): error: %s <%s>\n", \ + (_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): error: %s <%s>\n", \ _gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tag, gpgme_strerror (err), \ gpgme_strsource (err)), (err)) /* The cast to void suppresses GCC warnings. */ #define TRACE_SYSRES(res) \ res >= 0 ? ((void) (TRACE_SUC1 ("result=%i", res)), (res)) : \ - (_gpgme_debug (_gpgme_trace_level, "%s (%s=0x%x): error: %s\n", \ + (_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): error: %s\n", \ _gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tag, strerror (errno)), (res)) #define TRACE_SYSERR(res) \ res == 0 ? ((void) (TRACE_SUC1 ("result=%i", res)), (res)) : \ - (_gpgme_debug (_gpgme_trace_level, "%s (%s=0x%x): error: %s\n", \ + (_gpgme_debug (_gpgme_trace_level, "%s (%s=%p): error: %s\n", \ _gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tag, strerror (res)), (res)) #define TRACE_SUC() \ - _gpgme_debug (_gpgme_trace_level, "%s (%s=0x%x): leave\n", \ + _gpgme_debug (_gpgme_trace_level, "%s (%s=%p): leave\n", \ _gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tag), 0 #define TRACE_SUC0(fmt) \ - _gpgme_debug (_gpgme_trace_level, "%s (%s=0x%x): leave: " fmt "\n", \ + _gpgme_debug (_gpgme_trace_level, "%s (%s=%p): leave: " fmt "\n", \ _gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tag), 0 #define TRACE_SUC1(fmt, arg1) \ - _gpgme_debug (_gpgme_trace_level, "%s (%s=0x%x): leave: " fmt "\n", \ + _gpgme_debug (_gpgme_trace_level, "%s (%s=%p): leave: " fmt "\n", \ _gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tag, arg1), 0 #define TRACE_SUC2(fmt, arg1, arg2) \ - _gpgme_debug (_gpgme_trace_level, "%s (%s=0x%x): leave: " fmt "\n", \ + _gpgme_debug (_gpgme_trace_level, "%s (%s=%p): leave: " fmt "\n", \ _gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tag, arg1, arg2), 0 #define TRACE_SUC5(fmt, arg1, arg2, arg3, arg4, arg5) \ - _gpgme_debug (_gpgme_trace_level, "%s (%s=0x%x): leave: " fmt "\n", \ + _gpgme_debug (_gpgme_trace_level, "%s (%s=%p): leave: " fmt "\n", \ _gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tag, arg1, arg2, arg3, arg4, arg5), 0 #define TRACE_LOG(fmt) \ - _gpgme_debug (_gpgme_trace_level, "%s (%s=0x%x): check: " fmt "\n", \ + _gpgme_debug (_gpgme_trace_level, "%s (%s=%p): check: " fmt "\n", \ _gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tag), 0 #define TRACE_LOG1(fmt, arg1) \ - _gpgme_debug (_gpgme_trace_level, "%s (%s=0x%x): check: " fmt "\n", \ + _gpgme_debug (_gpgme_trace_level, "%s (%s=%p): check: " fmt "\n", \ _gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tag, arg1), 0 #define TRACE_LOG2(fmt, arg1, arg2) \ - _gpgme_debug (_gpgme_trace_level, "%s (%s=0x%x): check: " fmt "\n", \ + _gpgme_debug (_gpgme_trace_level, "%s (%s=%p): check: " fmt "\n", \ _gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tag, arg1, arg2), 0 #define TRACE_LOG3(fmt, arg1, arg2, arg3) \ - _gpgme_debug (_gpgme_trace_level, "%s (%s=0x%x): check: " fmt "\n", \ + _gpgme_debug (_gpgme_trace_level, "%s (%s=%p): check: " fmt "\n", \ _gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tag, arg1, arg2, arg3), 0 #define TRACE_LOG4(fmt, arg1, arg2, arg3, arg4) \ - _gpgme_debug (_gpgme_trace_level, "%s (%s=0x%x): check: " fmt "\n", \ + _gpgme_debug (_gpgme_trace_level, "%s (%s=%p): check: " fmt "\n", \ _gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tag, arg1, arg2, arg3, arg4), 0 #define TRACE_LOG6(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \ - _gpgme_debug (_gpgme_trace_level, "%s (%s=0x%x): check: " fmt "\n", \ + _gpgme_debug (_gpgme_trace_level, "%s (%s=%p): check: " fmt "\n", \ _gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tag, arg1, arg2, arg3, arg4, arg5, \ arg6), 0 #define TRACE_LOGBUF(buf, len) \ - _gpgme_debug_buffer (_gpgme_trace_level, "%s (%s=0x%x): check: %s", \ + _gpgme_debug_buffer (_gpgme_trace_level, "%s (%s=%p): check: %s", \ _gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tag, buf, len) #define TRACE_SEQ(hlp,fmt) \ _gpgme_debug_begin (&(hlp), _gpgme_trace_level, \ - "%s (%s=0x%x): check: " fmt, \ + "%s (%s=%p): check: " fmt, \ _gpgme_trace_func, _gpgme_trace_tagname, \ _gpgme_trace_tag) #define TRACE_ADD0(hlp,fmt) \ Modified: trunk/src/gpgme.h.in =================================================================== --- trunk/src/gpgme.h.in 2009-06-19 02:04:24 UTC (rev 1387) +++ trunk/src/gpgme.h.in 2009-06-22 14:50:17 UTC (rev 1388) @@ -66,6 +66,14 @@ #define _GPGME_DEPRECATED #endif +/* The macro _GPGME_DEPRECATED_OUTSIDE_GPGME suppresses warnings for + fields we must access in GPGME for ABI compatibility. */ +#ifdef _GPGME_IN_GPGME +#define _GPGME_DEPRECATED_OUTSIDE_GPGME +#else +#define _GPGME_DEPRECATED_OUTSIDE_GPGME _GPGME_DEPRECATED +#endif + /* The version of this header should match the one of the library. Do not use this symbol in your application, use gpgme_check_version @@ -615,7 +623,7 @@ unsigned int _obsolete_class _GPGME_DEPRECATED; #else /* Must be set to SIG_CLASS below. */ - unsigned int class _GPGME_DEPRECATED; + unsigned int class _GPGME_DEPRECATED_OUTSIDE_GPGME; #endif /* The user ID string. */ @@ -1294,7 +1302,7 @@ unsigned int _obsolete_class_2; #else /* Must be set to SIG_CLASS below. */ - unsigned int class _GPGME_DEPRECATED; + unsigned int class _GPGME_DEPRECATED_OUTSIDE_GPGME; #endif /* Crypto backend specific signature class. */ Modified: trunk/src/keylist.c =================================================================== --- trunk/src/keylist.c 2009-06-19 02:04:24 UTC (rev 1387) +++ trunk/src/keylist.c 2009-06-22 14:50:17 UTC (rev 1388) @@ -32,6 +32,8 @@ #include #include +/* Suppress warning for accessing deprecated member "class". */ +#define _GPGME_IN_GPGME #include "gpgme.h" #include "util.h" #include "context.h" Modified: trunk/src/priv-io.h =================================================================== --- trunk/src/priv-io.h 2009-06-19 02:04:24 UTC (rev 1387) +++ trunk/src/priv-io.h 2009-06-22 14:50:17 UTC (rev 1388) @@ -22,6 +22,7 @@ #ifndef IO_H #define IO_H +#include /* A single file descriptor passed to spawn. For child fds, dup_to specifies the fd it should become in the child, but only 0, 1 and 2 @@ -50,6 +51,7 @@ /* These function are either defined in posix-io.c or w32-io.c. */ void _gpgme_io_subsystem_init (void); +int _gpgme_io_connect (int fd, struct sockaddr *addr, int addrlen); int _gpgme_io_read (int fd, void *buffer, size_t count); int _gpgme_io_write (int fd, const void *buffer, size_t count); int _gpgme_io_pipe (int filedes[2], int inherit_idx); Modified: trunk/src/sign.c =================================================================== --- trunk/src/sign.c 2009-06-19 02:04:24 UTC (rev 1387) +++ trunk/src/sign.c 2009-06-22 14:50:17 UTC (rev 1388) @@ -26,6 +26,8 @@ #include #include +/* Suppress warning for accessing deprecated member "class". */ +#define _GPGME_IN_GPGME 1 #include "gpgme.h" #include "context.h" #include "ops.h" Modified: trunk/tests/gpg/t-support.h =================================================================== --- trunk/tests/gpg/t-support.h 2009-06-19 02:04:24 UTC (rev 1387) +++ trunk/tests/gpg/t-support.h 2009-06-22 14:50:17 UTC (rev 1388) @@ -80,7 +80,20 @@ DWORD written; WriteFile ((HANDLE) fd, "abc\n", 4, &written, 0); #else - write (fd, "abc\n", 4); + int res; + char *pass = "abc\n"; + int passlen = strlen (pass); + int off = 0; + + do + { + res = write (fd, &pass[off], passlen - off); + if (res > 0) + off += res; + } + while (res > 0 && off != passlen); + + return off == passlen ? 0 : gpgme_error_from_errno (errno); #endif return 0; Modified: trunk/tests/gpgsm/t-support.h =================================================================== --- trunk/tests/gpgsm/t-support.h 2009-06-19 02:04:24 UTC (rev 1387) +++ trunk/tests/gpgsm/t-support.h 2009-06-22 14:50:17 UTC (rev 1388) @@ -62,8 +62,20 @@ passphrase_cb (void *opaque, const char *uid_hint, const char *passphrase_info, int last_was_bad, int fd) { - write (fd, "abc\n", 4); - return 0; + int res; + char *pass = "abc\n"; + int passlen = strlen (pass); + int off = 0; + + do + { + res = write (fd, &pass[off], passlen - off); + if (res > 0) + off += res; + } + while (res > 0 && off != passlen); + + return off == passlen ? 0 : gpgme_error_from_errno (errno); } From cvs at cvs.gnupg.org Tue Jun 23 17:04:51 2009 From: cvs at cvs.gnupg.org (svn author marcus) Date: Tue, 23 Jun 2009 17:04:51 +0200 Subject: [svn] gpg-error - r214 - in trunk: . m4 src Message-ID: Author: marcus Date: 2009-06-23 17:04:47 +0200 (Tue, 23 Jun 2009) New Revision: 214 Added: trunk/m4/ltoptions.m4 trunk/m4/ltsugar.m4 trunk/m4/ltversion.m4 trunk/m4/lt~obsolete.m4 Modified: trunk/ChangeLog trunk/config.guess trunk/config.sub trunk/configure.ac trunk/install-sh trunk/ltmain.sh trunk/m4/libtool.m4 trunk/src/Makefile.am Log: 2009-06-23 Marcus Brinkmann Update to libtool 2.2.6a. * configure.ac: Invoke AC_CONFIG_MACRO_DIR. (AC_LIBTOOL_WIN32_DLL, AC_LIBTOOL_RC): Replace by ... (LT_PREREQ, LT_INIT, LT_LANG): ... these. * config.guess, config.sub, install-sh, ltmain.sh, m4/libtool.m4: Updated to libtool 2.2.6a. * m4/ltoptions.m4, m4/ltsugar.m4, m4/ltversion.m4, m4/lt~obsolete.m4: New files from libtool 2.2.6a. * src/Makefile.am (LTRCCOMPILE): Refactor with ... (RCCOMPILE): ... this new macro. Add $(libgpg_error_la_CPPFLAGS). (SUFFIXES): Add .lo. (.rc.o): Change to ... (.rc.lo): ... this implicit rule. (gpg_error_res_ldflag): Removed. (gpg_error_res): Use libtool object file name here. (install-def-file): Fix typo. (libgpg_error_la_LDFLAGS): Remove gpg_error_res_ldflag usage. (libgpg_error_la_LIBADD): Add gpg_error_res. [The diff below has been truncated] Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-03-29 16:27:19 UTC (rev 213) +++ trunk/ChangeLog 2009-06-23 15:04:47 UTC (rev 214) @@ -1,3 +1,24 @@ +2009-06-23 Marcus Brinkmann + + Update to libtool 2.2.6a. + * configure.ac: Invoke AC_CONFIG_MACRO_DIR. + (AC_LIBTOOL_WIN32_DLL, AC_LIBTOOL_RC): Replace by ... + (LT_PREREQ, LT_INIT, LT_LANG): ... these. + * config.guess, config.sub, install-sh, ltmain.sh, m4/libtool.m4: + Updated to libtool 2.2.6a. + * m4/ltoptions.m4, m4/ltsugar.m4, m4/ltversion.m4, + m4/lt~obsolete.m4: New files from libtool 2.2.6a. + * src/Makefile.am (LTRCCOMPILE): Refactor with ... + (RCCOMPILE): ... this new macro. Add $(libgpg_error_la_CPPFLAGS). + (SUFFIXES): Add .lo. + (.rc.o): Change to ... + (.rc.lo): ... this implicit rule. + (gpg_error_res_ldflag): Removed. + (gpg_error_res): Use libtool object file name here. + (install-def-file): Fix typo. + (libgpg_error_la_LDFLAGS): Remove gpg_error_res_ldflag usage. + (libgpg_error_la_LIBADD): Add gpg_error_res. + 2008-11-26 Werner Koch Release 1.7. Modified: trunk/config.guess =================================================================== --- trunk/config.guess 2009-03-29 16:27:19 UTC (rev 213) +++ trunk/config.guess 2009-06-23 15:04:47 UTC (rev 214) @@ -1,14 +1,14 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, -# Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. -timestamp='2007-05-17' +timestamp='2008-01-23' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or +# the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -17,7 +17,9 @@ # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, see . +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -54,8 +56,8 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -328,7 +330,7 @@ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; - i86pc:SunOS:5.*:* | ix86xen:SunOS:5.*:*) + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) @@ -530,7 +532,7 @@ echo rs6000-ibm-aix3.2 fi exit ;; - *:AIX:*:[45]) + *:AIX:*:[456]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 @@ -791,12 +793,15 @@ exit ;; *:Interix*:[3456]*) case ${UNAME_MACHINE} in - x86) + x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T | authenticamd) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks @@ -831,7 +836,14 @@ echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu @@ -952,8 +964,8 @@ x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; - xtensa:Linux:*:*) - echo xtensa-unknown-linux-gnu + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so @@ -1472,9 +1484,9 @@ the operating system you are using. It is advised that you download the most up to date version of the config scripts from - http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess + http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD and - http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub + http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD If the version you run ($0) is already up to date, please send the following data and any information you think might be Modified: trunk/config.sub =================================================================== --- trunk/config.sub 2009-03-29 16:27:19 UTC (rev 213) +++ trunk/config.sub 2009-06-23 15:04:47 UTC (rev 214) @@ -1,10 +1,10 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, -# Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. -timestamp='2007-06-28' +timestamp='2008-01-16' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -12,7 +12,7 @@ # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or +# the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, @@ -21,7 +21,9 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, see . +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -70,8 +72,8 @@ version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -367,10 +369,14 @@ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ - | xstormy16-* | xtensa-* \ + | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-*) ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) @@ -441,6 +447,14 @@ basic_machine=ns32k-sequent os=-dynix ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; c90) basic_machine=c90-cray os=-unicos @@ -666,6 +680,14 @@ basic_machine=m68k-isi os=-sysv ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; m88k-omron*) basic_machine=m88k-omron ;; @@ -811,6 +833,14 @@ basic_machine=i860-intel os=-osf ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; pbd) basic_machine=sparc-tti ;; @@ -1019,6 +1049,10 @@ basic_machine=tic6x-unknown os=-coff ;; + tile*) + basic_machine=tile-unknown + os=-linux-gnu + ;; tx39) basic_machine=mipstx39-unknown ;; Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2009-03-29 16:27:19 UTC (rev 213) +++ trunk/configure.ac 2009-06-23 15:04:47 UTC (rev 214) @@ -50,6 +50,7 @@ AM_MAINTAINER_MODE AC_CONFIG_SRCDIR([src/err-sources.h.in]) AC_CONFIG_HEADER([config.h]) +AC_CONFIG_MACRO_DIR([m4]) # We need to know about the host architecture to avoid spurious # warnings. @@ -62,12 +63,13 @@ AC_PROG_CPP AC_PROG_AWK AC_CHECK_TOOL(AR, ar, :) -AC_LIBTOOL_WIN32_DLL -AC_LIBTOOL_RC AC_GNU_SOURCE -AC_PROG_LIBTOOL +LT_PREREQ([2.2.6]) +LT_INIT([win32-dll disable-static]) +LT_LANG([Windows Resource]) + # We need to compile and run a program on the build machine. dnl The AC_PROG_CC_FOR_BUILD macro in the AC archive is broken for dnl autoconf 2.57. Modified: trunk/install-sh =================================================================== --- trunk/install-sh 2009-03-29 16:27:19 UTC (rev 213) +++ trunk/install-sh 2009-06-23 15:04:47 UTC (rev 214) @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2005-05-14.22 +scriptversion=2006-12-25.00 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -39,38 +39,68 @@ # when there is no Makefile. # # This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. +# from scratch. +nl=' +' +IFS=" "" $nl" + # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" +doit=${DOITPROG-} +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi -# put in absolute paths if you don't have them in your path; or use env. vars. +# Put in absolute file names if you don't have them in your path; +# or use environment vars. -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} -chmodcmd="$chmodprog 0755" +posix_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog chowncmd= -chgrpcmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" stripcmd= -rmcmd="$rmprog -f" -mvcmd="$mvprog" + src= dst= dir_arg= -dstarg= +dst_arg= + +copy_on_change=false no_target_directory= -usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... @@ -80,81 +110,86 @@ In the 4th, create DIRECTORIES. Options: --c (ignored) --d create directories instead of installing files. --g GROUP $chgrpprog installed files to GROUP. --m MODE $chmodprog installed files to MODE. --o USER $chownprog installed files to USER. --s $stripprog installed files. --t DIRECTORY install into DIRECTORY. --T report an error if DSTFILE is a directory. ---help display this help and exit. ---version display version info and exit. + --help display this help and exit. + --version display version info and exit. + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG " -while test -n "$1"; do +while test $# -ne 0; do case $1 in - -c) shift - continue;; + -c) ;; - -d) dir_arg=true - shift - continue;; + -C) copy_on_change=true;; + -d) dir_arg=true;; + -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; + shift;; --help) echo "$usage"; exit $?;; - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; + -m) mode=$2 + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; -o) chowncmd="$chownprog $2" - shift - shift - continue;; + shift;; - -s) stripcmd=$stripprog - shift - continue;; + -s) stripcmd=$stripprog;; - -t) dstarg=$2 - shift - shift - continue;; + -t) dst_arg=$2 + shift;; - -T) no_target_directory=true - shift - continue;; + -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; - *) # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - test -n "$dir_arg$dstarg" && break - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dstarg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dstarg" - shift # fnord - fi - shift # arg - dstarg=$arg - done + --) shift break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; esac + shift done -if test -z "$1"; then +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + done +fi + +if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 @@ -164,24 +199,47 @@ exit 0 fi +if test -z "$dir_arg"; then + trap '(exit $?); exit' 1 2 13 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + for src do # Protect names starting with `-'. case $src in - -*) src=./$src ;; + -*) src=./$src;; esac if test -n "$dir_arg"; then dst=$src - src= + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else - if test -d "$dst"; then - mkdircmd=: - chmodcmd= - else - mkdircmd=$mkdirprog - fi - else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. @@ -190,71 +248,199 @@ exit 1 fi - if test -z "$dstarg"; then + if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi - dst=$dstarg + dst=$dst_arg # Protect names starting with `-'. case $dst in - -*) dst=./$dst ;; + -*) dst=./$dst;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then - echo "$0: $dstarg: Is a directory" >&2 + echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi - dst=$dst/`basename "$src"` + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? fi fi - # This sed command emulates the dirname command. - dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` + obsolete_mkdir_used=false - # Make sure that the destination directory exists. + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - # Skip lots of stat calls in the usual case. - if test ! -d "$dstdir"; then - defaultIFS=' - ' - IFS="${IFS-$defaultIFS}" + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac - oIFS=$IFS - # Some sh's can't handle IFS=/ for some reason. - IFS='%' - set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` - shift - IFS=$oIFS + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi - pathcomp= + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 - while test $# -ne 0 ; do - pathcomp=$pathcomp$1 + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writeable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + -*) prefix='./';; + *) prefix='';; + esac + + eval "$initialize_posix_glob" + + oIFS=$IFS + IFS=/ + $posix_glob set -f + set fnord $dstdir shift - if test ! -d "$pathcomp"; then - $mkdirprog "$pathcomp" - # mkdir can fail with a `File exist' error in case several - # install-sh are creating the directory concurrently. This - # is OK. - test -d "$pathcomp" || exit + $posix_glob set +f + IFS=$oIFS + + prefixes= + + for d + do + test -z "$d" && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true fi - pathcomp=$pathcomp/ - done + fi fi if test -n "$dir_arg"; then - $doit $mkdircmd "$dst" \ - && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } - + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else - dstfile=`basename "$dst"` # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ @@ -262,10 +448,9 @@ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - trap '(exit $?); exit' 1 2 13 15 # Copy the file name to the temp name. - $doit $cpprog "$src" "$dsttmp" && + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # @@ -273,48 +458,59 @@ # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && - # Now rename the file to the real destination. - { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ - || { - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - if test -f "$dstdir/$dstfile"; then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ - || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ - || { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit 1 - } - else - : - fi - } && + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" - } - } - fi || { (exit 1); exit 1; } + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi done -# The final little trick to "correctly" pass the exit status to the exit trap. -{ - (exit 0); exit 0 -} - # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" Modified: trunk/ltmain.sh =================================================================== --- trunk/ltmain.sh 2009-03-29 16:27:19 UTC (rev 213) +++ trunk/ltmain.sh 2009-06-23 15:04:47 UTC (rev 214) @@ -1,31 +1,175 @@ -# ltmain.sh - Provide generalized library-building support services. -# NOTE: Changing this file will not affect anything until you rerun configure. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# Originally by Gordon Matzigkeit , 1996 -# -# This program is free software; you can redistribute it and/or modify +# Generated from ltmain.m4sh. + +# ltmain.sh (GNU libtool) 2.2.6 +# Written by Gordon Matzigkeit , 1996 + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # -# This program is distributed in the hope that it will be useful, but +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, +# or obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# Usage: $progname [OPTION]... [MODE-ARG]... # -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. +# Provide generalized library-building support services. +# +# --config show all configuration variables +# --debug enable verbose shell tracing +# -n, --dry-run display commands without modifying any files +# --features display basic configuration information and exit +# --mode=MODE use operation mode MODE +# --preserve-dup-deps don't remove duplicate dependency libraries +# --quiet, --silent don't print informational messages +# --tag=TAG use configuration variables from tag TAG +# -v, --verbose print informational messages (default) +# --version print version information +# -h, --help print short or long help message +# +# MODE must be one of the following: +# +# clean remove files from the build directory +# compile compile a source file into a libtool object +# execute automatically set library path, then run a program +# finish complete the installation of libtool libraries +# install install libraries or executables +# link create a library or an executable +# uninstall remove libraries from an installed directory +# +# MODE-ARGS vary depending on the MODE. +# Try `$progname --help --mode=MODE' for a more detailed description of MODE. +# +# When reporting a bug, please describe a test case to reproduce it and +# include the following information: +# +# host-triplet: $host +# shell: $SHELL +# compiler: $LTCC +# compiler flags: $LTCFLAGS +# linker: $LD (gnu? $with_gnu_ld) +# $progname: (GNU libtool) 2.2.6 Debian-2.2.6a-1ubuntu1 +# automake: $automake_version +# autoconf: $autoconf_version +# +# Report bugs to . -basename="s,^.*/,,g" +PROGRAM=ltmain.sh +PACKAGE=libtool +VERSION="2.2.6 Debian-2.2.6a-1ubuntu1" +TIMESTAMP="" +package_revision=1.3012 +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# NLS nuisances: We save the old values to restore during execute mode. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +lt_user_locale= +lt_safe_locale= +for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES +do + eval "if test \"\${$lt_var+set}\" = set; then + save_$lt_var=\$$lt_var + $lt_var=C + export $lt_var + lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" + lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" + fi" +done + +$lt_unset CDPATH + + + + + +: ${CP="cp -f"} +: ${ECHO="echo"} +: ${EGREP="/bin/grep -E"} +: ${FGREP="/bin/grep -F"} +: ${GREP="/bin/grep"} +: ${LN_S="ln -s"} +: ${MAKE="make"} +: ${MKDIR="mkdir"} +: ${MV="mv -f"} +: ${RM="rm -f"} +: ${SED="/bin/sed"} +: ${SHELL="${CONFIG_SHELL-/bin/sh}"} +: ${Xsed="$SED -e 1s/^X//"} + +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 +EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. +EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. + +exit_status=$EXIT_SUCCESS + +# Make sure IFS has a sensible default +lt_nl=' +' +IFS=" $lt_nl" + +dirname="s,/[^/]*$,," +basename="s,^.*/,," + +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi + func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` +} + +# Generated shell functions inserted here. + # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special @@ -34,113 +178,175 @@ progpath="$0" # The name of this program: -progname=`echo "$progpath" | $SED $basename` -modename="$progname" +# In the unlikely event $progname began with a '-', it would play havoc with +# func_echo (imagine progname=-n), so we prepend ./ in that case: +func_dirname_and_basename "$progpath" +progname=$func_basename_result +case $progname in + -*) progname=./$progname ;; +esac -# Global variables: -EXIT_SUCCESS=0 -EXIT_FAILURE=1 +# Make sure we have an absolute path for reexecution: +case $progpath in + [\\/]*|[A-Za-z]:\\*) ;; + *[\\/]*) + progdir=$func_dirname_result + progdir=`cd "$progdir" && pwd` + progpath="$progdir/$progname" + ;; + *) + save_IFS="$IFS" + IFS=: + for progdir in $PATH; do + IFS="$save_IFS" + test -x "$progdir/$progname" && break + done + IFS="$save_IFS" + test -n "$progdir" || progdir=`pwd` + progpath="$progdir/$progname" + ;; +esac -PROGRAM=ltmain.sh -PACKAGE=libtool -VERSION="1.5.22 Debian 1.5.22-2" -TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed="${SED}"' -e 1s/^X//' +sed_quote_subst='s/\([`"$\\]\)/\\\1/g' -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes. -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' -# Check that we have a working $echo. -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then - # Yippee, $echo works! - : -else - # Restart under the correct shell, and then maybe $echo will work. - exec $SHELL "$progpath" --no-reexec ${1+"$@"} -fi +# Re-`\' parameter expansions in output of double_quote_subst that were +# `\'-ed in input to the same. If an odd number of `\' preceded a '$' +# in input to double_quote_subst, that '$' was protected from expansion. +# Since each input `\' is now two `\'s, look for any number of runs of +# four `\'s followed by two `\'s and then a '$'. `\' that '$'. +bs='\\' +bs2='\\\\' +bs4='\\\\\\\\' +dollar='\$' +sed_double_backslash="\ + s/$bs4/&\\ +/g + s/^$bs2$dollar/$bs&/ + s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g + s/\n//g" -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat <&2 +} -if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - $echo "$modename: not configured to build any kind of library" 1>&2 - $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit $EXIT_FAILURE -fi +# func_warning arg... +# Echo program name prefixed warning message to standard error. +func_warning () +{ + $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 -# Global variables. -mode=$default_mode -nonopt= -prev= -prevopt= -run= -show="$echo" -show_help= -execute_dlfiles= -duplicate_deps=no -preserve_args= -lo2o="s/\\.lo\$/.${objext}/" -o2lo="s/\\.${objext}\$/.lo/" + # bash bug again: + : +} -##################################### -# Shell function definitions: -# This seems to be the best place for them +# func_fatal_error arg... +# Echo program name prefixed message to standard error, and exit. +func_fatal_error () +{ + func_error ${1+"$@"} + exit $EXIT_FAILURE +} +# func_fatal_help arg... +# Echo program name prefixed message to standard error, followed by +# a help hint, and exit. +func_fatal_help () +{ + func_error ${1+"$@"} + func_fatal_error "$help" +} +help="Try \`$progname --help' for more information." ## default + + +# func_grep expression filename +# Check whether EXPRESSION matches any line of FILENAME, without output. +func_grep () +{ + $GREP "$1" "$2" >/dev/null 2>&1 +} + + +# func_mkdir_p directory-path +# Make sure the entire path to DIRECTORY-PATH is available. +func_mkdir_p () +{ + my_directory_path="$1" + my_dir_list= + + if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then + + # Protect directory names starting with `-' + case $my_directory_path in + -*) my_directory_path="./$my_directory_path" ;; + esac + + # While some portion of DIR does not yet exist... + while test ! -d "$my_directory_path"; do + # ...make a list in topmost first order. Use a colon delimited + # list incase some portion of path contains whitespace. + my_dir_list="$my_directory_path:$my_dir_list" + + # If the last portion added has no slash in it, the list is done + case $my_directory_path in */*) ;; *) break ;; esac + + # ...otherwise throw away the child directory and loop + my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"` + done + my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'` + + save_mkdir_p_IFS="$IFS"; IFS=':' + for my_dir in $my_dir_list; do + IFS="$save_mkdir_p_IFS" + # mkdir can fail with a `File exist' error if two processes + # try to create one of the directories concurrently. Don't + # stop in that case! + $MKDIR "$my_dir" 2>/dev/null || : + done + IFS="$save_mkdir_p_IFS" + + # Bail out if we (or some other process) failed to create a directory. + test -d "$my_directory_path" || \ + func_fatal_error "Failed to create \`$1'" + fi +} + + # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If @@ -149,7 +355,7 @@ { my_template="${TMPDIR-/tmp}/${1-$progname}" - if test "$run" = ":"; then + if test "$opt_dry_run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else @@ -158,469 +364,743 @@ my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then - # Failing that, at least try and use $RANDOM to avoid a race - my_tmpdir="${my_template}-${RANDOM-0}$$" + # Failing that, at least try and use $RANDOM to avoid a race + my_tmpdir="${my_template}-${RANDOM-0}$$" - save_mktempdir_umask=`umask` - umask 0077 - $mkdir "$my_tmpdir" - umask $save_mktempdir_umask + save_mktempdir_umask=`umask` + umask 0077 + $MKDIR "$my_tmpdir" + umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure - test -d "$my_tmpdir" || { - $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 - exit $EXIT_FAILURE - } + test -d "$my_tmpdir" || \ + func_fatal_error "cannot create temporary directory \`$my_tmpdir'" fi - $echo "X$my_tmpdir" | $Xsed + $ECHO "X$my_tmpdir" | $Xsed } -# func_win32_libid arg -# return the library type of file 'arg' -# -# Need a lot of goo to handle *both* DLLs and import libs -# Has to be a shell function in order to 'eat' the argument -# that is supplied when $file_magic_command is called. -func_win32_libid () +# func_quote_for_eval arg +# Aesthetically quote ARG to be evaled later. +# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT +# is double-quoted, suitable for a subsequent eval, whereas +# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters +# which are still active within double quotes backslashified. +func_quote_for_eval () { - win32_libid_type="unknown" - win32_fileres=`file -L $1 2>/dev/null` - case $win32_fileres in - *ar\ archive\ import\ library*) # definitely import - win32_libid_type="x86 archive import" - ;; - *ar\ archive*) # could be an import, or static - if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ - $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then - win32_nmres=`eval $NM -f posix -A $1 | \ - $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` - case $win32_nmres in - import*) win32_libid_type="x86 archive import";; - *) win32_libid_type="x86 archive static";; - esac - fi - ;; - *DLL*) - win32_libid_type="x86 DLL" - ;; - *executable*) # but shell scripts are "executable" too... - case $win32_fileres in - *MS\ Windows\ PE\ Intel*) - win32_libid_type="x86 DLL" - ;; + case $1 in + *[\\\`\"\$]*) + func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;; + *) + func_quote_for_eval_unquoted_result="$1" ;; esac - ;; - esac - $echo $win32_libid_type + + case $func_quote_for_eval_unquoted_result in + # Double-quote args containing shell metacharacters to delay + # word splitting, command substitution and and variable + # expansion for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" + ;; + *) + func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" + esac } -# func_infer_tag arg -# Infer tagged configuration to use if any are available and -# if one wasn't chosen via the "--tag" command line option. -# Only attempt this if the compiler in the base compile -# command doesn't match the default compiler. -# arg is usually of the form 'gcc ...' -func_infer_tag () +# func_quote_for_expand arg +# Aesthetically quote ARG to be evaled later; same as above, +# but do not quote variable references. +func_quote_for_expand () { From cvs at cvs.gnupg.org Wed Jun 24 16:01:21 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 24 Jun 2009 16:01:21 +0200 Subject: [svn] GnuPG - r5050 - in branches/STABLE-BRANCH-1-4: g10 keyserver Message-ID: Author: wk Date: 2009-06-24 16:01:20 +0200 (Wed, 24 Jun 2009) New Revision: 5050 Modified: branches/STABLE-BRANCH-1-4/g10/ChangeLog branches/STABLE-BRANCH-1-4/g10/passphrase.c branches/STABLE-BRANCH-1-4/g10/revoke.c branches/STABLE-BRANCH-1-4/keyserver/ChangeLog branches/STABLE-BRANCH-1-4/keyserver/gpgkeys_ldap.c Log: Fix a couple of minor bugs. Modified: branches/STABLE-BRANCH-1-4/g10/ChangeLog =================================================================== --- branches/STABLE-BRANCH-1-4/g10/ChangeLog 2009-06-17 11:57:24 UTC (rev 5049) +++ branches/STABLE-BRANCH-1-4/g10/ChangeLog 2009-06-24 14:01:20 UTC (rev 5050) @@ -1,3 +1,8 @@ +2009-06-24 Werner Koch + + * passphrase.c (passphrase_to_dek): Do not deref a PW of NULL. + * revoke.c (gen_revoke): Remove unused malloc of PK. + 2009-06-17 Werner Koch * parse-packet.c (parse): Use a casted -1 instead of a 32 bit Modified: branches/STABLE-BRANCH-1-4/keyserver/ChangeLog =================================================================== --- branches/STABLE-BRANCH-1-4/keyserver/ChangeLog 2009-06-17 11:57:24 UTC (rev 5049) +++ branches/STABLE-BRANCH-1-4/keyserver/ChangeLog 2009-06-24 14:01:20 UTC (rev 5050) @@ -1,3 +1,8 @@ +2009-06-24 Werner Koch + + * gpgkeys_ldap.c (send_key): Do not loop over a NULL modlist in + fail. Reported by Fabian Keil. + 2009-06-09 David Shaw * Makefile.am (gpgkeys_hkp_LDADD): Need DNSLIBS for the resolver Modified: branches/STABLE-BRANCH-1-4/g10/passphrase.c =================================================================== --- branches/STABLE-BRANCH-1-4/g10/passphrase.c 2009-06-17 11:57:24 UTC (rev 5049) +++ branches/STABLE-BRANCH-1-4/g10/passphrase.c 2009-06-24 14:01:20 UTC (rev 5050) @@ -1003,7 +1003,7 @@ get_last_passphrase(). */ dek = xmalloc_secure_clear ( sizeof *dek ); dek->algo = cipher_algo; - if( !*pw && mode == 2 ) + if( (!pw || !*pw) && mode == 2 ) dek->keylen = 0; else hash_passphrase( dek, pw, s2k, mode==2 ); Modified: branches/STABLE-BRANCH-1-4/g10/revoke.c =================================================================== --- branches/STABLE-BRANCH-1-4/g10/revoke.c 2009-06-17 11:57:24 UTC (rev 5049) +++ branches/STABLE-BRANCH-1-4/g10/revoke.c 2009-06-24 14:01:20 UTC (rev 5050) @@ -488,8 +488,6 @@ keyid_from_sk( sk, sk_keyid ); print_seckey_info (sk); - pk = xmalloc_clear( sizeof *pk ); - /* FIXME: We should get the public key direct from the secret one */ pub_keyblock=get_pubkeyblock(sk_keyid); Modified: branches/STABLE-BRANCH-1-4/keyserver/gpgkeys_ldap.c =================================================================== --- branches/STABLE-BRANCH-1-4/keyserver/gpgkeys_ldap.c 2009-06-17 11:57:24 UTC (rev 5049) +++ branches/STABLE-BRANCH-1-4/keyserver/gpgkeys_ldap.c 2009-06-24 14:01:20 UTC (rev 5050) @@ -777,13 +777,16 @@ fail: /* Unwind and free the whole modlist structure */ - for(ml=modlist;*ml;ml++) + if (modlist) { - free_mod_values(*ml); - free(*ml); + for(ml=modlist;*ml;ml++) + { + free_mod_values(*ml); + free(*ml); + } + free(modlist); } - free(modlist); free(addlist); free(dn); free(key); From cvs at cvs.gnupg.org Wed Jun 24 16:03:10 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed, 24 Jun 2009 16:03:10 +0200 Subject: [svn] GnuPG - r5051 - in trunk: . agent common g10 kbx keyserver sm Message-ID: Author: wk Date: 2009-06-24 16:03:09 +0200 (Wed, 24 Jun 2009) New Revision: 5051 Modified: trunk/THANKS trunk/agent/ChangeLog trunk/agent/genkey.c trunk/agent/protect.c trunk/common/ChangeLog trunk/common/estream.c trunk/common/sexputil.c trunk/common/xreadline.c trunk/g10/ChangeLog trunk/g10/call-agent.c trunk/g10/card-util.c trunk/g10/keyedit.c trunk/g10/keyring.c trunk/g10/parse-packet.c trunk/g10/passphrase.c trunk/g10/revoke.c trunk/kbx/keybox-search.c trunk/keyserver/ChangeLog trunk/keyserver/gpgkeys_ldap.c trunk/sm/ChangeLog trunk/sm/call-dirmngr.c trunk/sm/certreqgen.c trunk/sm/sign.c Log: Fixed a bunch of little bugs as reported by Fabian Keil. Still one problem left; marked with a gcc #warning. Modified: trunk/agent/ChangeLog =================================================================== --- trunk/agent/ChangeLog 2009-06-24 14:01:20 UTC (rev 5050) +++ trunk/agent/ChangeLog 2009-06-24 14:03:09 UTC (rev 5051) @@ -1,3 +1,9 @@ +2009-06-24 Werner Koch + + * genkey.c (agent_protect_and_store): Return RC and not 0. + * protect.c (do_encryption): Fix ignored error code from malloc. + Reported by Fabian Keil. + 2009-06-17 Werner Koch * call-pinentry.c (agent_get_confirmation): Add arg WITH_CANCEL. Modified: trunk/common/ChangeLog =================================================================== --- trunk/common/ChangeLog 2009-06-24 14:01:20 UTC (rev 5050) +++ trunk/common/ChangeLog 2009-06-24 14:03:09 UTC (rev 5051) @@ -1,3 +1,13 @@ +2009-06-24 Werner Koch + + * estream.c (es_read_line): In the malloc error case, set + MAX_LENGTH to 0 only if requested. + * xreadline.c (read_line): Ditto. + * estream.c (es_write_sanitized_utf8_buffer): Pass on error from + es_fputs. + * sexputil.c (get_rsa_pk_from_canon_sexp): Check for error after + the loop. Reported by Fabian Keil. + 2009-06-03 Werner Koch * estream.c (es_convert_mode): Rewrite and support the "x" flag. Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2009-06-24 14:01:20 UTC (rev 5050) +++ trunk/g10/ChangeLog 2009-06-24 14:03:09 UTC (rev 5051) @@ -1,3 +1,15 @@ +2009-06-24 Werner Koch + + * keyedit.c (menu_select_key): Renmove dead assign to I. + (menu_select_uid): Ditto. + * keyring.c (keyring_search): Remove dead assign to NAME. + * card-util.c (card_edit): Remove useless DID_CHECKPIN. + * call-agent.c (unhexify_fpr): Remove dead op on N. + * passphrase.c (passphrase_to_dek_ext): Do not deref a NULL PW. + * revoke.c (gen_revoke): Remove unused malloc of PK. + * parse-packet.c (mpi_read): Init NREAD. + Reported by Fabian Keil. + 2009-06-17 Werner Koch * parse-packet.c (parse): Use a casted -1 instead of a 32 bit Modified: trunk/keyserver/ChangeLog =================================================================== --- trunk/keyserver/ChangeLog 2009-06-24 14:01:20 UTC (rev 5050) +++ trunk/keyserver/ChangeLog 2009-06-24 14:03:09 UTC (rev 5051) @@ -1,3 +1,8 @@ +2009-06-24 Werner Koch + + * gpgkeys_ldap.c (send_key): Do not deep free a NULL modlist. + Reported by Fabian Keil. + 2009-05-28 David Shaw From 1.4: Modified: trunk/sm/ChangeLog =================================================================== --- trunk/sm/ChangeLog 2009-06-24 14:01:20 UTC (rev 5050) +++ trunk/sm/ChangeLog 2009-06-24 14:03:09 UTC (rev 5051) @@ -1,3 +1,10 @@ +2009-06-24 Werner Koch + + * call-dirmngr.c (pattern_from_strlist): Remove dead assignment of N. + * sign.c (gpgsm_sign): Remove dead assignment. + * certreqgen.c (create_request): Assign GPG_ERR_BUG to RC. + Reported by Fabian Keil. + 2009-05-27 Werner Koch * encrypt.c (encrypt_dek): Make use of make_canon_sexp. Modified: trunk/THANKS =================================================================== --- trunk/THANKS 2009-06-24 14:01:20 UTC (rev 5050) +++ trunk/THANKS 2009-06-24 14:03:09 UTC (rev 5051) @@ -75,6 +75,7 @@ Enzo Michelangeli em at MailAndNews.com Ernst Molitor ernst.molitor at uni-bonn.de Evgeny Legerov +Fabian Keil fk at fabiankeil de Fabio Coatti cova at ferrara.linux.it Felix von Leitner leitner at amdiv.de fish stiqz fish at analog.org Modified: trunk/agent/genkey.c =================================================================== --- trunk/agent/genkey.c 2009-06-24 14:01:20 UTC (rev 5050) +++ trunk/agent/genkey.c 2009-06-24 14:03:09 UTC (rev 5051) @@ -480,5 +480,5 @@ rc = store_key (s_skey, pi? pi->pin:NULL, 1); xfree (pi); - return 0; + return rc; } Modified: trunk/agent/protect.c =================================================================== --- trunk/agent/protect.c 2009-06-24 14:01:20 UTC (rev 5050) +++ trunk/agent/protect.c 2009-06-24 14:03:09 UTC (rev 5051) @@ -176,8 +176,11 @@ iv = xtrymalloc (blklen*2+8); if (!iv) rc = gpg_error (GPG_ERR_ENOMEM); - gcry_create_nonce (iv, blklen*2+8); - rc = gcry_cipher_setiv (hd, iv, blklen); + else + { + gcry_create_nonce (iv, blklen*2+8); + rc = gcry_cipher_setiv (hd, iv, blklen); + } } if (!rc) { Modified: trunk/common/estream.c =================================================================== --- trunk/common/estream.c 2009-06-24 14:01:20 UTC (rev 5050) +++ trunk/common/estream.c 2009-06-24 14:03:09 UTC (rev 5051) @@ -450,8 +450,8 @@ if (!mem_cookie->flags.grow) { - /* We are not alloew to grow, thus limit the size to the left - space. FIXME: Does the grow flag an its semtics make sense + /* We are not allowed to grow, thus limit the size to the left + space. FIXME: Does the grow flag and its sematics make sense at all? */ if (size > mem_cookie->memory_size - mem_cookie->offset) size = mem_cookie->memory_size - mem_cookie->offset; @@ -463,7 +463,7 @@ size_t newsize; newsize = mem_cookie->memory_size + mem_cookie->block_size; - +#warning READ the code and see how it should work newsize = mem_cookie->offset + size; if (newsize < mem_cookie->offset) { @@ -2797,7 +2797,9 @@ { int save_errno = errno; mem_free (buffer); - *length_of_buffer = *max_length = 0; + *length_of_buffer = 0; + if (max_length) + *max_length = 0; ESTREAM_UNLOCK (stream); errno = save_errno; return -1; @@ -3203,7 +3205,7 @@ *bytes_written = strlen (buf); ret = es_fputs (buf, stream); xfree (buf); - return i; + return rt == EOF? ret : (int)i; } else return es_write_sanitized (stream, p, length, delimiters, bytes_written); Modified: trunk/common/sexputil.c =================================================================== --- trunk/common/sexputil.c 2009-06-24 14:01:20 UTC (rev 5050) +++ trunk/common/sexputil.c 2009-06-24 14:03:09 UTC (rev 5051) @@ -377,6 +377,9 @@ return err; } + if (err) + return err; + if (!rsa_n || !rsa_n_len || !rsa_e || !rsa_e_len) return gpg_error (GPG_ERR_BAD_PUBKEY); Modified: trunk/common/xreadline.c =================================================================== --- trunk/common/xreadline.c 2009-06-24 14:01:20 UTC (rev 5050) +++ trunk/common/xreadline.c 2009-06-24 14:03:09 UTC (rev 5051) @@ -95,7 +95,9 @@ { int save_errno = errno; xfree (buffer); - *length_of_buffer = *max_length = 0; + *length_of_buffer = 0; + if (max_length) + *max_length = 0; errno = save_errno; return -1; } Modified: trunk/g10/call-agent.c =================================================================== --- trunk/g10/call-agent.c 2009-06-24 14:01:20 UTC (rev 5050) +++ trunk/g10/call-agent.c 2009-06-24 14:03:09 UTC (rev 5051) @@ -132,7 +132,6 @@ ; if (*s || (n != 40)) return 0; /* no fingerprint (invalid or wrong length). */ - n /= 2; for (s=hexstr, n=0; *s; s += 2, n++) fpr[n] = xtoi_2 (s); return 1; /* okay */ Modified: trunk/g10/card-util.c =================================================================== --- trunk/g10/card-util.c 2009-06-24 14:01:20 UTC (rev 5050) +++ trunk/g10/card-util.c 2009-06-24 14:03:09 UTC (rev 5051) @@ -1600,7 +1600,7 @@ int have_commands = !!commands; int redisplay = 1; char *answer = NULL; - int did_checkpin = 0, allow_admin=0; + int allow_admin=0; char serialnobuf[50]; @@ -1812,12 +1812,10 @@ case cmdPASSWD: change_pin (0, allow_admin); - did_checkpin = 0; /* Need to reset it of course. */ break; case cmdUNBLOCK: change_pin (1, allow_admin); - did_checkpin = 0; /* Need to reset it of course. */ break; case cmdQUIT: Modified: trunk/g10/keyedit.c =================================================================== --- trunk/g10/keyedit.c 2009-06-24 14:01:20 UTC (rev 5050) +++ trunk/g10/keyedit.c 2009-06-24 14:03:09 UTC (rev 5051) @@ -4458,7 +4458,7 @@ } } else { /* reset all */ - for( i=0, node = keyblock; node; node = node->next ) { + for (node = keyblock; node; node = node->next) { if( node->pkt->pkttype == PKT_USER_ID ) node->flag &= ~NODFLG_SELUID; } @@ -4543,7 +4543,7 @@ } } else { /* reset all */ - for( i=0, node = keyblock; node; node = node->next ) { + for ( node = keyblock; node; node = node->next ) { if( node->pkt->pkttype == PKT_PUBLIC_SUBKEY || node->pkt->pkttype == PKT_SECRET_SUBKEY ) node->flag &= ~NODFLG_SELKEY; Modified: trunk/g10/keyring.c =================================================================== --- trunk/g10/keyring.c 2009-06-24 14:01:20 UTC (rev 5050) +++ trunk/g10/keyring.c 2009-06-24 14:03:09 UTC (rev 5051) @@ -997,7 +997,7 @@ hd->word_match.name = xstrdup (name); hd->word_match.pattern = prepare_word_match (name); } - name = hd->word_match.pattern; + /* name = hd->word_match.pattern; */ } init_packet(&pkt); Modified: trunk/g10/parse-packet.c =================================================================== --- trunk/g10/parse-packet.c 2009-06-24 14:01:20 UTC (rev 5050) +++ trunk/g10/parse-packet.c 2009-06-24 14:03:09 UTC (rev 5051) @@ -112,7 +112,7 @@ int c, c1, c2, i; unsigned int nbits, nbytes; - size_t nread; + size_t nread = 0; gcry_mpi_t a = NULL; byte *buf = NULL; byte *p; Modified: trunk/g10/passphrase.c =================================================================== --- trunk/g10/passphrase.c 2009-06-24 14:01:20 UTC (rev 5050) +++ trunk/g10/passphrase.c 2009-06-24 14:03:09 UTC (rev 5051) @@ -600,7 +600,7 @@ get_last_passphrase(). */ dek = xmalloc_secure_clear ( sizeof *dek ); dek->algo = cipher_algo; - if ( !*pw && (mode == 2 || mode == 4)) + if ( (!pw || !*pw) && (mode == 2 || mode == 4)) dek->keylen = 0; else hash_passphrase (dek, pw, s2k); Modified: trunk/g10/revoke.c =================================================================== --- trunk/g10/revoke.c 2009-06-24 14:01:20 UTC (rev 5050) +++ trunk/g10/revoke.c 2009-06-24 14:03:09 UTC (rev 5051) @@ -489,8 +489,6 @@ keyid_from_sk( sk, sk_keyid ); print_seckey_info (sk); - pk = xmalloc_clear( sizeof *pk ); - /* FIXME: We should get the public key direct from the secret one */ pub_keyblock=get_pubkeyblock(sk_keyid); Modified: trunk/kbx/keybox-search.c =================================================================== --- trunk/kbx/keybox-search.c 2009-06-24 14:01:20 UTC (rev 5050) +++ trunk/kbx/keybox-search.c 2009-06-24 14:03:09 UTC (rev 5051) @@ -739,6 +739,8 @@ } } + (void)need_words; /* Not yet implemented. */ + if (!hd->fp) { hd->fp = fopen (hd->kb->fname, "rb"); Modified: trunk/keyserver/gpgkeys_ldap.c =================================================================== --- trunk/keyserver/gpgkeys_ldap.c 2009-06-24 14:01:20 UTC (rev 5050) +++ trunk/keyserver/gpgkeys_ldap.c 2009-06-24 14:03:09 UTC (rev 5051) @@ -771,14 +771,16 @@ ret=KEYSERVER_OK; fail: - /* Unwind and free the whole modlist structure */ - for(ml=modlist;*ml;ml++) + if (modlist) { - free_mod_values(*ml); - free(*ml); + /* Unwind and free the whole modlist structure */ + for(ml=modlist;*ml;ml++) + { + free_mod_values(*ml); + free(*ml); + } + free(modlist); } - - free(modlist); free(addlist); free(dn); free(key); Modified: trunk/sm/call-dirmngr.c =================================================================== --- trunk/sm/call-dirmngr.c 2009-06-24 14:01:20 UTC (rev 5050) +++ trunk/sm/call-dirmngr.c 2009-06-24 14:03:09 UTC (rev 5051) @@ -747,7 +747,7 @@ if (!pattern) return NULL; - for (n=0, sl=names; sl; sl = sl->next) + for (sl=names; sl; sl = sl->next) { for (s=sl->d; *s; s++) { Modified: trunk/sm/certreqgen.c =================================================================== --- trunk/sm/certreqgen.c 2009-06-24 14:01:20 UTC (rev 5050) +++ trunk/sm/certreqgen.c 2009-06-24 14:03:09 UTC (rev 5051) @@ -769,7 +769,7 @@ if (!n) { log_error ("libksba did not return a proper S-Exp\n"); - err = gpg_error (GPG_ERR_BUG); + rc = gpg_error (GPG_ERR_BUG); goto leave; } rc = gcry_sexp_sscan (&s_pkey, NULL, (const char*)public, n); Modified: trunk/sm/sign.c =================================================================== --- trunk/sm/sign.c 2009-06-24 14:01:20 UTC (rev 5050) +++ trunk/sm/sign.c 2009-06-24 14:03:09 UTC (rev 5051) @@ -403,7 +403,7 @@ log_info ("user requested hash algorithm %d\n", opt.forced_digest_algo); for (i=0, cl=signerlist; cl; cl = cl->next, i++) { - const char *oid = ksba_cert_get_digest_algo (cl->cert); + const char *oid; if (opt.forced_digest_algo) { From cvs at cvs.gnupg.org Thu Jun 25 16:10:15 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Thu, 25 Jun 2009 16:10:15 +0200 Subject: [svn] GnuPG - r5052 - trunk/common Message-ID: Author: wk Date: 2009-06-25 16:10:14 +0200 (Thu, 25 Jun 2009) New Revision: 5052 Modified: trunk/common/ChangeLog trunk/common/estream.c Log: Fixed stupid typo. Modified: trunk/common/ChangeLog =================================================================== --- trunk/common/ChangeLog 2009-06-24 14:03:09 UTC (rev 5051) +++ trunk/common/ChangeLog 2009-06-25 14:10:14 UTC (rev 5052) @@ -1,3 +1,7 @@ +2009-06-25 Werner Koch + + * estream.c (es_write_sanitized_utf8_buffer): Typo fix. + 2009-06-24 Werner Koch * estream.c (es_read_line): In the malloc error case, set Modified: trunk/common/estream.c =================================================================== --- trunk/common/estream.c 2009-06-24 14:03:09 UTC (rev 5051) +++ trunk/common/estream.c 2009-06-25 14:10:14 UTC (rev 5052) @@ -3205,7 +3205,7 @@ *bytes_written = strlen (buf); ret = es_fputs (buf, stream); xfree (buf); - return rt == EOF? ret : (int)i; + return rc == EOF? ret : (int)i; } else return es_write_sanitized (stream, p, length, delimiters, bytes_written); From cvs at cvs.gnupg.org Mon Jun 29 10:54:19 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Mon, 29 Jun 2009 10:54:19 +0200 Subject: [svn] GnuPG - r5053 - trunk/common Message-ID: Author: wk Date: 2009-06-29 10:54:18 +0200 (Mon, 29 Jun 2009) New Revision: 5053 Modified: trunk/common/ChangeLog trunk/common/estream.c Log: The variable is called RET and not RC. Modified: trunk/common/ChangeLog =================================================================== --- trunk/common/ChangeLog 2009-06-25 14:10:14 UTC (rev 5052) +++ trunk/common/ChangeLog 2009-06-29 08:54:18 UTC (rev 5053) @@ -1,3 +1,7 @@ +2009-06-29 Werner Koch + + * estream.c (es_write_sanitized_utf8_buffer): Typo typo fix. + 2009-06-25 Werner Koch * estream.c (es_write_sanitized_utf8_buffer): Typo fix. @@ -12,6 +16,11 @@ * sexputil.c (get_rsa_pk_from_canon_sexp): Check for error after the loop. Reported by Fabian Keil. +2009-06-22 Werner Koch + + * estream.c (es_pth_read, es_pth_write) [W32]: New. + (ESTREAM_SYS_READ, ESTREAM_SYS_WRITE) [HAVE_PTH]: Use them. + 2009-06-03 Werner Koch * estream.c (es_convert_mode): Rewrite and support the "x" flag. Modified: trunk/common/estream.c =================================================================== --- trunk/common/estream.c 2009-06-25 14:10:14 UTC (rev 5052) +++ trunk/common/estream.c 2009-06-29 08:54:18 UTC (rev 5053) @@ -138,8 +138,8 @@ /* Primitive system I/O. */ #ifdef HAVE_PTH -# define ESTREAM_SYS_READ pth_read -# define ESTREAM_SYS_WRITE pth_write +# define ESTREAM_SYS_READ es_pth_read +# define ESTREAM_SYS_WRITE es_pth_write #else # define ESTREAM_SYS_READ read # define ESTREAM_SYS_WRITE write @@ -231,7 +231,7 @@ while (0) -/* Malloc wrappers to overcvome problems on some older OSes. */ +/* Malloc wrappers to overcome problems on some older OSes. */ static void * mem_alloc (size_t n) { @@ -325,8 +325,47 @@ return ret; } + +/* + * I/O Helper + * + * Unfortunately our Pth emulation for Windows expects system handles + * for pth_read and pth_write. We use a simple approach to fix this: + * If the function returns an error we fall back to a vanilla read or + * write, assuming that we do I/O on a plain file where the operation + * can't block. + */ +#ifdef HAVE_PTH +static int +es_pth_read (int fd, void *buffer, size_t size) +{ +# ifdef HAVE_W32_SYSTEM + int rc = pth_read (fd, buffer, size); + if (rc == -1 && errno == EINVAL) + rc = read (fd, buffer, size); + return rc; +# else /*!HAVE_W32_SYSTEM*/ + return pth_read (fd, buffer, size); +# endif /* !HAVE_W32_SYSTEM*/ +} +static int +es_pth_write (int fd, const void *buffer, size_t size) +{ +# ifdef HAVE_W32_SYSTEM + int rc = pth_write (fd, buffer, size); + if (rc == -1 && errno == EINVAL) + rc = write (fd, buffer, size); + return rc; +# else /*!HAVE_W32_SYSTEM*/ + return pth_write (fd, buffer, size); +# endif /* !HAVE_W32_SYSTEM*/ +} +#endif /*HAVE_PTH*/ + + + /* * Initialization. */ @@ -3205,7 +3244,7 @@ *bytes_written = strlen (buf); ret = es_fputs (buf, stream); xfree (buf); - return rc == EOF? ret : (int)i; + return ret == EOF? ret : (int)i; } else return es_write_sanitized (stream, p, length, delimiters, bytes_written); From cvs at cvs.gnupg.org Mon Jun 29 12:43:57 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Mon, 29 Jun 2009 12:43:57 +0200 Subject: [svn] GnuPG - r5054 - in trunk: . common scd Message-ID: Author: wk Date: 2009-06-29 12:43:57 +0200 (Mon, 29 Jun 2009) New Revision: 5054 Modified: trunk/ChangeLog trunk/README.maint trunk/common/ChangeLog trunk/common/estream.c trunk/configure.ac trunk/scd/ChangeLog trunk/scd/apdu.c trunk/scd/app-openpgp.c Log: Reworked the estream memory buffer allocation. Committed already posted patches for the v2 card. Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-06-29 08:54:18 UTC (rev 5053) +++ trunk/ChangeLog 2009-06-29 10:43:57 UTC (rev 5054) @@ -1,3 +1,12 @@ +2009-06-29 Werner Koch + + * configure.ac: Take care of --without-adns. Suggested by + Arfrever Frehtes Taifersar Arahesis. + +2009-06-17 Werner Koch + + Released 2.0.12. + 2009-06-05 David Shaw * configure.ac: Remove Camellia restriction. Modified: trunk/common/ChangeLog =================================================================== --- trunk/common/ChangeLog 2009-06-29 08:54:18 UTC (rev 5053) +++ trunk/common/ChangeLog 2009-06-29 10:43:57 UTC (rev 5054) @@ -1,5 +1,8 @@ 2009-06-29 Werner Koch + * estream.c (BUFFER_ROUND_TO_BLOCK): Remove unused macro. + (es_func_mem_write): Rewrite reallocation part. + * estream.c (es_write_sanitized_utf8_buffer): Typo typo fix. 2009-06-25 Werner Koch Modified: trunk/scd/ChangeLog =================================================================== --- trunk/scd/ChangeLog 2009-06-29 08:54:18 UTC (rev 5053) +++ trunk/scd/ChangeLog 2009-06-29 10:43:57 UTC (rev 5054) @@ -1,3 +1,8 @@ +2009-06-18 Werner Koch + + * app-openpgp.c (verify_chv2): Remove special case for v2 cards. + (get_public_key): Use extended mode. + 2009-06-17 Werner Koch * iso7816.c (iso7816_get_data): Add arg EXTENDED_MODE. Change all Modified: trunk/README.maint =================================================================== --- trunk/README.maint 2009-06-29 08:54:18 UTC (rev 5053) +++ trunk/README.maint 2009-06-29 10:43:57 UTC (rev 5054) @@ -25,6 +25,7 @@ * Run "make -C po update-po". * Write NEWS entries and set the release date in NEWS. * In configure.ac set "my_issvn" to "no". + * Put a "Released " line into the top level ChangeLog. * Commit all changes to the SVN. * Update the SVN then (to sync the release number of all files). * Run "./autogen.sh --force" Modified: trunk/common/estream.c =================================================================== --- trunk/common/estream.c 2009-06-29 08:54:18 UTC (rev 5053) +++ trunk/common/estream.c 2009-06-29 10:43:57 UTC (rev 5054) @@ -1,5 +1,5 @@ /* estream.c - Extended Stream I/O Library - * Copyright (C) 2004, 2005, 2006, 2007 g10 Code GmbH + * Copyright (C) 2004, 2005, 2006, 2007, 2009 g10 Code GmbH * * This file is part of Libestream. * @@ -91,12 +91,6 @@ -/* Macros. */ - -#define BUFFER_ROUND_TO_BLOCK(size, block_size) \ - - - /* Locking. */ #ifdef HAVE_PTH @@ -400,11 +394,11 @@ { unsigned int modeflags; /* Open flags. */ unsigned char *memory; /* Allocated data buffer. */ - size_t memory_size; /* Allocated size of memory. */ - size_t memory_limit; /* Maximum allowed allocation size or - 0 for no limit. */ + size_t memory_size; /* Allocated size of MEMORY. */ + size_t memory_limit; /* Caller supplied maximum allowed + allocation size or 0 for no limit. */ size_t offset; /* Current offset in MEMORY. */ - size_t data_len; /* Length of data in MEMORY. */ + size_t data_len; /* Used length of data in MEMORY. */ size_t block_size; /* Block size. */ struct { unsigned int grow: 1; /* MEMORY is allowed to grow. */ @@ -414,7 +408,11 @@ } *estream_cookie_mem_t; -/* Create function for memory objects. */ +/* Create function for memory objects. DATA is either NULL or a user + supplied buffer with the initial conetnt of the memory buffer. If + DATA is NULL, DATA_N and DATA_LEN need to be 0 as well. If DATA is + not NULL, DATA_N gives the allocated size of DATA and DATA_LEN the + used length in DATA. */ static int es_func_mem_create (void *ES__RESTRICT *ES__RESTRICT cookie, unsigned char *ES__RESTRICT data, size_t data_n, @@ -427,6 +425,12 @@ estream_cookie_mem_t mem_cookie; int err; + if (!data && (data_n || data_len)) + { + errno = EINVAL; + return -1; + } + mem_cookie = mem_alloc (sizeof (*mem_cookie)); if (!mem_cookie) err = -1; @@ -477,6 +481,7 @@ { estream_cookie_mem_t mem_cookie = cookie; ssize_t ret; + size_t nleft; if (!size) return 0; /* A flush is a NOP for memory objects. */ @@ -486,38 +491,45 @@ /* Append to data. */ mem_cookie->offset = mem_cookie->data_len; } - - if (!mem_cookie->flags.grow) - { - /* We are not allowed to grow, thus limit the size to the left - space. FIXME: Does the grow flag and its sematics make sense - at all? */ - if (size > mem_cookie->memory_size - mem_cookie->offset) - size = mem_cookie->memory_size - mem_cookie->offset; - } - if (size > (mem_cookie->memory_size - mem_cookie->offset)) + assert (mem_cookie->memory_size >= mem_cookie->offset); + nleft = mem_cookie->memory_size - mem_cookie->offset; + + /* If we are not allowed to grow limit the size to the left space. */ + if (!mem_cookie->flags.grow && size > nleft) + size = nleft; + + /* Enlarge the memory buffer if needed. */ + if (size > nleft) { unsigned char *newbuf; size_t newsize; - - newsize = mem_cookie->memory_size + mem_cookie->block_size; -#warning READ the code and see how it should work - newsize = mem_cookie->offset + size; + + if (!mem_cookie->memory_size) + newsize = size; /* Not yet allocated. */ + else + newsize = mem_cookie->memory_size + (nleft - size); if (newsize < mem_cookie->offset) { errno = EINVAL; return -1; } - newsize += mem_cookie->block_size - 1; - if (newsize < mem_cookie->offset) + + /* Round up to the next block length. BLOCK_SIZE should always + be set; we check anyway. */ + if (mem_cookie->block_size) { - errno = EINVAL; - return -1; + newsize += mem_cookie->block_size - 1; + if (newsize < mem_cookie->offset) + { + errno = EINVAL; + return -1; + } + newsize /= mem_cookie->block_size; + newsize *= mem_cookie->block_size; } - newsize /= mem_cookie->block_size; - newsize *= mem_cookie->block_size; - + + /* Check for a total limit. */ if (mem_cookie->memory_limit && newsize > mem_cookie->memory_limit) { errno = ENOSPC; @@ -530,8 +542,11 @@ mem_cookie->memory = newbuf; mem_cookie->memory_size = newsize; + + assert (mem_cookie->memory_size >= mem_cookie->offset); + nleft = mem_cookie->memory_size - mem_cookie->offset; - assert (!(size > (mem_cookie->memory_size - mem_cookie->offset))); + assert (size <= nleft); } memcpy (mem_cookie->memory + mem_cookie->offset, buffer, size); @@ -579,7 +594,6 @@ { errno = ENOSPC; return -1; - } newsize = pos_new + mem_cookie->block_size - 1; @@ -590,6 +604,7 @@ } newsize /= mem_cookie->block_size; newsize *= mem_cookie->block_size; + if (mem_cookie->memory_limit && newsize > mem_cookie->memory_limit) { errno = ENOSPC; Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2009-06-29 08:54:18 UTC (rev 5053) +++ trunk/configure.ac 2009-06-29 10:43:57 UTC (rev 5054) @@ -820,11 +820,13 @@ CPPFLAGS="${CPPFLAGS} -I$withval/include" LDFLAGS="${LDFLAGS} -L$withval/lib" fi]) -AC_CHECK_HEADERS(adns.h, +if test "$with_adns" != "no"; then + AC_CHECK_HEADERS(adns.h, AC_CHECK_LIB(adns, adns_init, [have_adns=yes], [CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}]), [CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}]) +fi if test "$have_adns" = "yes"; then ADNSLIBS="-ladns" fi Modified: trunk/scd/apdu.c =================================================================== --- trunk/scd/apdu.c 2009-06-29 08:54:18 UTC (rev 5053) +++ trunk/scd/apdu.c 2009-06-29 10:43:57 UTC (rev 5054) @@ -671,6 +671,9 @@ while (nleft > 0) { #ifdef USE_GNU_PTH +# ifdef HAVE_W32_SYSTEM +# error Cannot use pth_read here because it expects a system HANDLE. +# endif n = pth_read (fd, buf, nleft); #else n = read (fd, buf, nleft); Modified: trunk/scd/app-openpgp.c =================================================================== --- trunk/scd/app-openpgp.c 2009-06-29 08:54:18 UTC (rev 5053) +++ trunk/scd/app-openpgp.c 2009-06-29 10:43:57 UTC (rev 5054) @@ -1118,11 +1118,25 @@ if (app->card_version > 0x0100) { + int exmode, le_value; + /* We may simply read the public key out of these cards. */ + if (app->app_local->cardcap.ext_lc_le) + { + exmode = 1; /* Use extended length. */ + le_value = app->app_local->extcap.max_rsp_data; + } + else + { + exmode = 0; + le_value = 256; /* Use legacy value. */ + } + err = iso7816_read_public_key - (app->slot, 0, (const unsigned char*)(keyno == 0? "\xB6" : - keyno == 1? "\xB8" : "\xA4"), 2, - 0, + (app->slot, exmode, + (const unsigned char*)(keyno == 0? "\xB6" : + keyno == 1? "\xB8" : "\xA4"), 2, + le_value, &buffer, &buflen); if (err) { @@ -1579,43 +1593,31 @@ char *pinvalue; if (app->did_chv2) - return 0; /* We already verified CHV2 (PW1 for v2 cards). */ + return 0; /* We already verified CHV2. */ - if (app->app_local->extcap.is_v2) + rc = verify_a_chv (app, pincb, pincb_arg, 2, 0, &pinvalue); + if (rc) + return rc; + app->did_chv2 = 1; + + if (!app->did_chv1 && !app->force_chv1 && pinvalue) { - /* Version two cards don't have a CHV2 anymore. We need to - verify CHV1 (now called PW1) instead. */ - rc = verify_a_chv (app, pincb, pincb_arg, 1, 0, &pinvalue); + /* For convenience we verify CHV1 here too. We do this only if + the card is not configured to require a verification before + each CHV1 controlled operation (force_chv1) and if we are not + using the keypad (PINVALUE == NULL). */ + rc = iso7816_verify (app->slot, 0x81, pinvalue, strlen (pinvalue)); + if (gpg_err_code (rc) == GPG_ERR_BAD_PIN) + rc = gpg_error (GPG_ERR_PIN_NOT_SYNCED); if (rc) - return rc; - app->did_chv2 = 1; - } - else - { - /* Version 1 cards only. */ - rc = verify_a_chv (app, pincb, pincb_arg, 2, 0, &pinvalue); - if (rc) - return rc; - app->did_chv2 = 1; - - if (!app->did_chv1 && !app->force_chv1 && pinvalue) { - /* For convenience we verify CHV1 here too. We do this only - if the card is not configured to require a verification - before each CHV1 controlled operation (force_chv1) and if - we are not using the keypad (PINVALUE == NULL). */ - rc = iso7816_verify (app->slot, 0x81, pinvalue, strlen (pinvalue)); - if (gpg_err_code (rc) == GPG_ERR_BAD_PIN) - rc = gpg_error (GPG_ERR_PIN_NOT_SYNCED); - if (rc) - { - log_error (_("verify CHV%d failed: %s\n"), 1, gpg_strerror (rc)); - flush_cache_after_error (app); - } - else - app->did_chv1 = 1; + log_error (_("verify CHV%d failed: %s\n"), 1, gpg_strerror (rc)); + flush_cache_after_error (app); } + else + app->did_chv1 = 1; } + xfree (pinvalue); return rc; From cvs at cvs.gnupg.org Mon Jun 29 15:40:07 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Mon, 29 Jun 2009 15:40:07 +0200 Subject: [svn] ksba - r307 - in trunk: . src tests Message-ID: Author: wk Date: 2009-06-29 15:40:07 +0200 (Mon, 29 Jun 2009) New Revision: 307 Added: trunk/tests/t-oid.c Modified: trunk/NEWS trunk/src/ChangeLog trunk/src/asn1-func.c trunk/src/oid.c Log: Detect overflow while parsing OIDs. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2009-06-05 10:29:33 UTC (rev 306) +++ trunk/src/ChangeLog 2009-06-29 13:40:07 UTC (rev 307) @@ -1,3 +1,13 @@ +2009-06-29 Werner Koch + + * oid.c (ksba_oid_to_str): Add an overflow check so that we can + detect bogus OIDs. + + * asn1-func.c (copy_value): Fix out-of-bounds assignment of a + boolean to HELPBUF. Due to alignment rules this was not + exploitable and we did not even used this code path. Reported by + David Binderman. + 2009-05-28 Werner Koch * der-encoder.c (_ksba_der_store_null, sum_up_lengths): Actually Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2009-06-05 10:29:33 UTC (rev 306) +++ trunk/NEWS 2009-06-29 13:40:07 UTC (rev 307) @@ -1,7 +1,9 @@ Noteworthy changes in version 1.0.7 ------------------------------------------------ + * Detect overflow while parsing OIDs. + Noteworthy changes in version 1.0.6 (2009-06-05) ------------------------------------------------ Modified: trunk/src/asn1-func.c =================================================================== --- trunk/src/asn1-func.c 2009-06-05 10:29:33 UTC (rev 306) +++ trunk/src/asn1-func.c 2009-06-29 13:40:07 UTC (rev 307) @@ -171,7 +171,7 @@ break; case VALTYPE_BOOL: len = 1; - helpbuf[1] = s->value.v_bool; + helpbuf[0] = s->value.v_bool; buf = helpbuf; break; case VALTYPE_CSTR: Modified: trunk/src/oid.c =================================================================== --- trunk/src/oid.c 2009-06-05 10:29:33 UTC (rev 306) +++ trunk/src/oid.c 2009-06-29 13:40:07 UTC (rev 307) @@ -1,5 +1,5 @@ /* oid.c - Object identifier helper functions - * Copyright (C) 2001 g10 Code GmbH + * Copyright (C) 2001, 2009 g10 Code GmbH * * This file is part of KSBA. * @@ -54,8 +54,10 @@ const unsigned char *buf = buffer; char *string, *p; int n = 0; - unsigned long val; + unsigned long val, valmask; + valmask = (unsigned long)0xfe << (8 * (sizeof (valmask) - 1)); + /* To calculate the length of the string we can safely assume an upper limit of 3 decimal characters per byte. Two extra bytes account for the special first octect */ @@ -68,9 +70,6 @@ return string; } - /* fixme: open code the sprintf so that we can cope with arbitrary - long integers - at least we should check for overflow of ulong */ - if (buf[0] < 40) p += sprintf (p, "0.%d", buf[n]); else if (buf[0] < 80) @@ -79,6 +78,8 @@ val = buf[n] & 0x7f; while ( (buf[n]&0x80) && ++n < length ) { + if ( (val & valmask) ) + goto badoid; /* Overflow. */ val <<= 7; val |= buf[n] & 0x7f; } @@ -91,6 +92,8 @@ val = buf[n] & 0x7f; while ( (buf[n]&0x80) && ++n < length ) { + if ( (val & valmask) ) + goto badoid; /* Overflow. */ val <<= 7; val |= buf[n] & 0x7f; } @@ -100,6 +103,15 @@ *p = 0; return string; + + badoid: + /* Return a special OID (gnu.gnupg.badoid) to indicate the error + case. The OID is broken and thus we return one which can't do + any harm. Formally this does not need to be a bad OID but an OID + with an arc that can't be represented in a 32 bit word is more + than likely corrupt. */ + xfree (string); + return xtrystrdup ("1.3.6.1.4.1.11591.2.12242973"); } Added: trunk/tests/t-oid.c =================================================================== --- trunk/tests/t-oid.c (rev 0) +++ trunk/tests/t-oid.c 2009-06-29 13:40:07 UTC (rev 307) @@ -0,0 +1,89 @@ +/* t-oid.c - Test utility for the OID functions + * Copyright (C) 2009 g10 Code GmbH + * + * This file is part of KSBA. + * + * KSBA is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * KSBA is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + + +#include +#include +#include +#include +#include +#include + +#include "../src/ksba.h" + + +static void * +read_into_buffer (FILE *fp, size_t *r_length) +{ + char *buffer; + size_t buflen; + size_t nread, bufsize = 0; + + *r_length = 0; +#define NCHUNK 8192 +#ifdef HAVE_W32_SYSTEM + setmode (fileno(fp), O_BINARY); +#endif + buffer = NULL; + buflen = 0; + do + { + bufsize += NCHUNK; + buffer = realloc (buffer, bufsize); + if (!buffer) + { + perror ("realloc failed"); + exit (1); + } + + nread = fread (buffer + buflen, 1, NCHUNK, fp); + if (nread < NCHUNK && ferror (fp)) + { + perror ("fread failed"); + exit (1); + } + buflen += nread; + } + while (nread == NCHUNK); +#undef NCHUNK + + *r_length = buflen; + return buffer; +} + + + +int +main (int argc, char **argv) +{ + char *buffer; + size_t buflen; + char *result; + + (void)argc; + (void)argv; + + buffer = read_into_buffer (stdin, &buflen); + result = ksba_oid_to_str (buffer, buflen); + free (buffer); + printf ("%s\n", result? result:"[malloc failed]"); + free (result); + + return 0; +} From cvs at cvs.gnupg.org Mon Jun 29 17:56:07 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Mon, 29 Jun 2009 17:56:07 +0200 Subject: [svn] GnuPG - r5055 - trunk/tools Message-ID: Author: wk Date: 2009-06-29 17:56:07 +0200 (Mon, 29 Jun 2009) New Revision: 5055 Modified: trunk/tools/ChangeLog trunk/tools/ccidmon.c Log: Support the Windows sniffusb tool. Modified: trunk/tools/ChangeLog =================================================================== --- trunk/tools/ChangeLog 2009-06-29 10:43:57 UTC (rev 5054) +++ trunk/tools/ChangeLog 2009-06-29 15:56:07 UTC (rev 5055) @@ -1,3 +1,8 @@ +2009-06-29 Werner Koch + + * ccidmon.c (parse_line_sniffusb): New. + (main): Add option --sniffusb. + 2009-06-08 Werner Koch * gpgconf.c (main): Call gnupg_reopen_std. Should fix bug#1072. Modified: trunk/tools/ccidmon.c =================================================================== --- trunk/tools/ccidmon.c 2009-06-29 10:43:57 UTC (rev 5054) +++ trunk/tools/ccidmon.c 2009-06-29 15:56:07 UTC (rev 5055) @@ -51,6 +51,8 @@ static int debug; static int skip_escape; static int usb_bus, usb_dev; +static int sniffusb; + /* Error counter. */ static int any_error; @@ -355,7 +357,11 @@ static void print_p2r_unknown (const unsigned char *msg, size_t msglen) { - print_p2r_header ("Unknown PC_to_RDR command", msg, msglen); + char buf[100]; + + snprintf (buf, sizeof buf, "Unknown PC_to_RDR command 0x%02X", + msglen? msg[0]:0); + print_p2r_header (buf, msg, msglen); if (msglen < 10) return; print_pr_data (msg, msglen, 0); @@ -519,7 +525,11 @@ static void print_r2p_unknown (const unsigned char *msg, size_t msglen) { - print_r2p_header ("Unknown RDR_to_PC command", msg, msglen); + char buf[100]; + + snprintf (buf, sizeof buf, "Unknown RDR_to_PC command 0x%02X", + msglen? msg[0]:0); + print_r2p_header (buf, msg, msglen); if (msglen < 10) return; printf (" bMessageType ......: %02X\n", msg[0]); @@ -685,6 +695,75 @@ static void +parse_line_sniffusb (char *line, unsigned int lineno) +{ + char *p; + + if (debug) + printf ("line[%u] =`%s'\n", lineno, line); + + p = strtok (line, " "); + if (!p) + return; + p = strtok (NULL, " "); + if (!p) + return; + p = strtok (NULL, " "); + if (!p) + return; + + if (hexdigitp (p[0]) && hexdigitp (p[1]) + && hexdigitp (p[2]) && hexdigitp (p[3]) + && p[4] == ':' && !p[5]) + { + size_t length; + unsigned int value; + + length = databuffer.count; + while ((p=strtok (NULL, " "))) + { + if (!hexdigitp (p[0]) || !hexdigitp (p[1])) + { + err ("invalid hex digit in line %u (%s)", lineno,p); + break; + } + value = xtoi_1 (p[0]) * 16 + xtoi_1 (p[1]); + + if (length >= sizeof (databuffer.data)) + { + err ("too much data at line %u - can handle only up to % bytes", + lineno, sizeof (databuffer.data)); + break; + } + databuffer.data[length++] = value; + } + databuffer.count = length; + + } + else if (!strcmp (p, "TransferFlags")) + { + flush_data (); + + *databuffer.address = 0; + while ((p=strtok (NULL, " (,)"))) + { + if (!strcmp (p, "USBD_TRANSFER_DIRECTION_IN")) + { + databuffer.is_bi = 1; + break; + } + else if (!strcmp (p, "USBD_TRANSFER_DIRECTION_OUT")) + { + databuffer.is_bi = 0; + break; + } + } + } + +} + + +static void parse_input (FILE *fp) { char line[2000]; @@ -701,7 +780,10 @@ err ("line number %u too long or last line not terminated", lineno); if (length && line[length - 1] == '\r') line[--length] = 0; - parse_line (line, lineno); + if (sniffusb) + parse_line_sniffusb (line, lineno); + else + parse_line (line, lineno); } flush_data (); if (ferror (fp)) @@ -713,7 +795,7 @@ main (int argc, char **argv) { int last_argc = -1; - + if (argc) { argc--; argv++; @@ -736,6 +818,7 @@ puts ("Usage: " PGM " [BUS:DEV]\n" "Parse the output of usbmod assuming it is CCID compliant.\n\n" " --skip-escape do not show escape packets\n" + " --sniffusb Assume output from Sniffusb.exe\n" " --verbose enable extra informational output\n" " --debug enable additional debug output\n" " --help display this help and exit\n\n" @@ -757,9 +840,16 @@ skip_escape = 1; argc--; argv++; } + else if (!strcmp (*argv, "--sniffusb")) + { + sniffusb = 1; + argc--; argv++; + } } - - if (argc > 1) + + if (argc && sniffusb) + die ("no arguments expected when using --sniffusb\n"); + else if (argc > 1) die ("usage: " PGM " [BUS:DEV] (try --help for more information)\n"); if (argc == 1) @@ -772,8 +862,8 @@ if (usb_bus < 1 || usb_bus > 999 || usb_dev < 1 || usb_dev > 999) die ("invalid bus:dev specified"); } + - signal (SIGPIPE, SIG_IGN); parse_input (stdin); From cvs at cvs.gnupg.org Mon Jun 29 22:54:00 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Mon, 29 Jun 2009 22:54:00 +0200 Subject: [svn] GnuPG - r5056 - in trunk: doc scd Message-ID: Author: wk Date: 2009-06-29 22:54:00 +0200 (Mon, 29 Jun 2009) New Revision: 5056 Modified: trunk/doc/DETAILS trunk/scd/ChangeLog trunk/scd/ccid-driver.c Log: Make soem omnikey readers work with extended length APDUs. Modified: trunk/scd/ChangeLog =================================================================== --- trunk/scd/ChangeLog 2009-06-29 15:56:07 UTC (rev 5055) +++ trunk/scd/ChangeLog 2009-06-29 20:54:00 UTC (rev 5056) @@ -1,3 +1,10 @@ +2009-06-29 Werner Koch + + * ccid-driver.c (ccid_transceive): Add a hack to support extended + length for Omnikey readers. + (is_exlen_apdu): New. + (parse_ccid_descriptor): Track short+extended apdu exchange level. + 2009-06-18 Werner Koch * app-openpgp.c (verify_chv2): Remove special case for v2 cards. Modified: trunk/doc/DETAILS =================================================================== --- trunk/doc/DETAILS 2009-06-29 15:56:07 UTC (rev 5055) +++ trunk/doc/DETAILS 2009-06-29 20:54:00 UTC (rev 5056) @@ -1140,11 +1140,16 @@ to keep them small. +OIDs below the GnuPG arc: +========================= + 1.3.6.1.4.1.11591.2 GnuPG + 1.3.6.1.4.1.11591.2.1 notation + 1.3.6.1.4.1.11591.2.1.1 pkaAddress + 1.3.6.1.4.1.11591.2.12242973 invalid encoded OID - Keyserver Message Format ========================= Modified: trunk/scd/ccid-driver.c =================================================================== --- trunk/scd/ccid-driver.c 2009-06-29 15:56:07 UTC (rev 5055) +++ trunk/scd/ccid-driver.c 2009-06-29 20:54:00 UTC (rev 5056) @@ -1,6 +1,6 @@ /* ccid-driver.c - USB ChipCardInterfaceDevices driver * Copyright (C) 2003, 2004, 2005, 2006, 2007 - * 2008 Free Software Foundation, Inc. + * 2008, 2009 Free Software Foundation, Inc. * Written by Werner Koch. * * This file is part of GnuPG. @@ -251,7 +251,9 @@ int ifsc; int powered_off; int has_pinpad; - int apdu_level; /* Reader supports short APDU level exchange. */ + int apdu_level; /* Reader supports short APDU level exchange. + With a value of 2 short and extended level is + supported.*/ }; @@ -822,7 +824,7 @@ else if ((us & 0x00040000)) { DEBUGOUT (" Short and extended APDU level exchange\n"); - handle->apdu_level = 1; + handle->apdu_level = 2; } else if ((us & 0x00070000)) DEBUGOUT (" WARNING: conflicting exchange levels\n"); @@ -2446,6 +2448,16 @@ } +/* Return true if APDU is an extended length one. */ +static int +is_exlen_apdu (const unsigned char *apdu, size_t apdulen) +{ + if (apdulen < 7 || apdu[4]) + return 0; /* Too short or no Z byte. */ + return 1; +} + + /* Helper for ccid_transceive used for APDU level exchanges. */ static int ccid_transceive_apdu_level (ccid_driver_t handle, @@ -2574,7 +2586,9 @@ unsigned char *resp, size_t maxresplen, size_t *nresp) { int rc; - unsigned char send_buffer[10+259], recv_buffer[10+259]; + /* The size of the buffer used to be 10+259. For the via_escape + hack we need one extra byte, thus 11+259. */ + unsigned char send_buffer[11+259], recv_buffer[11+259]; const unsigned char *apdu; size_t apdulen; unsigned char *msg, *tpdu, *p; @@ -2582,10 +2596,14 @@ unsigned char seqno; unsigned int edc; int use_crc = 0; + int hdrlen, pcboff; size_t dummy_nresp; + int via_escape = 0; int next_chunk = 1; int sending = 1; int retries = 0; + int resyncing = 0; + int nad_byte; if (!nresp) nresp = &dummy_nresp; @@ -2593,13 +2611,32 @@ /* Smarter readers allow to send APDUs directly; divert here. */ if (handle->apdu_level) - return ccid_transceive_apdu_level (handle, apdu_buf, apdu_buflen, - resp, maxresplen, nresp); + { + /* We employ a hack for Omnikey readers which are able to send + TPDUs using an escape sequence. There is no documentation + but the Windows driver does it this way. Tested using a + CM6121. */ + if ((handle->id_vendor == VENDOR_OMNIKEY + || (!handle->idev && handle->id_product == TRANSPORT_CM4040)) + && handle->apdu_level < 2 + && is_exlen_apdu (apdu_buf, apdu_buflen)) + via_escape = 1; + else + return ccid_transceive_apdu_level (handle, apdu_buf, apdu_buflen, + resp, maxresplen, nresp); + } /* The other readers we support require sending TPDUs. */ tpdulen = 0; /* Avoid compiler warning about no initialization. */ msg = send_buffer; + hdrlen = via_escape? 11 : 10; + + /* NAD: DAD=1, SAD=0 */ + nad_byte = handle->nonnull_nad? ((1 << 4) | 0): 0; + if (via_escape) + nad_byte = 0; + for (;;) { if (next_chunk) @@ -2611,9 +2648,8 @@ assert (apdulen); /* Construct an I-Block. */ - tpdu = msg+10; - /* NAD: DAD=1, SAD=0 */ - tpdu[0] = handle->nonnull_nad? ((1 << 4) | 0): 0; + tpdu = msg + hdrlen; + tpdu[0] = nad_byte; tpdu[1] = ((handle->t1_ns & 1) << 6); /* I-block */ if (apdulen > handle->ifsc ) { @@ -2631,37 +2667,56 @@ tpdu[tpdulen++] = edc; } - msg[0] = PC_to_RDR_XfrBlock; - msg[5] = 0; /* slot */ - msg[6] = seqno = handle->seqno++; - msg[7] = 4; /* bBWI */ - msg[8] = 0; /* RFU */ - msg[9] = 0; /* RFU */ - set_msg_len (msg, tpdulen); - msglen = 10 + tpdulen; - last_tpdulen = tpdulen; + if (via_escape) + { + msg[0] = PC_to_RDR_Escape; + msg[5] = 0; /* slot */ + msg[6] = seqno = handle->seqno++; + msg[7] = 0; /* RFU */ + msg[8] = 0; /* RFU */ + msg[9] = 0; /* RFU */ + msg[10] = 0x1a; /* Omnikey command to send a TPDU. */ + set_msg_len (msg, 1 + tpdulen); + } + else + { + msg[0] = PC_to_RDR_XfrBlock; + msg[5] = 0; /* slot */ + msg[6] = seqno = handle->seqno++; + msg[7] = 4; /* bBWI */ + msg[8] = 0; /* RFU */ + msg[9] = 0; /* RFU */ + set_msg_len (msg, tpdulen); + } + msglen = hdrlen + tpdulen; + if (!resyncing) + last_tpdulen = tpdulen; + pcboff = hdrlen+1; if (debug_level > 1) - DEBUGOUT_3 ("T=1: put %c-block seq=%d%s\n", - ((msg[11] & 0xc0) == 0x80)? 'R' : - (msg[11] & 0x80)? 'S' : 'I', - ((msg[11] & 0x80)? !!(msg[11]& 0x10) - : !!(msg[11] & 0x40)), - (!(msg[11] & 0x80) && (msg[11] & 0x20)? " [more]":"")); - + DEBUGOUT_3 ("T=1: put %c-block seq=%d%s\n", + ((msg[pcboff] & 0xc0) == 0x80)? 'R' : + (msg[pcboff] & 0x80)? 'S' : 'I', + ((msg[pcboff] & 0x80)? !!(msg[pcboff]& 0x10) + : !!(msg[pcboff] & 0x40)), + (!(msg[pcboff] & 0x80) && (msg[pcboff] & 0x20)? + " [more]":"")); + rc = bulk_out (handle, msg, msglen, 0); if (rc) return rc; msg = recv_buffer; rc = bulk_in (handle, msg, sizeof recv_buffer, &msglen, - RDR_to_PC_DataBlock, seqno, 5000, 0); + via_escape? RDR_to_PC_Escape : RDR_to_PC_DataBlock, + seqno, 5000, 0); if (rc) return rc; - - tpdu = msg + 10; - tpdulen = msglen - 10; - + + tpdu = msg + hdrlen; + tpdulen = msglen - hdrlen; + resyncing = 0; + if (tpdulen < 4) { usb_clear_halt (handle->idev, handle->ep_bulk_in); @@ -2670,11 +2725,13 @@ if (debug_level > 1) DEBUGOUT_4 ("T=1: got %c-block seq=%d err=%d%s\n", - ((msg[11] & 0xc0) == 0x80)? 'R' : - (msg[11] & 0x80)? 'S' : 'I', - ((msg[11] & 0x80)? !!(msg[11]& 0x10) : !!(msg[11] & 0x40)), - ((msg[11] & 0xc0) == 0x80)? (msg[11] & 0x0f) : 0, - (!(msg[11] & 0x80) && (msg[11] & 0x20)? " [more]":"")); + ((msg[pcboff] & 0xc0) == 0x80)? 'R' : + (msg[pcboff] & 0x80)? 'S' : 'I', + ((msg[pcboff] & 0x80)? !!(msg[pcboff]& 0x10) + : !!(msg[pcboff] & 0x40)), + ((msg[pcboff] & 0xc0) == 0x80)? (msg[pcboff] & 0x0f) : 0, + (!(msg[pcboff] & 0x80) && (msg[pcboff] & 0x20)? + " [more]":"")); if (!(tpdu[1] & 0x80)) { /* This is an I-block. */ @@ -2688,9 +2745,8 @@ if (!!(tpdu[1] & 0x40) != handle->t1_nr) { /* Reponse does not match our sequence number. */ msg = send_buffer; - tpdu = msg+10; - /* NAD: DAD=1, SAD=0 */ - tpdu[0] = handle->nonnull_nad? ((1 << 4) | 0): 0; + tpdu = msg + hdrlen; + tpdu[0] = nad_byte; tpdu[1] = (0x80 | (handle->t1_nr & 1) << 4 | 2); /* R-block */ tpdu[2] = 0; tpdulen = 3; @@ -2727,9 +2783,8 @@ return 0; /* No chaining requested - ready. */ msg = send_buffer; - tpdu = msg+10; - /* NAD: DAD=1, SAD=0 */ - tpdu[0] = handle->nonnull_nad? ((1 << 4) | 0): 0; + tpdu = msg + hdrlen; + tpdu[0] = nad_byte; tpdu[1] = (0x80 | (handle->t1_nr & 1) << 4); /* R-block */ tpdu[2] = 0; tpdulen = 3; @@ -2741,14 +2796,36 @@ else if ((tpdu[1] & 0xc0) == 0x80) { /* This is a R-block. */ if ( (tpdu[1] & 0x0f)) - { /* Error: repeat last block */ - if (++retries > 3) + { + retries++; + if (via_escape && retries == 1 && (msg[pcboff] & 0x0f)) { - DEBUGOUT ("3 failed retries\n"); + /* Error probably due to switching to TPDU. Send a + resync request. We use the recv_buffer so that + we don't corrupt the send_buffer. */ + msg = recv_buffer; + tpdu = msg + hdrlen; + tpdu[0] = nad_byte; + tpdu[1] = 0xc0; /* S-block resync request. */ + tpdu[2] = 0; + tpdulen = 3; + edc = compute_edc (tpdu, tpdulen, use_crc); + if (use_crc) + tpdu[tpdulen++] = (edc >> 8); + tpdu[tpdulen++] = edc; + DEBUGOUT ("T=1: requesting re-sync\n"); + } + else if (retries > 3) + { + DEBUGOUT ("T=1: 3 failed retries\n"); return CCID_DRIVER_ERR_CARD_IO_ERROR; } - msg = send_buffer; - tpdulen = last_tpdulen; + else + { + /* Error: repeat last block */ + msg = send_buffer; + tpdulen = last_tpdulen; + } } else if (sending && !!(tpdu[1] & 0x10) == handle->t1_ns) { /* Response does not match our sequence number. */ @@ -2771,7 +2848,7 @@ else { /* This is a S-block. */ retries = 0; - DEBUGOUT_2 ("T=1 S-block %s received cmd=%d\n", + DEBUGOUT_2 ("T=1: S-block %s received cmd=%d\n", (tpdu[1] & 0x20)? "response": "request", (tpdu[1] & 0x1f)); if ( !(tpdu[1] & 0x20) && (tpdu[1] & 0x1f) == 1 && tpdu[2] == 1) @@ -2783,9 +2860,8 @@ return CCID_DRIVER_ERR_CARD_IO_ERROR; msg = send_buffer; - tpdu = msg+10; - /* NAD: DAD=1, SAD=0 */ - tpdu[0] = handle->nonnull_nad? ((1 << 4) | 0): 0; + tpdu = msg + hdrlen; + tpdu[0] = nad_byte; tpdu[1] = (0xc0 | 0x20 | 1); /* S-block response */ tpdu[2] = 1; tpdu[3] = ifsc; @@ -2794,16 +2870,15 @@ if (use_crc) tpdu[tpdulen++] = (edc >> 8); tpdu[tpdulen++] = edc; - DEBUGOUT_1 ("T=1 requesting an ifsc=%d\n", ifsc); + DEBUGOUT_1 ("T=1: requesting an ifsc=%d\n", ifsc); } else if ( !(tpdu[1] & 0x20) && (tpdu[1] & 0x1f) == 3 && tpdu[2]) { /* Wait time extension request. */ unsigned char bwi = tpdu[3]; msg = send_buffer; - tpdu = msg+10; - /* NAD: DAD=1, SAD=0 */ - tpdu[0] = handle->nonnull_nad? ((1 << 4) | 0): 0; + tpdu = msg + hdrlen; + tpdu[0] = nad_byte; tpdu[1] = (0xc0 | 0x20 | 3); /* S-block response */ tpdu[2] = 1; tpdu[3] = bwi; @@ -2812,8 +2887,15 @@ if (use_crc) tpdu[tpdulen++] = (edc >> 8); tpdu[tpdulen++] = edc; - DEBUGOUT_1 ("T=1 waittime extension of bwi=%d\n", bwi); + DEBUGOUT_1 ("T=1: waittime extension of bwi=%d\n", bwi); } + else if ( (tpdu[1] & 0x20) && (tpdu[1] & 0x1f) == 0 && !tpdu[2]) + { + DEBUGOUT ("T=1: resync ack from reader\n"); + /* Repeat previous block. */ + msg = send_buffer; + tpdulen = last_tpdulen; + } else return CCID_DRIVER_ERR_CARD_IO_ERROR; } @@ -3070,8 +3152,8 @@ } } else - { /* This is a S-block. */ - DEBUGOUT_2 ("T=1 S-block %s received cmd=%d for Secure operation\n", + { /* This is a S-bl Author: wk Date: 2009-06-30 10:19:28 +0200 (Tue, 30 Jun 2009) New Revision: 5057 Modified: trunk/scd/ChangeLog trunk/scd/ccid-driver.c Log: small fix for Omnikey. Works with CM4040 now. Modified: trunk/scd/ChangeLog =================================================================== --- trunk/scd/ChangeLog 2009-06-29 20:54:00 UTC (rev 5056) +++ trunk/scd/ChangeLog 2009-06-30 08:19:28 UTC (rev 5057) @@ -1,3 +1,7 @@ +2009-06-30 Werner Koch + + * ccid-driver.c (ccid_transceive): Set RESYNCING flag. + 2009-06-29 Werner Koch * ccid-driver.c (ccid_transceive): Add a hack to support extended Modified: trunk/scd/ccid-driver.c =================================================================== --- trunk/scd/ccid-driver.c 2009-06-29 20:54:00 UTC (rev 5056) +++ trunk/scd/ccid-driver.c 2009-06-30 08:19:28 UTC (rev 5057) @@ -2637,6 +2637,7 @@ if (via_escape) nad_byte = 0; + last_tpdulen = 0; /* Avoid gcc warning (controlled by RESYNCING). */ for (;;) { if (next_chunk) @@ -2870,6 +2871,7 @@ if (use_crc) tpdu[tpdulen++] = (edc >> 8); tpdu[tpdulen++] = edc; + resyncing = 1; DEBUGOUT_1 ("T=1: requesting an ifsc=%d\n", ifsc); } else if ( !(tpdu[1] & 0x20) && (tpdu[1] & 0x1f) == 3 && tpdu[2]) From cvs at cvs.gnupg.org Tue Jun 30 10:22:29 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue, 30 Jun 2009 10:22:29 +0200 Subject: [svn] GnuPG - r5058 - trunk/scd Message-ID: Author: wk Date: 2009-06-30 10:22:28 +0200 (Tue, 30 Jun 2009) New Revision: 5058 Modified: trunk/scd/ccid-driver.c Log: OOps commited an old version. Fixed now. Modified: trunk/scd/ccid-driver.c =================================================================== --- trunk/scd/ccid-driver.c 2009-06-30 08:19:28 UTC (rev 5057) +++ trunk/scd/ccid-driver.c 2009-06-30 08:22:28 UTC (rev 5058) @@ -2814,7 +2814,8 @@ if (use_crc) tpdu[tpdulen++] = (edc >> 8); tpdu[tpdulen++] = edc; - DEBUGOUT ("T=1: requesting re-sync\n"); + resyncing = 1; + DEBUGOUT ("T=1: requesting resync\n"); } else if (retries > 3) { @@ -2871,7 +2872,6 @@ if (use_crc) tpdu[tpdulen++] = (edc >> 8); tpdu[tpdulen++] = edc; - resyncing = 1; DEBUGOUT_1 ("T=1: requesting an ifsc=%d\n", ifsc); } else if ( !(tpdu[1] & 0x20) && (tpdu[1] & 0x1f) == 3 && tpdu[2]) From cvs at cvs.gnupg.org Tue Jun 30 13:29:07 2009 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue, 30 Jun 2009 13:29:07 +0200 Subject: [svn] GnuPG - r5059 - in trunk: g10 po Message-ID: Author: wk Date: 2009-06-30 13:29:03 +0200 (Tue, 30 Jun 2009) New Revision: 5059 Modified: trunk/g10/keyedit.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: Translation fix Modified: trunk/po/ChangeLog =================================================================== --- trunk/po/ChangeLog 2009-06-30 08:22:28 UTC (rev 5058) +++ trunk/po/ChangeLog 2009-06-30 11:29:03 UTC (rev 5059) @@ -1,3 +1,11 @@ +2009-06-30 Werner Koch + + * es.po: Mark a bad translation fuzzy. + +2009-06-30 Daiki Ueno + + * ja.po: Typo fix. Fixes bug#1078. + 2009-06-02 Werner Koch * de.po: Applied a patch from Daniel Leidert to fix a bunch of Modified: trunk/g10/keyedit.c =================================================================== --- trunk/g10/keyedit.c 2009-06-30 08:22:28 UTC (rev 5058) +++ trunk/g10/keyedit.c 2009-06-30 11:29:03 UTC (rev 5059) @@ -1898,8 +1898,11 @@ switch ( count_selected_keys (sec_keyblock) ) { case 0: - if (cpr_get_answer_is_yes("keyedit.keytocard.use_primary", - _("Really move the primary key? (y/N) "))) + if (cpr_get_answer_is_yes + ("keyedit.keytocard.use_primary", + /* TRANSLATORS: Please take care: This is about + moving the key and not about removing it. */ + _("Really move the primary key? (y/N) "))) node = sec_keyblock; break; case 1: 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]