From cvs at cvs.gnupg.org Thu Sep 1 15:44:49 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Thu Sep 1 15:19:29 2005 Subject: [svn] GnuPG - r3879 - trunk/mpi Message-ID: Author: dshaw Date: 2005-09-01 15:44:49 +0200 (Thu, 01 Sep 2005) New Revision: 3879 Modified: trunk/mpi/ChangeLog trunk/mpi/mpicoder.c Log: * mpicoder.c (mpi_read): Fix minor bug in reading a zero-length MPI (was failing unnecessarily). Modified: trunk/mpi/ChangeLog =================================================================== --- trunk/mpi/ChangeLog 2005-08-31 18:40:39 UTC (rev 3878) +++ trunk/mpi/ChangeLog 2005-09-01 13:44:49 UTC (rev 3879) @@ -1,3 +1,8 @@ +2005-09-01 David Shaw + + * mpicoder.c (mpi_read): Fix minor bug in reading a zero-length + MPI (was failing unnecessarily). + 2005-05-06 Werner Koch * mpi-scan.c (mpi_putbyte, mpi_getbyte): Removed. Not used. Modified: trunk/mpi/mpicoder.c =================================================================== --- trunk/mpi/mpicoder.c 2005-08-31 18:40:39 UTC (rev 3878) +++ trunk/mpi/mpicoder.c 2005-09-01 13:44:49 UTC (rev 3879) @@ -80,16 +80,20 @@ mpi_limb_t a; MPI val = MPI_NULL; + if (nread == nmax) + goto overflow; if( (c = iobuf_get(inp)) == -1 ) goto leave; - if (++nread >= nmax) + nread++; + nbits = c << 8; + + if (nread == nmax) goto overflow; - nbits = c << 8; if( (c = iobuf_get(inp)) == -1 ) goto leave; - if (++nread >= nmax) - goto overflow; + nread++; nbits |= c; + if( nbits > MAX_EXTERN_MPI_BITS ) { log_error("mpi too large for this implementation (%u bits)\n", nbits); goto leave; @@ -112,7 +116,7 @@ for( ; j > 0; j-- ) { a = 0; for(; i < BYTES_PER_MPI_LIMB; i++ ) { - if (nread >= nmax) { + if (nread == nmax) { #ifdef M_DEBUG mpi_debug_free (val); #else From cvs at cvs.gnupg.org Thu Sep 1 22:51:17 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Thu Sep 1 22:25:57 2005 Subject: [svn] GnuPG - r3880 - trunk/g10 Message-ID: Author: dshaw Date: 2005-09-01 22:51:13 +0200 (Thu, 01 Sep 2005) New Revision: 3880 Modified: trunk/g10/ChangeLog trunk/g10/keyedit.c trunk/g10/photoid.c trunk/g10/photoid.h Log: * photoid.h, photoid.c (generate_photo_id): Allow passing in a suggested filename. * keyedit.c (keyedit_menu, menu_adduid): Call it here so "addphoto filename" works. Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2005-09-01 13:44:49 UTC (rev 3879) +++ trunk/g10/ChangeLog 2005-09-01 20:51:13 UTC (rev 3880) @@ -1,3 +1,11 @@ +2005-09-01 David Shaw + + * photoid.h, photoid.c (generate_photo_id): Allow passing in a + suggested filename. + + * keyedit.c (keyedit_menu, menu_adduid): Call it here so "addphoto + filename" works. + 2005-08-31 David Shaw * photoid.c (generate_photo_id): Enable readline completion and Modified: trunk/g10/keyedit.c =================================================================== --- trunk/g10/keyedit.c 2005-09-01 13:44:49 UTC (rev 3879) +++ trunk/g10/keyedit.c 2005-09-01 20:51:13 UTC (rev 3880) @@ -51,7 +51,8 @@ static void show_key_with_all_names( KBNODE keyblock, int only_marked, int with_revoker, int with_fpr, int with_subkeys, int with_prefs ); static void show_key_and_fingerprint( KBNODE keyblock ); -static int menu_adduid( KBNODE keyblock, KBNODE sec_keyblock, int photo ); +static int menu_adduid( KBNODE keyblock, KBNODE sec_keyblock, + int photo, const char *photo_name ); static void menu_deluid( KBNODE pub_keyblock, KBNODE sec_keyblock ); static int menu_delsig( KBNODE pub_keyblock ); static int menu_clean_sigs_from_uids(KBNODE keyblock); @@ -1788,7 +1789,7 @@ /* fall through */ case cmdADDUID: - if( menu_adduid( keyblock, sec_keyblock, photo ) ) + if( menu_adduid( keyblock, sec_keyblock, photo, arg_string ) ) { update_trust = 1; redisplay = 1; @@ -2910,7 +2911,8 @@ * Return true if there is a new user id */ static int -menu_adduid( KBNODE pub_keyblock, KBNODE sec_keyblock, int photo) +menu_adduid( KBNODE pub_keyblock, KBNODE sec_keyblock, + int photo, const char *photo_name) { PKT_user_id *uid; PKT_public_key *pk=NULL; @@ -2976,7 +2978,7 @@ } } - uid = generate_photo_id(pk); + uid = generate_photo_id(pk,photo_name); } else uid = generate_user_id(); if( !uid ) Modified: trunk/g10/photoid.c =================================================================== --- trunk/g10/photoid.c 2005-09-01 13:44:49 UTC (rev 3879) +++ trunk/g10/photoid.c 2005-09-01 20:51:13 UTC (rev 3880) @@ -44,12 +44,12 @@ /* Generate a new photo id packet, or return NULL if canceled */ PKT_user_id * -generate_photo_id(PKT_public_key *pk) +generate_photo_id(PKT_public_key *pk,const char *photo_name) { PKT_user_id *uid; int error=1,i; unsigned int len; - char *filename=NULL; + char *filename; byte *photo=NULL; byte header[16]; IOBUF file; @@ -65,35 +65,44 @@ #define EXTRA_UID_NAME_SPACE 71 uid=xmalloc_clear(sizeof(*uid)+71); - tty_printf(_("\nPick an image to use for your photo ID. " - "The image must be a JPEG file.\n" - "Remember that the image is stored within your public key. " - "If you use a\n" - "very large picture, your key will become very large as well!\n" - "Keeping the image close to 240x288 is a good size to use.\n")); + if(photo_name && *photo_name) + filename=make_filename(photo_name,(void *)NULL); + else + { + tty_printf(_("\nPick an image to use for your photo ID." + " The image must be a JPEG file.\n" + "Remember that the image is stored within your public key." + " If you use a\n" + "very large picture, your key will become very large" + " as well!\n" + "Keeping the image close to 240x288 is a good size" + " to use.\n")); + filename=NULL; + } while(photo==NULL) { - char *tempname; + if(filename==NULL) + { + char *tempname; - tty_printf("\n"); + tty_printf("\n"); - xfree(filename); + tty_enable_completion(NULL); - tty_enable_completion(NULL); + tempname=cpr_get("photoid.jpeg.add", + _("Enter JPEG filename for photo ID: ")); - tempname=cpr_get("photoid.jpeg.add", - _("Enter JPEG filename for photo ID: ")); + tty_disable_completion(); - tty_disable_completion(); + filename=make_filename(tempname,(void *)NULL); - filename=make_filename(tempname,(void *)NULL); + xfree(tempname); - xfree(tempname); + if(strlen(filename)==0) + goto scram; + } - if(strlen(filename)==0) - goto scram; - file=iobuf_open(filename); if (file && is_secured_file (iobuf_get_fd (file))) { @@ -105,6 +114,8 @@ { log_error(_("unable to open JPEG file `%s': %s\n"), filename,strerror(errno)); + xfree(filename); + filename=NULL; continue; } @@ -116,6 +127,8 @@ _("Are you sure you want to use it? (y/N) "))) { iobuf_close(file); + xfree(filename); + filename=NULL; continue; } } @@ -131,6 +144,8 @@ log_error(_("`%s' is not a JPEG file\n"),filename); xfree(photo); photo=NULL; + xfree(filename); + filename=NULL; continue; } @@ -153,6 +168,8 @@ free_attributes(uid); xfree(photo); photo=NULL; + xfree(filename); + filename=NULL; continue; } } Modified: trunk/g10/photoid.h =================================================================== --- trunk/g10/photoid.h 2005-09-01 13:44:49 UTC (rev 3879) +++ trunk/g10/photoid.h 2005-09-01 20:51:13 UTC (rev 3880) @@ -26,7 +26,7 @@ #include "packet.h" -PKT_user_id *generate_photo_id(PKT_public_key *pk); +PKT_user_id *generate_photo_id(PKT_public_key *pk,const char *filename); int parse_image_header(const struct user_attribute *attr,byte *type,u32 *len); char *image_type_to_string(byte type,int style); void show_photos(const struct user_attribute *attrs, From cvs at cvs.gnupg.org Fri Sep 2 21:23:41 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Fri Sep 2 20:58:12 2005 Subject: [svn] GnuPG - r3881 - trunk/g10 Message-ID: Author: dshaw Date: 2005-09-02 21:23:33 +0200 (Fri, 02 Sep 2005) New Revision: 3881 Modified: trunk/g10/ChangeLog trunk/g10/parse-packet.c Log: * parse-packet.c (enum_sig_subpkt, parse_signature, parse_attribute_subpkts): Make a number of warnings verbose items. These fire on many slightly mangled keys in the field, so the warning is becoming burdensome. Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2005-09-01 20:51:13 UTC (rev 3880) +++ trunk/g10/ChangeLog 2005-09-02 19:23:33 UTC (rev 3881) @@ -1,3 +1,10 @@ +2005-09-02 David Shaw + + * parse-packet.c (enum_sig_subpkt, parse_signature, + parse_attribute_subpkts): Make a number of warnings verbose items. + These fire on many slightly mangled keys in the field, so the + warning is becoming burdensome. + 2005-09-01 David Shaw * photoid.h, photoid.c (generate_photo_id): Allow passing in a Modified: trunk/g10/parse-packet.c =================================================================== --- trunk/g10/parse-packet.c 2005-09-01 20:51:13 UTC (rev 3880) +++ trunk/g10/parse-packet.c 2005-09-02 19:23:33 UTC (rev 3881) @@ -1186,7 +1186,8 @@ return NULL; /* end of packets; not found */ too_short: - log_error("buffer shorter than subpacket\n"); + if(opt.verbose) + log_info("buffer shorter than subpacket\n"); if( start ) *start = -1; return NULL; @@ -1322,23 +1323,23 @@ sig->digest_start[0] = iobuf_get_noeof(inp); pktlen--; sig->digest_start[1] = iobuf_get_noeof(inp); pktlen--; - if( is_v4 && sig->pubkey_algo ) { /*extract required information */ + if( is_v4 && sig->pubkey_algo ) + { /*extract required information */ const byte *p; size_t len; /* set sig->flags.unknown_critical if there is a * critical bit set for packets which we do not understand */ if( !parse_sig_subpkt (sig->hashed, SIGSUBPKT_TEST_CRITICAL, NULL) - || !parse_sig_subpkt (sig->unhashed, SIGSUBPKT_TEST_CRITICAL, - NULL) ) - { - sig->flags.unknown_critical = 1; - } + || !parse_sig_subpkt (sig->unhashed, SIGSUBPKT_TEST_CRITICAL, + NULL) ) + sig->flags.unknown_critical = 1; p = parse_sig_subpkt (sig->hashed, SIGSUBPKT_SIG_CREATED, NULL ); if(p) sig->timestamp = buffer_to_u32(p); - else if(!(sig->pubkey_algo>=100 && sig->pubkey_algo<=110)) + else if(!(sig->pubkey_algo>=100 && sig->pubkey_algo<=110) + && opt.verbose) log_info ("signature packet without timestamp\n"); p = parse_sig_subpkt2( sig, SIGSUBPKT_ISSUER, NULL ); @@ -1347,14 +1348,15 @@ sig->keyid[0] = buffer_to_u32(p); sig->keyid[1] = buffer_to_u32(p+4); } - else if(!(sig->pubkey_algo>=100 && sig->pubkey_algo<=110)) + else if(!(sig->pubkey_algo>=100 && sig->pubkey_algo<=110) + && opt.verbose) log_info ("signature packet without keyid\n"); p=parse_sig_subpkt(sig->hashed,SIGSUBPKT_SIG_EXPIRE,NULL); if(p) sig->expiredate=sig->timestamp+buffer_to_u32(p); if(sig->expiredate && sig->expiredate<=make_timestamp()) - sig->flags.expired=1; + sig->flags.expired=1; p=parse_sig_subpkt(sig->hashed,SIGSUBPKT_POLICY,NULL); if(p) @@ -1401,7 +1403,7 @@ /* Find all revocation keys. */ if(sig->sig_class==0x1F) parse_revkeys(sig); - } + } if( list_mode ) { fprintf (listfp, ":signature packet: algo %d, keyid %08lX%08lX\n" @@ -1957,7 +1959,8 @@ return count; too_short: - log_error("buffer shorter than attribute subpacket\n"); + if(opt.verbose) + log_info("buffer shorter than attribute subpacket\n"); uid->attribs=attribs; uid->numattribs=count; return count; From cvs at cvs.gnupg.org Sat Sep 3 12:14:56 2005 From: cvs at cvs.gnupg.org (cvs user werner) Date: Sat Sep 3 12:15:05 2005 Subject: libgpg-error (README.WARNING-REPOSITORY-NOT-CURRENT) Message-ID: Date: Saturday, September 3, 2005 @ 12:14:56 Author: werner Path: /cvs/gnupg/libgpg-error Added: README.WARNING-REPOSITORY-NOT-CURRENT . ---------------------------------------+ README.WARNING-REPOSITORY-NOT-CURRENT | 6 ++++++ 1 files changed, 6 insertions(+) From cvs at cvs.gnupg.org Sat Sep 3 12:21:33 2005 From: cvs at cvs.gnupg.org (cvs user werner) Date: Sat Sep 3 12:21:41 2005 Subject: libassuan (README.WARNING-REPOSITORY-NOT-CURRENT) Message-ID: Date: Saturday, September 3, 2005 @ 12:21:33 Author: werner Path: /cvs/gnupg/libassuan Added: README.WARNING-REPOSITORY-NOT-CURRENT . ---------------------------------------+ README.WARNING-REPOSITORY-NOT-CURRENT | 6 ++++++ 1 files changed, 6 insertions(+) From cvs at cvs.gnupg.org Sun Sep 4 13:18:19 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Sun Sep 4 12:52:41 2005 Subject: [svn] GPGol - r82 - in trunk: . src Message-ID: Author: wk Date: 2005-09-04 13:18:13 +0200 (Sun, 04 Sep 2005) New Revision: 82 Modified: trunk/AUTHORS trunk/ChangeLog trunk/NEWS trunk/README trunk/configure.ac trunk/src/olflange.cpp Log: About to release 0.9.0 Modified: trunk/AUTHORS =================================================================== --- trunk/AUTHORS 2005-09-03 08:29:29 UTC (rev 81) +++ trunk/AUTHORS 2005-09-04 11:18:13 UTC (rev 82) @@ -1,6 +1,14 @@ +Package: gpgol +Contact: info-gpgol@g10code.com +Bugs: bug-gpgol@g10code.com + +New code and packet maintainer: +g10 Code GmbH + All code from the years 2003, 2004 Timo Schulz -New code and packet maintainer: -g10 Code GmbH +Some files may still contain code from the orginal plugin: +Copyright (C) 2001 G Data Software AG, http://www.gdata.de + Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2005-09-03 08:29:29 UTC (rev 81) +++ trunk/ChangeLog 2005-09-04 11:18:13 UTC (rev 82) @@ -1,3 +1,7 @@ +2005-09-04 Werner Koch + + Release version 0.9.0. + 2005-08-30 Werner Koch Renamed project to gpgol. Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2005-09-03 08:29:29 UTC (rev 81) +++ trunk/NEWS 2005-09-04 11:18:13 UTC (rev 82) @@ -1,14 +1,14 @@ -Noteworthy changes for version 0.9.0 +Noteworthy changes for version 0.9.0 (2005-09-04) ================================================= * Major rewrite. Renamed the package to GPGol. Note, that there used to be intermediate versions unter the name OutlGPG -* The package as been renamed to outlgpg and consist of only one DLL +* The package as been renamed to GPGol and consist of only one DLL named "gpgol.dll". Installation of gpgme.dll and libgpg-error.dll is required. -* It may now only be build using the Mingw32 toolchain. +* It may by now only be build using the Mingw32 toolchain. * GPGol now uses the standard GPGME. Modified: trunk/README =================================================================== --- trunk/README 2005-09-03 08:29:29 UTC (rev 81) +++ trunk/README 2005-09-04 11:18:13 UTC (rev 82) @@ -1,7 +1,3 @@ -Package: gpgol -Contact: info-gpgol@g10code.com -Bugs: bug-gpgol@g10code.com - This is a GPG plugin for MS Outlook, formerly known as the G-DATA plugin. There has been no development on this tool for a couple of years and thus we started to rewrite it from scratch. @@ -34,8 +30,9 @@ archive at http://bugs.gnupg.org (use username and password "guest", select "query" and there category "gpgol") if you did not found any information there please send a report, including all relevant version -numbers to the bug email address as given on top of this file. +numbers to the address given at the top of this AUTHORS file. + Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2005-09-03 08:29:29 UTC (rev 81) +++ trunk/configure.ac 2005-09-04 11:18:13 UTC (rev 82) @@ -15,7 +15,7 @@ # Version number: Remember to change it immediately *after* a release. # Add a "-cvs" prefix for non-released code. -AC_INIT(gpgol, 0.9.0-cvs, bug-gpgol@g10code.com) +AC_INIT(gpgol, 0.9.0, bug-gpgol@g10code.com) NEED_GPGME_API=1 NEED_GPGME_VERSION=1.1.0 Modified: trunk/src/olflange.cpp =================================================================== --- trunk/src/olflange.cpp 2005-09-03 08:29:29 UTC (rev 81) +++ trunk/src/olflange.cpp 2005-09-04 11:18:13 UTC (rev 82) @@ -88,11 +88,11 @@ 7 EECONTEXT_READNOTEMESSAGE 8 EECONTEXT_SENDPOSTMESSAGE 9 EECONTEXT_READPOSTMESSAGE - 10 EECONTEXT_READREPORTMESSAGE - 11 EECONTEXT_SENDRESENDMESSAGE - 12 EECONTEXT_PROPERTYSHEETS - 13 EECONTEXT_ADVANCEDCRITERIA - 14 EECONTEXT_TASK + 10 EECONTEXT_READREPORTMESSAGE + 11 EECONTEXT_SENDRESENDMESSAGE + 12 EECONTEXT_PROPERTYSHEETS + 13 EECONTEXT_ADVANCEDCRITERIA + 14 EECONTEXT_TASK */ lstrcat (szEntry, ";11000111111100"); ec = RegCreateKeyEx (HKEY_LOCAL_MACHINE, szKeyBuf, 0, NULL, @@ -954,7 +954,7 @@ && (body = msgcache_get (key, keylen, &refhandle)) && (pDisp = find_outlook_property (pEECB, "Body", &dispid))) { -#if 0 +#if 1 dispparams.cNamedArgs = 1; dispparams.rgdispidNamedArgs = &dispid_put; dispparams.cArgs = 1; @@ -1158,8 +1158,8 @@ m->setExchangeCallback ((void*)pEECB); m->decrypt (hWnd); delete m; - log_debug ("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); - show_window_hierarchy (hWnd, 0); +// log_debug ("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); +// show_window_hierarchy (hWnd, 0); } } if (pMessage) From cvs at cvs.gnupg.org Sun Sep 4 13:44:47 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Sun Sep 4 13:19:19 2005 Subject: [svn] GPGol - r83 - / Message-ID: Author: wk Date: 2005-09-04 13:44:46 +0200 (Sun, 04 Sep 2005) New Revision: 83 Added: tags/ Log: From cvs at cvs.gnupg.org Sun Sep 4 13:45:14 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Sun Sep 4 13:19:56 2005 Subject: [svn] GPGol - r84 - / Message-ID: Author: wk Date: 2005-09-04 13:44:58 +0200 (Sun, 04 Sep 2005) New Revision: 84 Added: branches/ Log: From cvs at cvs.gnupg.org Sun Sep 4 13:45:42 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Sun Sep 4 13:20:03 2005 Subject: [svn] GPGol - r85 - tags Message-ID: Author: wk Date: 2005-09-04 13:45:37 +0200 (Sun, 04 Sep 2005) New Revision: 85 Added: tags/gpgol-0.9.0/ Log: 0.9.0 has been released Copied: tags/gpgol-0.9.0 (from rev 84, trunk) From cvs at cvs.gnupg.org Mon Sep 5 16:36:38 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Mon Sep 5 16:10:53 2005 Subject: [svn] GnuPG - r3882 - branches/GNUPG-1-9-BRANCH/scd Message-ID: Author: wk Date: 2005-09-05 16:36:36 +0200 (Mon, 05 Sep 2005) New Revision: 3882 Modified: branches/GNUPG-1-9-BRANCH/scd/ChangeLog branches/GNUPG-1-9-BRANCH/scd/apdu.c branches/GNUPG-1-9-BRANCH/scd/apdu.h branches/GNUPG-1-9-BRANCH/scd/app-p15.c branches/GNUPG-1-9-BRANCH/scd/iso7816.c branches/GNUPG-1-9-BRANCH/scd/iso7816.h branches/GNUPG-1-9-BRANCH/scd/pcsc-wrapper.c Log: Basically made Belgian EID cards work. Signature creation has not yet been tested. Also other changes to better cope with T=0 cards. Modified: branches/GNUPG-1-9-BRANCH/scd/ChangeLog =================================================================== --- branches/GNUPG-1-9-BRANCH/scd/ChangeLog 2005-09-02 19:23:33 UTC (rev 3881) +++ branches/GNUPG-1-9-BRANCH/scd/ChangeLog 2005-09-05 14:36:36 UTC (rev 3882) @@ -1,3 +1,30 @@ +2005-09-05 Werner Koch + + * iso7816.c (iso7816_select_path): New. + * app-p15.c (select_ef_by_path): Allow for direct path selection. + (app_select_p15): Try using the beigian variant of pkcs#15. + (read_home_df): New. + (read_ef_odf): Generalized. + (read_ef_tokeninfo): New. + (read_p15_info): Set serialnumber from TokenInfo. + (app_select_p15): Don't munge serialNumber - that must be done + only once. + + * iso7816.c (iso7816_read_binary): Use Le=0 when reading all + data. Handle 6C00 error and take 6B00 as indication for EOF. + * apdu.h (SW_EXACT_LENGTH_P): New. + * apdu.c (new_reader_slot, reset_pcsc_reader, pcsc_get_status) + (open_pcsc_reader): Set new reader state IS_T0. + (apdu_send_le): When doing T=0 make sure not to send Lc and Le. + Problem reported by Carl Meijer. + (apdu_send_direct): Initialize RESULTLEN. + * pcsc-wrapper.c (handle_status): Return the current protocol as + a new third word. + +2005-08-05 Werner Koch + + * apdu.c (open_rapdu_reader): Set the reader number. + 2005-07-05 Werner Koch * app-openpgp.c (do_readkey): Return a mallcoed copy of the key as Modified: branches/GNUPG-1-9-BRANCH/scd/apdu.c =================================================================== --- branches/GNUPG-1-9-BRANCH/scd/apdu.c 2005-09-02 19:23:33 UTC (rev 3881) +++ branches/GNUPG-1-9-BRANCH/scd/apdu.c 2005-09-05 14:36:36 UTC (rev 3882) @@ -15,7 +15,8 @@ * * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. * * $Id$ */ @@ -126,6 +127,7 @@ char *rdrname; /* Name of the connected reader or NULL if unknown. */ int last_status; int status; + int is_t0; /* True if we know that we are running T=0. */ unsigned char atr[33]; size_t atrlen; /* A zero length indicates that the ATR has not yet been read; i.e. the card is not @@ -275,7 +277,10 @@ unsigned long timeout); +/* Prototypes. */ +static int pcsc_get_status (int slot, unsigned int *status); + /* Helper @@ -319,6 +324,7 @@ reader_table[reader].used = 1; reader_table[reader].last_status = 0; + reader_table[reader].is_t0 = 1; #ifdef NEED_PCSC_WRAPPER reader_table[reader].pcsc.req_fd = -1; reader_table[reader].pcsc.rsp_fd = -1; @@ -768,6 +774,7 @@ size_t len; int i, n; unsigned char msgbuf[9]; + unsigned int dummy_status; int sw = SW_HOST_CARD_IO_ERROR; slotp = reader_table + slot; @@ -841,6 +848,9 @@ } slotp->atrlen = len; + /* Read the status so that IS_T0 will be set. */ + pcsc_get_status (slot, &dummy_status); + return 0; command_failed: @@ -902,6 +912,7 @@ if (atrlen >= DIM (reader_table[0].atr)) log_bug ("ATR returned by pcsc_status is too large\n"); reader_table[slot].atrlen = atrlen; + reader_table[slot].is_t0 = !!(card_protocol & PCSC_PROTOCOL_T0); return 0; #endif /* !NEED_PCSC_WRAPPER */ @@ -917,7 +928,7 @@ size_t len, full_len; int i, n; unsigned char msgbuf[9]; - unsigned char buffer[12]; + unsigned char buffer[16]; int sw = SW_HOST_CARD_IO_ERROR; slotp = reader_table + slot; @@ -968,14 +979,20 @@ full_len = len; - n = 8 < len ? 8 : len; - if ((i=readn (slotp->pcsc.rsp_fd, buffer, n, &len)) || len != 8) + /* The current version returns 3 words but we allow also for old + versions returning only 2 words. */ + n = 12 < len ? 12 : len; + if ((i=readn (slotp->pcsc.rsp_fd, buffer, n, &len)) + || (len != 8 && len != 12)) { log_error ("error receiving PC/SC STATUS response: %s\n", i? strerror (errno) : "premature EOF"); goto command_failed; } + slotp->is_t0 = (len == 12 && !!(buffer[11] & PCSC_PROTOCOL_T0)); + + full_len -= len; /* Newer versions of the wrapper might send more status bytes. Read them. */ @@ -1296,6 +1313,7 @@ size_t len; unsigned char msgbuf[9]; int err; + unsigned int dummy_status; int sw = SW_HOST_CARD_IO_ERROR; slot = new_reader_slot (); @@ -1440,7 +1458,7 @@ slotp->last_status = 0; - /* The open fucntion may return a zero for the ATR length to + /* The open request may return a zero for the ATR length to indicate that no card is present. */ n = len; if (n) @@ -1463,6 +1481,9 @@ reader_table[slot].send_apdu_reader = pcsc_send_apdu; reader_table[slot].dump_status_reader = dump_pcsc_reader_status; + /* Read the status so that IS_T0 will be set. */ + pcsc_get_status (slot, &dummy_status); + dump_reader_status (slot); return slot; @@ -1596,6 +1617,7 @@ /* If we got to here we know that a card is present and usable. Thus remember this. */ reader_table[slot].last_status = (1|2|4| 0x8000); + reader_table[slot].is_t0 = !!(card_protocol & PCSC_PROTOCOL_T0); } } @@ -1997,6 +2019,7 @@ return -1; } + rapdu_set_reader (slotp->rapdu.handle, portno); rapdu_set_iofunc (slotp->rapdu.handle, readfnc, readfnc_value, @@ -2518,7 +2541,7 @@ if (lc != -1 && (lc > 255 || lc < 0)) return SW_WRONG_LENGTH; - if (le != -1 && (le > 256 || le < 1)) + if (le != -1 && (le > 256 || le < 0)) return SW_WRONG_LENGTH; if ((!data && lc != -1) || (data && lc == -1)) return SW_HOST_INV_VALUE; @@ -2536,9 +2559,13 @@ apdu[apdulen++] = lc; memcpy (apdu+apdulen, data, lc); apdulen += lc; + /* T=0 does not allow the use of Lc together with Le; thus + disable Le in this case. */ + if (reader_table[slot].is_t0) + le = -1; } if (le != -1) - apdu[apdulen++] = le; /* Truncation is okay becuase 0 means 256. */ + apdu[apdulen++] = le; /* Truncation is okay because 0 means 256. */ assert (sizeof (apdu) >= apdulen); /* As safeguard don't pass any garbage from the stack to the driver. */ memset (apdu+apdulen, 0, sizeof (apdu) - apdulen); @@ -2736,14 +2763,14 @@ if ((sw = trylock_slot (slot))) return sw; - /* We simply trucntate a too long APDU. */ + /* We simply trunctate a too long APDU. */ if (apdudatalen > sizeof apdu) apdudatalen = sizeof apdu; apdulen = apdudatalen; memcpy (apdu, apdudata, apdudatalen); class = apdulen? *apdu : 0; - + resultlen = RESULTLEN; rc = send_apdu (slot, apdu, apdulen, result, &resultlen); if (rc || resultlen < 2) { Modified: branches/GNUPG-1-9-BRANCH/scd/apdu.h =================================================================== --- branches/GNUPG-1-9-BRANCH/scd/apdu.h 2005-09-02 19:23:33 UTC (rev 3881) +++ branches/GNUPG-1-9-BRANCH/scd/apdu.h 2005-09-05 14:36:36 UTC (rev 3882) @@ -15,7 +15,8 @@ * * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. * * $Id$ */ @@ -41,6 +42,7 @@ SW_RECORD_NOT_FOUND = 0x6a83, SW_REF_NOT_FOUND = 0x6a88, SW_BAD_P0_P1 = 0x6b00, + SW_EXACT_LENGTH = 0x6c00, SW_INS_NOT_SUP = 0x6d00, SW_CLA_NOT_SUP = 0x6e00, SW_SUCCESS = 0x9000, @@ -65,7 +67,9 @@ }; +#define SW_EXACT_LENGTH_P(a) (((a)&~0xff) == SW_EXACT_LENGTH) + /* Note , that apdu_open_reader returns no status word but -1 on error. */ int apdu_open_reader (const char *portstr); int apdu_open_remote_reader (const char *portstr, Modified: branches/GNUPG-1-9-BRANCH/scd/app-p15.c =================================================================== --- branches/GNUPG-1-9-BRANCH/scd/app-p15.c 2005-09-02 19:23:33 UTC (rev 3881) +++ branches/GNUPG-1-9-BRANCH/scd/app-p15.c 2005-09-05 14:36:36 UTC (rev 3882) @@ -74,7 +74,17 @@ #undef X -/* The Pin Types as defined in pkcs#15 v1.1 */ +/* The AID of PKCS15. */ +static char const pkcs15_aid[] = { 0xA0, 0, 0, 0, 0x63, + 0x50, 0x4B, 0x43, 0x53, 0x2D, 0x31, 0x35 }; + +/* The Belgian eID variant - they didn't understood why a shared AID + is useful for a standard. Oh well. */ +static char const pkcs15be_aid[] = { 0xA0, 0, 0, 0x01, 0x77, + 0x50, 0x4B, 0x43, 0x53, 0x2D, 0x31, 0x35 }; + + +/* The PIN types as defined in pkcs#15 v1.1 */ typedef enum { PIN_TYPE_BCD = 0, @@ -261,6 +271,9 @@ /* The type of the card. */ card_type_t card_type; + /* Flag indicating whether we may use direct path selection. */ + int direct_path_selection; + /* Structure with the EFIDs of the objects described in the ODF file. */ struct @@ -276,6 +289,10 @@ unsigned short auth_objects; } odf; + /* The PKCS#15 serialnumber from EF(TokeiNFo) or NULL. Malloced. */ + unsigned char *serialno; + size_t serialnolen; + /* Information on all certificates. */ cdf_object_t certificate_info; /* Information on all trusted certificates. */ @@ -363,6 +380,7 @@ release_cdflist (app->app_local->useful_certificate_info); release_prkdflist (app->app_local->private_key_info); release_aodflist (app->app_local->auth_object_info); + xfree (app->app_local->serialno); xfree (app->app_local); app->app_local = NULL; } @@ -406,26 +424,44 @@ gpg_error_t err; int i, j; - /* FIXME: Need code to remember the last PATH so that we can decide - what select commands to send in case the path does not start off - with 3F00. We might also want to use direct path selection if - supported by the card. */ + if (!pathlen) + return gpg_error (GPG_ERR_INV_VALUE); + if (pathlen && *path != 0x3f00 ) log_debug ("WARNING: relative path selection not yet implemented\n"); - - for (i=0; i < pathlen; i++) + + if (app->app_local->direct_path_selection) { - err = iso7816_select_file (app->slot, path[i], - !(i+1 == pathlen), NULL, NULL); + err = iso7816_select_path (app->slot, path+1, pathlen-1, NULL, NULL); if (err) { - log_error ("error selecting part %d from path ", i); + log_error ("error selecting path "); for (j=0; j < pathlen; j++) log_printf ("%04hX", path[j]); log_printf (": %s\n", gpg_strerror (err)); return err; } } + else + { + /* FIXME: Need code to remember the last PATH so that we can decide + what select commands to send in case the path does not start off + with 3F00. We might also want to use direct path selection if + supported by the card. */ + for (i=0; i < pathlen; i++) + { + err = iso7816_select_file (app->slot, path[i], + !(i+1 == pathlen), NULL, NULL); + if (err) + { + log_error ("error selecting part %d from path ", i); + for (j=0; j < pathlen; j++) + log_printf ("%04hX", path[j]); + log_printf (": %s\n", gpg_strerror (err)); + return err; + } + } + } return 0; } @@ -586,12 +622,13 @@ } else if ( buflen >= 12 && (p[0] & 0xf0) == 0xA0 - && !memcmp (p+1, "\x0a\x30\x08\x04\x06\x3F\x00\x50\x15", 9) - && app->app_local->home_df == 0x5015 ) + && !memcmp (p+1, "\x0a\x30\x08\x04\x06\x3F\x00", 7) + && app->app_local->home_df == ((p[8]<<8)|p[9]) ) { - /* This format using a full path is used by a self-created - test card of mine. I have not checked whether this is - legal. We assume a home DF of 0x5015 here. */ + /* We only allow a full path if all files are at the same + level and below the home directory. The extend this we + would need to make use of new data type capable of + keeping a full path. */ offset = 10; } else @@ -2158,14 +2195,83 @@ */ -/* static gpg_error_t */ -/* read_ef_tokeninfo (app_t app) */ -/* { */ -/* unsigned short efid = 0x5032; */ -/* return 0; */ -/* } */ +static gpg_error_t +read_ef_tokeninfo (app_t app) +{ + gpg_error_t err; + unsigned char *buffer = NULL; + size_t buflen; + const unsigned char *p; + size_t n, objlen, hdrlen; + int class, tag, constructed, ndef; + unsigned long ul; + + err = select_and_read_binary (app->slot, 0x5032, "TokenInfo", + &buffer, &buflen); + if (err) + return err; + + p = buffer; + n = buflen; + err = parse_ber_header (&p, &n, &class, &tag, &constructed, + &ndef, &objlen, &hdrlen); + if (!err && (objlen > n || tag != TAG_SEQUENCE)) + err = gpg_error (GPG_ERR_INV_OBJ); + if (err) + { + log_error ("error parsing TokenInfo: %s\n", gpg_strerror (err)); + goto leave; + } + n = objlen; + + /* Version. */ + err = parse_ber_header (&p, &n, &class, &tag, &constructed, + &ndef, &objlen, &hdrlen); + if (!err && (objlen > n || tag != TAG_INTEGER)) + err = gpg_error (GPG_ERR_INV_OBJ); + if (err) + goto leave; + + for (ul=0; objlen; objlen--) + { + ul <<= 8; + ul |= (*p++) & 0xff; + n--; + } + if (ul) + { + log_error ("invalid version %lu in TokenInfo\n", ul); + err = gpg_error (GPG_ERR_INV_OBJ); + goto leave; + } + + /* serialNumber. */ + err = parse_ber_header (&p, &n, &class, &tag, &constructed, + &ndef, &objlen, &hdrlen); + if (!err && (objlen > n || tag != TAG_OCTET_STRING || !objlen)) + err = gpg_error (GPG_ERR_INV_OBJ); + if (err) + goto leave; + + xfree (app->app_local->serialno); + app->app_local->serialno = xtrymalloc (objlen); + if (!app->app_local->serialno) + { + err = gpg_error_from_errno (errno); + goto leave; + } + memcpy (app->app_local->serialno, p, objlen); + app->app_local->serialnolen = objlen; + log_printhex ("Serialnumber from EF(TokenInfo) is:", p, objlen); + + leave: + xfree (buffer); + return err; +} + + /* Get all the basic information from the pkcs#15 card, check the structure and initialize our local context. This is used once at application initialization. */ @@ -2174,11 +2280,25 @@ { gpg_error_t err; - /* Fixme: We might need to read the tokeninfo to get a non-standard - ODF FID. */ - + if (!read_ef_tokeninfo (app)) + { + /* If we don't have a serial number yet but the TokenInfo provides + one, use that. */ + if (!app->serialno && app->app_local->serialno) + { + app->serialno = app->app_local->serialno; + app->serialnolen = app->app_local->serialnolen; + app->app_local->serialno = NULL; + app->app_local->serialnolen = 0; + err = app_munge_serialno (app); + if (err) + return err; + } + } + /* Read the ODF so that we know the location of all directory files. */ + /* Fixme: We might need to get a non-standard ODF FID from TokenInfo. */ err = read_ef_odf (app, 0x5031); if (err) return err; @@ -2895,22 +3015,88 @@ } + +/* Assume that EF(DIR) has been selected. Read its content and figure + out the home EF of pkcs#15. Return that home DF or 0 if not + found. */ +static unsigned short +read_home_df (int slot) +{ + gpg_error_t err; + unsigned char *buffer; + const unsigned char *p, *pp; + size_t buflen, n, nn; + unsigned short result = 0; + err = iso7816_read_binary (slot, 0, 0, &buffer, &buflen); + if (err) + { + log_error ("error reading EF{DIR}: %s\n", gpg_strerror (err)); + return 0; + } -/* Select the PKCS#15 application on the card in SLOT. */ + /* FIXME: We need to scan all records. */ + p = find_tlv (buffer, buflen, 0x61, &n); + if (p && n) + { + pp = find_tlv (p, n, 0x4f, &nn); + if (pp + && ((nn == sizeof pkcs15_aid && !memcmp (pp, pkcs15_aid, nn)) + ||(nn == sizeof pkcs15be_aid && !memcmp (pp, pkcs15be_aid, nn)))) + { + pp = find_tlv (p, n, 0x50, &nn); + if (pp) /* fixme: Filter log value? */ + log_info ("pkcs#15 application label from EF(DIR) is `%.*s'\n", + (int)nn, pp); + pp = find_tlv (p, n, 0x51, &nn); + if (pp && nn == 4 && *pp == 0x3f && !pp[1]) + { + result = ((pp[2] << 8) | pp[3]); + log_info ("pkcs#15 application directory is 0x%04hX\n", result); + } + } + } + xfree (buffer); + return result; +} + + +/* + Select the PKCS#15 application on the card in SLOT. + */ gpg_error_t app_select_p15 (app_t app) { - static char const aid[] = { 0xA0, 0, 0, 0, 0x63, - 0x50, 0x4B, 0x43, 0x53, 0x2D, 0x31, 0x35 }; int slot = app->slot; int rc; unsigned short def_home_df = 0; card_type_t card_type = CARD_TYPE_UNKNOWN; + int direct = 0; - rc = iso7816_select_application (slot, aid, sizeof aid); + rc = iso7816_select_application (slot, pkcs15_aid, sizeof pkcs15_aid); if (rc) - { + rc = iso7816_select_application (slot, pkcs15be_aid, sizeof pkcs15be_aid); + if (rc) + { /* Not found: Try to locate it from 2F00. We use direct path + selection here because it seems that the Belgian eID card + does only allow for that. Many other cards supports this + selection method too. */ + unsigned short path[1] = { 0x2f00 }; + + rc = iso7816_select_path (app->slot, path, 1, NULL, NULL); + if (!rc) + { + direct = 1; + def_home_df = read_home_df (slot); + if (def_home_df) + { + path[0] = def_home_df; + rc = iso7816_select_path (app->slot, path, 1, NULL, NULL); + } + } + } + if (rc) + { /* Still not found: Try the default DF. */ def_home_df = 0x5015; rc = iso7816_select_file (slot, def_home_df, 1, NULL, NULL); } @@ -2958,6 +3144,9 @@ the common APP structure. */ app->app_local->card_type = card_type; + /* Store whether we may and should use direct path selection. */ + app->app_local->direct_path_selection = direct; + /* Read basic information and thus check whether this is a real card. */ rc = read_p15_info (app); @@ -2989,8 +3178,6 @@ app->serialno = p; } } - else /* Use standard munging code. */ - rc = app_munge_serialno (app); app->fnc.deinit = do_deinit; app->fnc.learn_status = do_learn_status; Modified: branches/GNUPG-1-9-BRANCH/scd/iso7816.c =================================================================== --- branches/GNUPG-1-9-BRANCH/scd/iso7816.c 2005-09-02 19:23:33 UTC (rev 3881) +++ branches/GNUPG-1-9-BRANCH/scd/iso7816.c 2005-09-05 14:36:36 UTC (rev 3882) @@ -77,6 +77,7 @@ case SW_RECORD_NOT_FOUND:ec= GPG_ERR_NOT_FOUND; break; case SW_REF_NOT_FOUND: ec = GPG_ERR_NO_OBJ; break; case SW_BAD_P0_P1: ec = GPG_ERR_INV_VALUE; break; + case SW_EXACT_LENGTH: ec = GPG_ERR_INV_VALUE; break; case SW_INS_NOT_SUP: ec = GPG_ERR_CARD; break; case SW_CLA_NOT_SUP: ec = GPG_ERR_CARD; break; case SW_SUCCESS: ec = 0; break; @@ -161,6 +162,39 @@ } +/* Do a select file command with a direct path. */ +gpg_error_t +iso7816_select_path (int slot, const unsigned short *path, size_t pathlen, + unsigned char **result, size_t *resultlen) +{ + int sw, p0, p1; + unsigned char buffer[100]; + int buflen; + + if (result || resultlen) + { + *result = NULL; + *resultlen = 0; + return gpg_error (GPG_ERR_NOT_IMPLEMENTED); + } + + if (pathlen/2 >= sizeof buffer) + return gpg_error (GPG_ERR_TOO_LARGE); + + for (buflen = 0; pathlen; pathlen--, path++) + { + buffer[buflen++] = (*path >> 8); + buffer[buflen++] = *path; + } + + p0 = 0x08; + p1 = 0x0c; /* No FC return. */ + sw = apdu_send_simple (slot, 0x00, CMD_SELECT_FILE, + p0, p1, buflen, (char*)buffer ); + return map_sw (sw); +} + + /* This is a private command currently only working for TCOS cards. */ gpg_error_t iso7816_list_directory (int slot, int list_dirs, @@ -524,8 +558,10 @@ { buffer = NULL; bufferlen = 0; - /* Fixme: Either the ccid driver or the TCOS cards have problems - with an Le of 0. */ + /* Note, that we to set N to 254 due to problems either with the + ccid driver or some TCOS cards. It actually should be 0 + which is the official ISO value to read a variable length + object. */ if (read_all || nmax > 254) n = 254; else @@ -533,7 +569,22 @@ sw = apdu_send_le (slot, 0x00, CMD_READ_BINARY, ((offset>>8) & 0xff), (offset & 0xff) , -1, NULL, n, &buffer, &bufferlen); + if ( SW_EXACT_LENGTH_P(sw) ) + { + n = (sw & 0x00ff); + sw = apdu_send_le (slot, 0x00, CMD_READ_BINARY, + ((offset>>8) & 0xff), (offset & 0xff) , -1, NULL, + n, &buffer, &bufferlen); + } + if (*result && sw == SW_BAD_P0_P1) + { + /* Bad Parameter means that the offset is outside of the + EF. When reading all data we take this as an indication + for EOF. */ + break; + } + if (sw != SW_SUCCESS && sw != SW_EOF_REACHED) { /* Make sure that pending buffers are released. */ Modified: branches/GNUPG-1-9-BRANCH/scd/iso7816.h =================================================================== --- branches/GNUPG-1-9-BRANCH/scd/iso7816.h 2005-09-02 19:23:33 UTC (rev 3881) +++ branches/GNUPG-1-9-BRANCH/scd/iso7816.h 2005-09-05 14:36:36 UTC (rev 3882) @@ -33,6 +33,9 @@ const char *aid, size_t aidlen); gpg_error_t iso7816_select_file (int slot, int tag, int is_dir, unsigned char **result, size_t *resultlen); +gpg_error_t iso7816_select_path (int slot, + const unsigned short *path, size_t pathlen, + unsigned char **result, size_t *resultlen); gpg_error_t iso7816_list_directory (int slot, int list_dirs, unsigned char **result, size_t *resultlen); gpg_error_t iso7816_verify (int slot, Modified: branches/GNUPG-1-9-BRANCH/scd/pcsc-wrapper.c =================================================================== --- branches/GNUPG-1-9-BRANCH/scd/pcsc-wrapper.c 2005-09-02 19:23:33 UTC (rev 3881) +++ branches/GNUPG-1-9-BRANCH/scd/pcsc-wrapper.c 2005-09-05 14:36:36 UTC (rev 3882) @@ -15,7 +15,8 @@ * * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. */ /* @@ -587,6 +588,11 @@ buf[5] = (rdrstates[0].event_state >> 16); buf[6] = (rdrstates[0].event_state >> 8); buf[7] = (rdrstates[0].event_state >> 0); + /* The third word is the protocol. */ + buf[8] = (pcsc_protocol >> 24); + buf[9] = (pcsc_protocol >> 16); + buf[10] = (pcsc_protocol >> 8); + buf[11] = (pcsc_protocol); request_succeeded (buf, 8); } From cvs at cvs.gnupg.org Tue Sep 6 12:25:41 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue Sep 6 11:59:50 2005 Subject: [svn] GnuPG - r3883 - branches/GNUPG-1-9-BRANCH/tools Message-ID: Author: wk Date: 2005-09-06 12:25:41 +0200 (Tue, 06 Sep 2005) New Revision: 3883 Modified: branches/GNUPG-1-9-BRANCH/tools/ChangeLog branches/GNUPG-1-9-BRANCH/tools/rfc822parse.c branches/GNUPG-1-9-BRANCH/tools/rfc822parse.h Log: Changed license of this parser to LPGL. Modified: branches/GNUPG-1-9-BRANCH/tools/ChangeLog =================================================================== --- branches/GNUPG-1-9-BRANCH/tools/ChangeLog 2005-09-05 14:36:36 UTC (rev 3882) +++ branches/GNUPG-1-9-BRANCH/tools/ChangeLog 2005-09-06 10:25:41 UTC (rev 3883) @@ -1,3 +1,7 @@ +2005-09-06 Werner Koch + + * rfc822parse.c, rfc822parse.h: Changed license to LGPL. + 2005-08-01 Werner Koch * gpgsm-gencert.sh: Allow entering a keygrip to generate a CSR from Modified: branches/GNUPG-1-9-BRANCH/tools/rfc822parse.c =================================================================== --- branches/GNUPG-1-9-BRANCH/tools/rfc822parse.c 2005-09-05 14:36:36 UTC (rev 3882) +++ branches/GNUPG-1-9-BRANCH/tools/rfc822parse.c 2005-09-06 10:25:41 UTC (rev 3883) @@ -3,31 +3,31 @@ * Copyright (C) 2003, 2004 g10 Code GmbH * * This program 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 is distributed in the hope that it will be useful, + * 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. + * + * This program 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. */ -/* According to RFC822 binary 0 are allowed at many places. We - * do not handle this correct especially in the field parsing code. It - * should be easy to fix and the API provides a interfcaes which returns - * the length but in addition makes sure that returned strings are always - * ended by a \0. +/* According to RFC822 binary zeroes are allowed at many places. We do + * not handle this correct especially in the field parsing code. It + * should be easy to fix and the API provides a interfaces which + * returns the length but in addition makes sure that returned strings + * are always ended by a \0. * * Furthermore, the case of field names is changed and thus it is not * always a good idea to use these modified header * lines (e.g. signatures may break). - * */ #ifdef HAVE_CONFIG_H @@ -44,13 +44,13 @@ #include "rfc822parse.h" enum token_type -{ - tSPACE, - tATOM, - tQUOTED, - tDOMAINLIT, - tSPECIAL -}; + { + tSPACE, + tATOM, + tQUOTED, + tDOMAINLIT, + tSPECIAL + }; /* For now we directly use our TOKEN as the parse context */ typedef struct rfc822parse_field_context *TOKEN; Modified: branches/GNUPG-1-9-BRANCH/tools/rfc822parse.h =================================================================== --- branches/GNUPG-1-9-BRANCH/tools/rfc822parse.h 2005-09-05 14:36:36 UTC (rev 3882) +++ branches/GNUPG-1-9-BRANCH/tools/rfc822parse.h 2005-09-06 10:25:41 UTC (rev 3883) @@ -3,18 +3,19 @@ * Copyright (C) 2003, g10 Code GmbH * * This program 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 - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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. + * + * This program 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. */ #ifndef RFC822PARSE_H From cvs at cvs.gnupg.org Tue Sep 6 13:25:13 2005 From: cvs at cvs.gnupg.org (svn author twoaday) Date: Tue Sep 6 12:59:22 2005 Subject: [svn] GPGol - r86 - trunk/src Message-ID: Author: twoaday Date: 2005-09-06 13:25:12 +0200 (Tue, 06 Sep 2005) New Revision: 86 Modified: trunk/src/ChangeLog trunk/src/HashTable.cpp trunk/src/config-dialog.c Log: See ChangeLog. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2005-09-04 11:45:37 UTC (rev 85) +++ trunk/src/ChangeLog 2005-09-06 11:25:12 UTC (rev 86) @@ -1,3 +1,9 @@ +2005-09-06 Timo Schulz + + * config-dialog.c (get_open_file_name): Correctly terminated filter. + New parameter for the title. Changed all callers. + (get_folder): Likewise. + 2005-09-01 Werner Koch * gpgmsg.cpp (get_pgp_armor_type): New. Modified: trunk/src/HashTable.cpp =================================================================== --- trunk/src/HashTable.cpp 2005-09-04 11:45:37 UTC (rev 85) +++ trunk/src/HashTable.cpp 2005-09-06 11:25:12 UTC (rev 86) @@ -55,12 +55,14 @@ memset (table, 0, sizeof (void*)*n); } -HashTable::HashTable (unsigned int n) +HashTable::HashTable (unsigned int nelem) { pos = 0; - this->n = n; - table = new void*[n]; - memset (table, 0, sizeof (void*)*n); + if (nelem < 1) + nelem = 1; + this->n = nelem; + table = new void*[nelem]; + memset (table, 0, sizeof (void*)*nelem); } HashTable::~HashTable (void) Modified: trunk/src/config-dialog.c =================================================================== --- trunk/src/config-dialog.c 2005-09-04 11:45:37 UTC (rev 85) +++ trunk/src/config-dialog.c 2005-09-06 11:25:12 UTC (rev 86) @@ -41,24 +41,24 @@ #define GPGOL_REGPATH "Software\\GNU\\GPGol" static char* -get_open_file_name (const char *dir) +get_open_file_name (const char *dir, const char *title) { - static char fname[MAX_PATH+1]; - OPENFILENAME ofn; + static char fname[MAX_PATH+1]; + OPENFILENAME ofn; - memset (&ofn, 0, sizeof (ofn)); - memset (fname, 0, sizeof (fname)); - ofn.hwndOwner = GetDesktopWindow(); - ofn.hInstance = glob_hinst; - ofn.lpstrTitle = "Select GnuPG binary"; - ofn.lStructSize = sizeof (ofn); - ofn.lpstrInitialDir = dir; - ofn.lpstrFilter = "*.EXE"; - ofn.lpstrFile = fname; - ofn.nMaxFile = sizeof(fname)-1; - if (GetOpenFileName(&ofn) == FALSE) - return NULL; - return fname; + memset (&ofn, 0, sizeof (ofn)); + memset (fname, 0, sizeof (fname)); + ofn.hwndOwner = GetDesktopWindow (); + ofn.hInstance = glob_hinst; + ofn.lpstrTitle = title; + ofn.lStructSize = sizeof (ofn); + ofn.lpstrInitialDir = dir; + ofn.lpstrFilter = "EXE-Files (*.EXE)\0*.EXE"; + ofn.lpstrFile = fname; + ofn.nMaxFile = sizeof (fname)-1; + if (GetOpenFileName (&ofn) == FALSE) + return NULL; + return fname; } @@ -76,24 +76,25 @@ /* Open the common dialog to select a folder. Caller has to free the string. */ static char* -get_folder (void) +get_folder (const char *title) { - char fname[MAX_PATH+1]; - BROWSEINFO bi; - ITEMIDLIST * il; - char *path = NULL; + char fname[MAX_PATH+1]; + BROWSEINFO bi; + ITEMIDLIST * il; + char *path = NULL; - memset (&bi, 0, sizeof (bi)); - memset (fname, 0, sizeof (fname)); - bi.hwndOwner = GetDesktopWindow (); - bi.lpszTitle = "Select GnuPG home directory"; - il = SHBrowseForFolder (&bi); - if (il != NULL) { - SHGetPathFromIDList (il, fname); - path = xstrdup (fname); - SHFree (il); + memset (&bi, 0, sizeof (bi)); + memset (fname, 0, sizeof (fname)); + bi.hwndOwner = GetDesktopWindow (); + bi.lpszTitle = title; + il = SHBrowseForFolder (&bi); + if (il != NULL) + { + SHGetPathFromIDList (il, fname); + path = xstrdup (fname); + SHFree (il); } - return path; + return path; } @@ -258,14 +259,14 @@ static void error_box (const char *title) { - TCHAR buf[256]; - DWORD last_err; + TCHAR buf[256]; + DWORD last_err; - last_err = GetLastError (); - FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL, last_err, - MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), - buf, sizeof (buf)-1, NULL); - MessageBox (NULL, buf, title, MB_OK); + last_err = GetLastError (); + FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL, last_err, + MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), + buf, sizeof (buf)-1, NULL); + MessageBox (NULL, buf, title, MB_OK); } @@ -297,22 +298,22 @@ break; case WM_COMMAND: - switch (LOWORD(wparam)) { + switch (LOWORD (wparam)) { case IDC_OPT_SELPRG: - buf = get_open_file_name (NULL); + buf = get_open_file_name (NULL, "Select GnuPG Binary"); if (buf && *buf) SetDlgItemText(dlg, IDC_OPT_GPGPRG, buf); break; case IDC_OPT_SELHOMEDIR: - buf = get_folder (); + buf = get_folder ("Select GnuPG Home Directory"); if (buf && *buf) SetDlgItemText(dlg, IDC_OPT_HOMEDIR, buf); xfree (buf); break; case IDC_OPT_SELKEYMAN: - buf = get_open_file_name (NULL); + buf = get_open_file_name (NULL, "Select GnuPG Key Manager"); if (buf && *buf) SetDlgItemText (dlg, IDC_OPT_KEYMAN, buf); break; @@ -353,17 +354,18 @@ void config_dialog_box (HWND parent) { - int resid=0; + int resid=0; - switch (GetUserDefaultLangID ()) { + switch (GetUserDefaultLangID ()) + { case 0x0407: resid = IDD_OPT_DE;break; default: resid = IDD_OPT; break; } - if (parent == NULL) - parent = GetDesktopWindow (); - DialogBoxParam (glob_hinst, (LPCTSTR)resid, parent, - config_dlg_proc, 0); + if (parent == NULL) + parent = GetDesktopWindow (); + DialogBoxParam (glob_hinst, (LPCTSTR)resid, parent, + config_dlg_proc, 0); } @@ -412,8 +414,6 @@ } } } - - /* Create startup info for the keymanager process. */ memset (&si, 0, sizeof (si)); @@ -423,10 +423,11 @@ if (CreateProcess (NULL, keyman, NULL, NULL, TRUE, CREATE_DEFAULT_ERROR_MODE, - NULL, NULL, &si, &pi) == TRUE) { - CloseHandle (pi.hProcess); - CloseHandle (pi.hThread); - } + NULL, NULL, &si, &pi) == TRUE) + { + CloseHandle (pi.hProcess); + CloseHandle (pi.hThread); + } xfree (keyman); return 0; From cvs at cvs.gnupg.org Tue Sep 6 13:57:04 2005 From: cvs at cvs.gnupg.org (svn author twoaday) Date: Tue Sep 6 13:31:13 2005 Subject: [svn] GPGol - r87 - trunk/src Message-ID: Author: twoaday Date: 2005-09-06 13:56:58 +0200 (Tue, 06 Sep 2005) New Revision: 87 Modified: trunk/src/config-dialog.c trunk/src/olflange.cpp Log: Forgot double NUL at the end. Modified: trunk/src/config-dialog.c =================================================================== --- trunk/src/config-dialog.c 2005-09-06 11:25:12 UTC (rev 86) +++ trunk/src/config-dialog.c 2005-09-06 11:56:58 UTC (rev 87) @@ -53,7 +53,7 @@ ofn.lpstrTitle = title; ofn.lStructSize = sizeof (ofn); ofn.lpstrInitialDir = dir; - ofn.lpstrFilter = "EXE-Files (*.EXE)\0*.EXE"; + ofn.lpstrFilter = "EXE-Files (*.EXE)\0*.EXE\0\0"; ofn.lpstrFile = fname; ofn.nMaxFile = sizeof (fname)-1; if (GetOpenFileName (&ofn) == FALSE) Modified: trunk/src/olflange.cpp =================================================================== --- trunk/src/olflange.cpp 2005-09-06 11:25:12 UTC (rev 86) +++ trunk/src/olflange.cpp 2005-09-06 11:56:58 UTC (rev 87) @@ -655,6 +655,7 @@ hr = pEECB->GetObject (&pMDB, (LPMAPIPROP *)&pMessage); if (SUCCEEDED (hr)) { + show_mapi_property (pMessage, PR_SUBJECT, "PR_SUBJECT"); GpgMsg *m = CreateGpgMsg (pMessage); m->setExchangeCallback ((void*)pEECB); m->setSilent (1); From cvs at cvs.gnupg.org Wed Sep 7 08:53:59 2005 From: cvs at cvs.gnupg.org (svn author twoaday) Date: Wed Sep 7 08:28:03 2005 Subject: [svn] GPGol - r89 - trunk/src Message-ID: Author: twoaday Date: 2005-09-07 08:53:58 +0200 (Wed, 07 Sep 2005) New Revision: 89 Modified: trunk/src/ChangeLog trunk/src/intern.h trunk/src/mymapi.h trunk/src/olflange.cpp Log: See ChangeLog. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2005-09-06 14:50:21 UTC (rev 88) +++ trunk/src/ChangeLog 2005-09-07 06:53:58 UTC (rev 89) @@ -1,3 +1,9 @@ +2005-09-07 Timo Schulz + + * olflange.cpp (ul_release): New. Wrapper with error checking + around UlRelease. + (InstallCommands): Separate test for type and if string is empty. + 2005-09-06 Werner Koch * engine-gpgme.c (op_decrypt_stream): Factored most code out to .. Modified: trunk/src/intern.h =================================================================== --- trunk/src/intern.h 2005-09-06 14:50:21 UTC (rev 88) +++ trunk/src/intern.h 2005-09-07 06:53:58 UTC (rev 89) @@ -43,7 +43,7 @@ OPT_FLAG_ARMOR = 1, OPT_FLAG_TEXT = 2, OPT_FLAG_FORCE = 4, - OPT_FLAG_CANCEL = 8, + OPT_FLAG_CANCEL = 8 }; Modified: trunk/src/mymapi.h =================================================================== --- trunk/src/mymapi.h 2005-09-06 14:50:21 UTC (rev 88) +++ trunk/src/mymapi.h 2005-09-07 06:53:58 UTC (rev 89) @@ -685,6 +685,8 @@ SCODE WINAPI MAPIAllocateBuffer (ULONG, LPVOID FAR *); ULONG WINAPI MAPIFreeBuffer (LPVOID); +void MAPIUninitialize (void); +HRESULT MAPIInitialize (LPVOID lpMapiInit); #if defined (UNICODE) HRESULT WINAPI OpenStreamOnFile(LPALLOCATEBUFFER,LPFREEBUFFER, Modified: trunk/src/olflange.cpp =================================================================== --- trunk/src/olflange.cpp 2005-09-06 14:50:21 UTC (rev 88) +++ trunk/src/olflange.cpp 2005-09-07 06:53:58 UTC (rev 89) @@ -169,30 +169,48 @@ STDAPI DllUnregisterServer (void) { - HKEY hkey; - CHAR szKeyBuf[1024]; + HKEY hkey; + CHAR buf[512]; + DWORD ntemp; + long res; - lstrcpy(szKeyBuf, "Software\\Microsoft\\Exchange\\Client\\Extensions"); - /* create and open key and subkey */ - long lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKeyBuf, 0, NULL, - REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, - NULL, &hkey, NULL); - if (lResult != ERROR_SUCCESS) { - log_debug ("DllUnregisterServer: access denied.\n"); - return E_ACCESSDENIED; + strcpy (buf, "Software\\Microsoft\\Exchange\\Client\\Extensions"); + /* create and open key and subkey */ + res = RegCreateKeyEx (HKEY_LOCAL_MACHINE, buf, 0, NULL, + REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, + NULL, &hkey, NULL); + if (res != ERROR_SUCCESS) + { + log_debug ("DllUnregisterServer: access denied.\n"); + return E_ACCESSDENIED; } - RegDeleteValue (hkey, "GPGol"); - /* set outlook update flag */ - CHAR szEntry[512]; - strcpy (szEntry, "4.0;Outxxx.dll;7;000000000000000;0000000000;OutXXX"); - DWORD dwTemp = lstrlen (szEntry) + 1; - RegSetValueEx (hkey, "Outlook Setup Extension", 0, REG_SZ, (BYTE*) szEntry, dwTemp); - RegCloseKey (hkey); + RegDeleteValue (hkey, "GPGol"); + + /* set outlook update flag */ + strcpy (buf, "4.0;Outxxx.dll;7;000000000000000;0000000000;OutXXX"); + ntemp = strlen (buf) + 1; + RegSetValueEx (hkey, "Outlook Setup Extension", 0, + REG_SZ, (BYTE*) buf, ntemp); + RegCloseKey (hkey); + + return S_OK; +} - return S_OK; +/* Wrapper around UlRelease with error checking. */ +static void +ul_release (LPVOID punk) +{ + ULONG res; + + if (!punk) + return; + res = UlRelease (punk); + if (res != S_OK) + log_debug ("%s UlRelease(%p) failed: %lu\n", __func__, punk, res); } + /* DISPLAY a MAPI property. */ static void show_mapi_property (LPMESSAGE message, ULONG prop, const char *propname) @@ -299,15 +317,15 @@ return NULL; } - hr = pDisp->GetIDsOfNames(IID_NULL, &wname, 1, - LOCALE_SYSTEM_DEFAULT, &dispid); + hr = pDisp->GetIDsOfNames (IID_NULL, &wname, 1, + LOCALE_SYSTEM_DEFAULT, &dispid); xfree (wname); //log_debug (" dispid(%s)=%d (hr=0x%x)\n", name, dispid, hr); if (r_dispid) *r_dispid = dispid; log_debug ("%s:%s: got IDispatch=%p dispid=%u\n", - __FILE__, __func__, pDisp, (unsigned int)dispid); + __FILE__, __func__, pDisp, (unsigned int)dispid); return pDisp; } @@ -390,7 +408,7 @@ return -1; hr = ((LPEXCHEXTCALLBACK)pEECB)->GetObject (&pMDB, (LPMAPIPROP *)&pMessage); - if (FAILED(hr)) + if (FAILED (hr)) log_debug ("%s:%s: getObject failed: hr=%#lx\n", __FILE__, __func__, hr); else if ( (pDisp = find_outlook_property ((LPEXCHEXTCALLBACK)pEECB, key, &dispid))) @@ -401,22 +419,20 @@ dispparams.rgvarg = &aVariant; dispparams.rgvarg[0].vt = VT_LPWSTR; dispparams.rgvarg[0].bstrVal = utf8_to_wchar (value); - hr = pDisp->Invoke(dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT, - DISPATCH_PROPERTYPUT, &dispparams, - NULL, NULL, NULL); + hr = pDisp->Invoke (dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT, + DISPATCH_PROPERTYPUT, &dispparams, + NULL, NULL, NULL); xfree (dispparams.rgvarg[0].bstrVal); log_debug ("%s:%s: PROPERTYPUT(%s) result -> %#lx\n", __FILE__, __func__, key, hr); - pDisp->Release(); + pDisp->Release (); pDisp = NULL; result = 0; } - if (pMessage) - UlRelease(pMessage); - if (pMDB) - UlRelease(pMDB); + ul_release (pMessage); + ul_release (pMDB); return result; } @@ -454,6 +470,7 @@ if (!g_bInitDll) { + /*MAPIInitialize (NULL);*/ read_options (); op_init (); g_bInitDll = TRUE; @@ -472,6 +489,7 @@ { if (g_bInitDll) { + /*MAPIUninitialize ();*/ op_deinit (); write_options (); g_bInitDll = FALSE; @@ -594,7 +612,7 @@ m_pExchExt = pParentInterface; m_lRef = 0; m_bOnSubmitActive = FALSE; -}; +} STDMETHODIMP @@ -627,10 +645,8 @@ log_debug ("%s:%s: received\n", __FILE__, __func__); pEECB->GetObject (&pMDB, (LPMAPIPROP *)&pMessage); show_mapi_property (pMessage, PR_CONVERSATION_INDEX,"PR_CONVERSATION_INDEX"); - if (pMessage) - UlRelease(pMessage); - if (pMDB) - UlRelease(pMDB); + ul_release (pMessage); + ul_release (pMDB); return S_FALSE; } @@ -655,17 +671,14 @@ hr = pEECB->GetObject (&pMDB, (LPMAPIPROP *)&pMessage); if (SUCCEEDED (hr)) { - show_mapi_property (pMessage, PR_SUBJECT, "PR_SUBJECT"); GpgMsg *m = CreateGpgMsg (pMessage); m->setExchangeCallback ((void*)pEECB); m->setSilent (1); m->decrypt (hWnd); delete m; } - if (pMessage) - UlRelease(pMessage); - if (pMDB) - UlRelease(pMDB); + ul_release (pMessage); + ul_release (pMDB); } @@ -732,10 +745,8 @@ } } - if (msg) - UlRelease(msg); - if (pMDB) - UlRelease(pMDB); + ul_release (msg); + ul_release (pMDB); return hrReturn; } @@ -801,7 +812,7 @@ m_nToolbarBitmap1 = 0; m_nToolbarBitmap2 = 0; m_hWnd = NULL; -}; +} @@ -929,10 +940,10 @@ if (hr != S_OK) log_debug ("%s:%s: retrieving ConversationIndex failed: %#lx", __FILE__, __func__, hr); - else if (aVariant.vt != VT_BSTR || !aVariant.bstrVal) + else if (aVariant.vt != VT_BSTR) log_debug ("%s:%s: ConversationIndex is not a string (%d)", __FILE__, __func__, aVariant.vt); - else + else if (aVariant.bstrVal) { char *p; @@ -985,10 +996,8 @@ xfree (key); } - if (pMessage) - UlRelease(pMessage); - if (pMDB) - UlRelease(pMDB); + ul_release (pMessage); + ul_release (pMDB); } @@ -1163,10 +1172,8 @@ // show_window_hierarchy (hWnd, 0); } } - if (pMessage) - UlRelease(pMessage); - if (pMDB) - UlRelease(pMDB); + ul_release (pMessage); + ul_release (pMDB); } else if (m_lContext == EECONTEXT_SENDNOTEMESSAGE) { From cvs at cvs.gnupg.org Wed Sep 7 17:53:04 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed Sep 7 17:27:17 2005 Subject: [svn] GnuPG - r3885 - trunk/g10 Message-ID: Author: wk Date: 2005-09-07 17:53:03 +0200 (Wed, 07 Sep 2005) New Revision: 3885 Modified: trunk/g10/ChangeLog trunk/g10/card-util.c trunk/g10/misc.c trunk/g10/passphrase.c Log: Add "help" sub option to --*-options. Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2005-09-06 18:42:13 UTC (rev 3884) +++ trunk/g10/ChangeLog 2005-09-07 15:53:03 UTC (rev 3885) @@ -1,3 +1,8 @@ +2005-09-07 Werner Koch + + * misc.c (parse_options): Allow meta option "help" to list all + options and to exit the program. + 2005-09-02 David Shaw * parse-packet.c (enum_sig_subpkt, parse_signature, @@ -18,6 +23,11 @@ * photoid.c (generate_photo_id): Enable readline completion and tilde expansion for the JPEG prompt. +2005-08-30 Werner Koch + + * passphrase.c (agent_open): Print a warning and not an error in + case of a missing agent. Should fix Debian bug #325578. + 2005-08-26 David Shaw * misc.c (openpgp_pk_algo_usage): Default to allowing CERT for @@ -79,6 +89,7 @@ --passphrase command line option. Only useful in very special circumstances. +>>>>>>> .r3884 2005-08-05 Werner Koch * gpgv.c (keyserver_import_fprint): New stub. Modified: trunk/g10/card-util.c =================================================================== --- trunk/g10/card-util.c 2005-09-06 18:42:13 UTC (rev 3884) +++ trunk/g10/card-util.c 2005-09-07 15:53:03 UTC (rev 3885) @@ -156,6 +156,7 @@ case 0: case 0xffff: return "test card"; case 0x0001: return "PPC Card Systems"; + case 0x0002: return "Prism"; default: return "unknown"; } } Modified: trunk/g10/misc.c =================================================================== --- trunk/g10/misc.c 2005-09-06 18:42:13 UTC (rev 3884) +++ trunk/g10/misc.c 2005-09-07 15:53:03 UTC (rev 3885) @@ -966,6 +966,15 @@ { char *tok; + if (str && !strcmp (str, "help")) + { + int i; + + for(i=0;opts[i].name;i++) + printf ("%s\n", opts[i].name); + g10_exit (0); + } + while((tok=optsep(&str))) { int i,rev=0; Modified: trunk/g10/passphrase.c =================================================================== --- trunk/g10/passphrase.c 2005-09-06 18:42:13 UTC (rev 3884) +++ trunk/g10/passphrase.c 2005-09-07 15:53:03 UTC (rev 3885) @@ -314,7 +314,7 @@ if (orig_codeset) bind_textdomain_codeset (PACKAGE, orig_codeset); #endif /*ENABLE_NLS*/ - log_error (_("gpg-agent is not available in this session\n")); + log_info (_("gpg-agent is not available in this session\n")); opt.use_agent = 0; } return NULL; From cvs at cvs.gnupg.org Wed Sep 7 23:43:04 2005 From: cvs at cvs.gnupg.org (svn author twoaday) Date: Wed Sep 7 23:17:05 2005 Subject: [svn] GPGol - r90 - trunk/src Message-ID: Author: twoaday Date: 2005-09-07 23:43:02 +0200 (Wed, 07 Sep 2005) New Revision: 90 Removed: trunk/src/libgpgmedlgs/ Modified: trunk/src/ChangeLog trunk/src/HashTable.cpp trunk/src/HashTable.h trunk/src/common.c trunk/src/config-dialog.c trunk/src/engine-gpgme.c trunk/src/engine.h trunk/src/gpgmsg.cpp trunk/src/intern.h trunk/src/keycache.c trunk/src/keycache.h trunk/src/main.c trunk/src/olflange.cpp trunk/src/passphrase-dialog.c trunk/src/usermap.c trunk/src/usermap.h Log: Removed unused code and changed project name in file comments. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2005-09-07 06:53:58 UTC (rev 89) +++ trunk/src/ChangeLog 2005-09-07 21:43:02 UTC (rev 90) @@ -1,5 +1,10 @@ 2005-09-07 Timo Schulz + * common.c: Removed unused code. + * intern.h: Likewise. + +2005-09-07 Timo Schulz + * olflange.cpp (ul_release): New. Wrapper with error checking around UlRelease. (InstallCommands): Separate test for type and if string is empty. Modified: trunk/src/HashTable.cpp =================================================================== --- trunk/src/HashTable.cpp 2005-09-07 06:53:58 UTC (rev 89) +++ trunk/src/HashTable.cpp 2005-09-07 21:43:02 UTC (rev 90) @@ -1,20 +1,20 @@ /* HashTable.cpp * Copyright (C) 2005 g10 Code GmbH * - * This file is part of GPGME Dialogs. + * This file is part of GPGol. * - * GPGME Dialogs is free software; you can redistribute it and/or + * GPGol 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 Dialogs is distributed in the hope that it will be useful, + * GPGol 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 Lesser General Public License - * along with GPGME Dialogs; if not, write to the Free Software Foundation, + * along with GPGol; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include Modified: trunk/src/HashTable.h =================================================================== --- trunk/src/HashTable.h 2005-09-07 06:53:58 UTC (rev 89) +++ trunk/src/HashTable.h 2005-09-07 21:43:02 UTC (rev 90) @@ -1,24 +1,24 @@ /* HashTable.h * Copyright (C) 2005 g10 Code GmbH * - * This file is part of GPGME Dialogs. + * This file is part of GPGol. * - * GPGME Dialogs is free software; you can redistribute it and/or + * GPGol 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 Dialogs is distributed in the hope that it will be useful, + * GPGol 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 Lesser General Public License - * along with GPGME Dialogs; if not, write to the Free Software Foundation, + * along with GPGol; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MAPI_HASHTABLE_H -#define MAPI_HASHTABLE_H +#ifndef GPGOL_HASHTABLE_H +#define GPGOL_HASHTABLE_H class HashTable { @@ -40,4 +40,4 @@ void clear (); }; -#endif /*MAPI_HASHTABLE_H*/ +#endif /*GPGOL_HASHTABLE_H*/ Modified: trunk/src/common.c =================================================================== --- trunk/src/common.c 2005-09-07 06:53:58 UTC (rev 89) +++ trunk/src/common.c 2005-09-07 21:43:02 UTC (rev 90) @@ -1,27 +1,26 @@ /* common.c * Copyright (C) 2005 g10 Code GmbH * - * This file is part of GPGME Dialogs. + * This file is part of GPGol. * - * GPGME Dialogs is free software; you can redistribute it and/or + * GPGol 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 Dialogs is distributed in the hope that it will be useful, + * GPGol 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 Lesser General Public License - * along with GPGME Dialogs; if not, write to the Free Software Foundation, + * along with GPGol; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include "gpgme.h" -#include "keycache.h" #include "intern.h" HINSTANCE glob_hinst = NULL; @@ -114,22 +113,6 @@ } -cache_item_t -cache_item_new (void) -{ - return xcalloc (1, sizeof (struct cache_item_s)); -} - -void -cache_item_free (cache_item_t itm) -{ - if (itm == NULL) - return; - xfree (itm->pass); - itm->pass = NULL; - xfree (itm); -} - /* This is a helper function to load a Windows function from either of one DLLs. */ HRESULT Modified: trunk/src/config-dialog.c =================================================================== --- trunk/src/config-dialog.c 2005-09-07 06:53:58 UTC (rev 89) +++ trunk/src/config-dialog.c 2005-09-07 21:43:02 UTC (rev 90) @@ -31,7 +31,6 @@ #include #include "gpgol-ids.h" -#include "keycache.h" #include "intern.h" /* Registry path to GnuPG */ Modified: trunk/src/engine-gpgme.c =================================================================== --- trunk/src/engine-gpgme.c 2005-09-07 06:53:58 UTC (rev 89) +++ trunk/src/engine-gpgme.c 2005-09-07 21:43:02 UTC (rev 90) @@ -1,20 +1,20 @@ /* engine-gpgme.c - Crypto engine with GPGME * Copyright (C) 2005 g10 Code GmbH * - * This file is part of GPGME Dialogs. + * This file is part of GPGol. * - * GPGME Dialogs is free software; you can redistribute it and/or + * GPGol 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 Dialogs is distributed in the hope that it will be useful, + * GPGol 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 Lesser General Public License - * along with GPGME Dialogs; if not, write to the Free Software Foundation, + * along with GPGol; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Modified: trunk/src/engine.h =================================================================== --- trunk/src/engine.h 2005-09-07 06:53:58 UTC (rev 89) +++ trunk/src/engine.h 2005-09-07 21:43:02 UTC (rev 90) @@ -1,25 +1,25 @@ /* engine.h - Crypto engine * Copyright (C) 2005 g10 Code GmbH * - * This file is part of GPGME Dialogs. + * This file is part of GPGol. * - * GPGME Dialogs is free software; you can redistribute it and/or + * GPGol 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 Dialogs is distributed in the hope that it will be useful, + * GPGol 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 Lesser General Public License - * along with GPGME Dialogs; if not, write to the Free Software Foundation, + * along with GPGol; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef ENGINE_H -#define ENGINE_H 1 +#ifndef GPGOL_ENGINE_H +#define GPGOL_ENGINE_H 1 #ifdef __cplusplus extern "C" { @@ -85,4 +85,4 @@ #endif -#endif /*ENGINE_H*/ +#endif /*GPGOL_ENGINE_H*/ Modified: trunk/src/gpgmsg.cpp =================================================================== --- trunk/src/gpgmsg.cpp 2005-09-07 06:53:58 UTC (rev 89) +++ trunk/src/gpgmsg.cpp 2005-09-07 21:43:02 UTC (rev 90) @@ -87,7 +87,7 @@ /* - The implementation class of MapiGPGME. + The implementation class of GpgMsg. */ class GpgMsgImpl : public GpgMsg { Modified: trunk/src/intern.h =================================================================== --- trunk/src/intern.h 2005-09-07 06:53:58 UTC (rev 89) +++ trunk/src/intern.h 2005-09-07 21:43:02 UTC (rev 90) @@ -2,24 +2,24 @@ * Copyright (C) 2004 Timo Schulz * Copyright (C) 2005 g10 Code GmbH * - * This file is part of GPGME Dialogs. + * This file is part of GPGol. * - * GPGME Dialogs is free software; you can redistribute it and/or + * GPGol 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 Dialogs is distributed in the hope that it will be useful, + * GPGol 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 Lesser General Public License - * along with GPGME Dialogs; if not, write to the Free Software Foundation, + * along with GPGol; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef _GPGMEDLGS_INTERN_H_ -#define _GPGMEDLGS_INTERN_H_ +#ifndef GPGOL_INTERN_H +#define GPGOL_INTERN_H #include @@ -47,17 +47,6 @@ }; -typedef enum - { - GPG_ATTACH_NONE = 0, - GPG_ATTACH_DECRYPT = 1, - GPG_ATTACH_ENCRYPT = 2, - GPG_ATTACH_SIGN = 4, - GPG_ATTACH_SIGNENCRYPT = GPG_ATTACH_SIGN|GPG_ATTACH_ENCRYPT - } -gpgol_attachment_action_t; - - typedef enum { GPG_FMT_NONE = 0, /* do not encrypt attachments */ @@ -98,14 +87,6 @@ unsigned int last_was_bad:1; }; -struct cache_item_s -{ - char keyid[16+1]; - char *pass; - unsigned ttl; -}; -typedef struct cache_item_s *cache_item_t; - /* Global options - initialized to default by main.c. */ #ifdef __cplusplus extern @@ -138,18 +119,11 @@ void set_global_hinstance (HINSTANCE hinst); void center_window (HWND childwnd, HWND style); -cache_item_t cache_item_new (void); -void cache_item_free (cache_item_t itm); - HRESULT w32_shgetfolderpath (HWND a, int b, HANDLE c, DWORD d, LPSTR e); /*-- olflange.cpp --*/ -/*-- MapiGPGME.cpp --*/ -int initialize_mapi_gpgme (void); - - /*-- recipient-dialog.c --*/ int recipient_dialog_box(gpgme_key_t **ret_rset, int *ret_opts); int recipient_dialog_box2 (gpgme_key_t *fnd, char **unknown, size_t n, @@ -175,4 +149,4 @@ } #endif -#endif /*_GPGMEDLGS_INTERN_H_*/ +#endif /*GPGOL_INTERN_H*/ Modified: trunk/src/keycache.c =================================================================== --- trunk/src/keycache.c 2005-09-07 06:53:58 UTC (rev 89) +++ trunk/src/keycache.c 2005-09-07 21:43:02 UTC (rev 90) @@ -2,20 +2,20 @@ * Copyright (C) 2004 Timo Schulz * Copyright (C) 2005 g10 Code GmbH * - * This file is part of GPGME Dialogs. + * This file is part of GPGol. * - * GPGME Dialogs is free software; you can redistribute it and/or + * GPGol 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 Dialogs is distributed in the hope that it will be useful, + * GPGol 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 Lesser General Public License - * along with GPGME Dialogs; if not, write to the Free Software Foundation, + * along with GPGol; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include Modified: trunk/src/keycache.h =================================================================== --- trunk/src/keycache.h 2005-09-07 06:53:58 UTC (rev 89) +++ trunk/src/keycache.h 2005-09-07 21:43:02 UTC (rev 90) @@ -2,24 +2,24 @@ * Copyright (C) 2004 Timo Schulz * Copyright (C) 2005 g10 Code GmbH * - * This file is part of GPGME Dialogs. + * This file is part of GPGol. * - * GPGME Dialogs is free software; you can redistribute it and/or + * GPGol 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 Dialogs is distributed in the hope that it will be useful, + * GPGol 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 Lesser General Public License - * along with GPGME Dialogs; if not, write to the Free Software Foundation, + * along with GPGol; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef _GPGMEDLGS_KEYCACHE_H_ -#define _GPGMEDLGS_KEYCACHE_H_ +#ifndef GPGOL_KEYCACHE_H +#define GPGOL_KEYCACHE_H #ifdef __cplusplus extern "C" { @@ -54,4 +54,4 @@ } #endif -#endif /*_GPGMEDLGS_KEYCACHE_H_*/ +#endif /*GPGOL_KEYCACHE_H*/ Modified: trunk/src/main.c =================================================================== --- trunk/src/main.c 2005-09-07 06:53:58 UTC (rev 89) +++ trunk/src/main.c 2005-09-07 21:43:02 UTC (rev 90) @@ -1,20 +1,20 @@ /* main.c - DLL entry point * Copyright (C) 2005 g10 Code GmbH * - * This file is part of GPGME Dialogs. + * This file is part of GPGol. * - * GPGME Dialogs is free software; you can redistribute it and/or + * GPGol 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 Dialogs is distributed in the hope that it will be useful, + * GPGol 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 Lesser General Public License - * along with GPGME Dialogs; if not, write to the Free Software Foundation, + * along with GPGol; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Modified: trunk/src/olflange.cpp =================================================================== --- trunk/src/olflange.cpp 2005-09-07 06:53:58 UTC (rev 89) +++ trunk/src/olflange.cpp 2005-09-07 21:43:02 UTC (rev 90) @@ -1,4 +1,4 @@ -/* olflange.cpp - Flange between Outlook and the MapiGPGME class +/* olflange.cpp - Flange between Outlook and the GpgMsg class * Copyright (C) 2001 G Data Software AG, http://www.gdata.de * Copyright (C) 2004, 2005 g10 Code GmbH * @@ -205,8 +205,7 @@ if (!punk) return; res = UlRelease (punk); - if (res != S_OK) - log_debug ("%s UlRelease(%p) failed: %lu\n", __func__, punk, res); + log_debug ("%s UlRelease(%p) had %lu references\n", __func__, punk, res); } Modified: trunk/src/passphrase-dialog.c =================================================================== --- trunk/src/passphrase-dialog.c 2005-09-07 06:53:58 UTC (rev 89) +++ trunk/src/passphrase-dialog.c 2005-09-07 21:43:02 UTC (rev 90) @@ -37,7 +37,7 @@ static char const allhexdigits[] = "1234567890ABCDEFabcdef"; - +#if 0 /* XXX: left over from old code?? */ static void add_string_list (HWND hbox, const char **list, int start_idx) { @@ -48,6 +48,7 @@ SendMessage (hbox, CB_ADDSTRING, 0, (LPARAM)(const char *)s); SendMessage (hbox, CB_SETCURSEL, (WPARAM) start_idx, 0); } +#endif static void Modified: trunk/src/usermap.c =================================================================== --- trunk/src/usermap.c 2005-09-07 06:53:58 UTC (rev 89) +++ trunk/src/usermap.c 2005-09-07 21:43:02 UTC (rev 90) @@ -1,27 +1,26 @@ /* usermap.c - Map keyid's to userid's * Copyright (C) 2005 g10 Code GmbH * - * This file is part of GPGME Dialogs. + * This file is part of GPGol. * - * GPGME Dialogs is free software; you can redistribute it and/or + * GPGol 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 Dialogs is distributed in the hope that it will be useful, + * GPGol 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 Lesser General Public License - * along with GPGME Dialogs; if not, write to the Free Software Foundation, + * along with GPGol; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include "gpgme.h" -#include "keycache.h" #include "intern.h" #include "usermap.h" Modified: trunk/src/usermap.h =================================================================== --- trunk/src/usermap.h 2005-09-07 06:53:58 UTC (rev 89) +++ trunk/src/usermap.h 2005-09-07 21:43:02 UTC (rev 90) @@ -1,35 +1,33 @@ /* usermap.h - Map keyid's to userid's * Copyright (C) 2005 g10 Code GmbH * - * This file is part of GPGME Dialogs. + * This file is part of GPGol. * - * GPGME Dialogs is free software; you can redistribute it and/or + * GPGol 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 Dialogs is distributed in the hope that it will be useful, + * GPGol 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 Lesser General Public License - * along with GPGME Dialogs; if not, write to the Free Software Foundation, + * along with GPGol; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef _GPGMEDLGS_USERMAP_H -#define _GPGMEDLGS_USERMAP_H +#ifndef GPGOL_USERMAP_H +#define GPGOL_USERMAP_H void* new_usermap (gpgme_recipient_t rset); void free_usermap (void *ctx); -/* BEGIN C INTERFACE */ void* HashTable_new (int n); void HashTable_free (void *ctx); void HashTable_put (void *ctx, const char *key, void *val); void* HashTable_get (void *ctx, const char *key); void* HashTable_get_i (void *ctx, int pos); int HashTable_size (void *ctx); -/* END C INTERFACE */ -#endif /*_GPGMEDLGS_USERMAP_H*/ +#endif /*GPGOL_USERMAP_H*/ From cvs at cvs.gnupg.org Thu Sep 8 11:05:26 2005 From: cvs at cvs.gnupg.org (svn author twoaday) Date: Thu Sep 8 10:39:24 2005 Subject: [svn] GPGol - r91 - trunk/src Message-ID: Author: twoaday Date: 2005-09-08 11:05:25 +0200 (Thu, 08 Sep 2005) New Revision: 91 Removed: trunk/src/HashTable.cpp trunk/src/HashTable.h trunk/src/usermap.c trunk/src/usermap.h Modified: trunk/src/ChangeLog trunk/src/Makefile.am trunk/src/passphrase-dialog.c Log: Removed more unused code. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2005-09-07 21:43:02 UTC (rev 90) +++ trunk/src/ChangeLog 2005-09-08 09:05:25 UTC (rev 91) @@ -1,3 +1,10 @@ +2004-09-08 Timo Schulz + + * passphrase-dialog.c (lod_recipbox): Use gpgme directly + to resolve the keyids to userids. + * usermap.c, usermap.h: Removed. + * HashTable.cpp, HashTable.h: Removed. + 2005-09-07 Timo Schulz * common.c: Removed unused code. Deleted: trunk/src/HashTable.cpp Deleted: trunk/src/HashTable.h Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2005-09-07 21:43:02 UTC (rev 90) +++ trunk/src/Makefile.am 2005-09-08 09:05:25 UTC (rev 91) @@ -36,9 +36,7 @@ rfc822parse.c rfc822parse.h \ common.c intern.h \ passcache.c passcache.h \ - HashTable.cpp HashTable.h \ keycache.c keycache.h \ - usermap.c usermap.h \ config-dialog.c \ passphrase-dialog.c \ recipient-dialog.c \ Modified: trunk/src/passphrase-dialog.c =================================================================== --- trunk/src/passphrase-dialog.c 2005-09-07 21:43:02 UTC (rev 90) +++ trunk/src/passphrase-dialog.c 2005-09-08 09:05:25 UTC (rev 91) @@ -81,23 +81,56 @@ static void load_recipbox (HWND dlg, int ctlid, gpgme_ctx_t ctx) -{ - gpgme_decrypt_result_t res; - gpgme_recipient_t r; - void *usermap ; +{ + gpgme_decrypt_result_t res; + gpgme_recipient_t rset, r; + gpgme_ctx_t keyctx=NULL; + gpgme_key_t key; + gpgme_error_t err; + char *p; + int c=0; + + if (ctx == NULL) + return; + res = gpgme_op_decrypt_result (ctx); + if (res == NULL || res->recipients == NULL) + return; + rset = res->recipients; + for (r = rset; r; r = r->next) + c++; + p = xcalloc (1, c*(17+2)); + for (r = rset; r; r = r->next) { + strcat (p, r->keyid); + strcat (p, " "); + } - if (ctx == NULL) - return; - res = gpgme_op_decrypt_result (ctx); - if (res == NULL || res->recipients == NULL) - return; - usermap = new_usermap (res->recipients); - for (r = res->recipients; r; r = r->next) { - char *userid = HashTable_get (usermap, r->keyid); - SendDlgItemMessage (dlg, ctlid, LB_ADDSTRING, 0, - (LPARAM)(const char*)userid); + err = gpgme_new (&keyctx); + if (err) + goto fail; + err = gpgme_op_keylist_start (keyctx, p, 0); + if (err) + goto fail; + + r = rset; + for (;;) + { + const char *uid; + err = gpgme_op_keylist_next (keyctx, &key); + if (err) + break; + uid = gpgme_key_get_string_attr (key, GPGME_ATTR_USERID, NULL, 0); + if (uid != NULL) + SendDlgItemMessage (dlg, ctlid, LB_ADDSTRING, 0, + (LPARAM)(const char *)uid); + gpgme_key_release (key); + key = NULL; + r = r->next; } - free_usermap (usermap); + +fail: + if (keyctx != NULL) + gpgme_release (keyctx); + xfree (p); } Deleted: trunk/src/usermap.c Deleted: trunk/src/usermap.h From cvs at cvs.gnupg.org Thu Sep 8 17:17:13 2005 From: cvs at cvs.gnupg.org (svn author marcus) Date: Thu Sep 8 16:51:08 2005 Subject: [svn] gpgme - r1092 - trunk/tests/gpgsm Message-ID: Author: marcus Date: 2005-09-08 17:17:12 +0200 (Thu, 08 Sep 2005) New Revision: 1092 Modified: trunk/tests/gpgsm/cert_dfn_pca01.der trunk/tests/gpgsm/cert_dfn_pca15.der trunk/tests/gpgsm/cert_g10code_test1.der Log: Deleted the property eol-style and set the property binary file. Property changes on: trunk/tests/gpgsm/cert_dfn_pca01.der ___________________________________________________________________ Name: svn:eol-style - native Name: svn:mime-type + application/octet-stream Property changes on: trunk/tests/gpgsm/cert_dfn_pca15.der ___________________________________________________________________ Name: svn:eol-style - native Name: svn:mime-type + application/octet-stream Property changes on: trunk/tests/gpgsm/cert_g10code_test1.der ___________________________________________________________________ Name: svn:eol-style - native Name: svn:mime-type + application/octet-stream From cvs at cvs.gnupg.org Thu Sep 8 17:17:59 2005 From: cvs at cvs.gnupg.org (svn author marcus) Date: Thu Sep 8 16:51:55 2005 Subject: [svn] gpgme - r1093 - trunk/tests/gpgsm Message-ID: Author: marcus Date: 2005-09-08 17:17:58 +0200 (Thu, 08 Sep 2005) New Revision: 1093 Modified: trunk/tests/gpgsm/cert_dfn_pca01.der trunk/tests/gpgsm/cert_dfn_pca15.der trunk/tests/gpgsm/cert_g10code_test1.der Log: Restore the key files. Modified: trunk/tests/gpgsm/cert_dfn_pca01.der =================================================================== (Binary files differ) Modified: trunk/tests/gpgsm/cert_dfn_pca15.der =================================================================== (Binary files differ) Modified: trunk/tests/gpgsm/cert_g10code_test1.der =================================================================== (Binary files differ) From cvs at cvs.gnupg.org Thu Sep 8 17:47:25 2005 From: cvs at cvs.gnupg.org (svn author marcus) Date: Thu Sep 8 17:21:27 2005 Subject: [svn] gpg-error - r141 - trunk Message-ID: Author: marcus Date: 2005-09-08 17:47:24 +0200 (Thu, 08 Sep 2005) New Revision: 141 Modified: trunk/NEWS Log: Add news items about new error codes. Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2005-08-19 15:48:56 UTC (rev 140) +++ trunk/NEWS 2005-09-08 15:47:24 UTC (rev 141) @@ -1,12 +1,19 @@ -Noteworthy changes in version 1.2 +Noteworthy changes in version 1.2 (unreleased) ---------------------------------------------- * "./autogen.sh --build-w32" does now also build a DLL for W32. Translations are not yet provided for this platform. - * Interface changes relative to the 1.0 release: + * New error codes GPG_ERR_UNKNOWN_EXTN and GPG_ERR_UNKNOWN_CRIT_EXTN. + + * New error code GPG_ERR_LOCKED. + + * Interface changes relative to the 1.1 release: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SOMETHING NEW +GPG_ERR_UNKNOWN_EXTN NEW +GPG_ERR_UNKNOWN_CRIT_EXTN NEW +GPG_ERR_LOCKED NEW ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Noteworthy changes in version 1.1 (2005-06-20) From cvs at cvs.gnupg.org Thu Sep 8 18:02:42 2005 From: cvs at cvs.gnupg.org (svn author marcus) Date: Thu Sep 8 17:36:37 2005 Subject: [svn] assuan - r188 - trunk/src Message-ID: Author: marcus Date: 2005-09-08 18:02:36 +0200 (Thu, 08 Sep 2005) New Revision: 188 Modified: trunk/src/ChangeLog trunk/src/assuan-pipe-connect.c Log: 2005-09-08 Marcus Brinkmann * assuan-pipe-connect.c (assuan_pipe_connect2): Add missing declaration of PID. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2005-08-09 12:49:11 UTC (rev 187) +++ trunk/src/ChangeLog 2005-09-08 16:02:36 UTC (rev 188) @@ -1,3 +1,8 @@ +2005-09-08 Marcus Brinkmann + + * assuan-pipe-connect.c (assuan_pipe_connect2): Add missing + declaration of PID. + 2005-08-09 Werner Koch * mkerrors: Include config.h into assuan-errors.c. This is Modified: trunk/src/assuan-pipe-connect.c =================================================================== --- trunk/src/assuan-pipe-connect.c 2005-08-09 12:49:11 UTC (rev 187) +++ trunk/src/assuan-pipe-connect.c 2005-09-08 16:02:36 UTC (rev 188) @@ -467,6 +467,8 @@ if ((*ctx)->pid == 0) { #ifdef _ASSUAN_USE_DOUBLE_FORK + pid_t pid; + if ((pid = fork ()) == 0) #endif { From cvs at cvs.gnupg.org Fri Sep 9 07:29:54 2005 From: cvs at cvs.gnupg.org (svn author twoaday) Date: Fri Sep 9 07:03:47 2005 Subject: [svn] GPGol - r92 - trunk/src Message-ID: Author: twoaday Date: 2005-09-09 07:29:48 +0200 (Fri, 09 Sep 2005) New Revision: 92 Modified: trunk/src/passphrase-dialog.c Log: Forgot to remove include. Modified: trunk/src/passphrase-dialog.c =================================================================== --- trunk/src/passphrase-dialog.c 2005-09-08 09:05:25 UTC (rev 91) +++ trunk/src/passphrase-dialog.c 2005-09-09 05:29:48 UTC (rev 92) @@ -31,9 +31,9 @@ #include "keycache.h" #include "passcache.h" #include "intern.h" -#include "usermap.h" + static char const allhexdigits[] = "1234567890ABCDEFabcdef"; From cvs at cvs.gnupg.org Fri Sep 9 13:18:10 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Fri Sep 9 12:52:03 2005 Subject: [svn] GnuPG - r3887 - in branches/GNUPG-1-9-BRANCH: . agent po scd sm Message-ID: Author: wk Date: 2005-09-09 13:18:08 +0200 (Fri, 09 Sep 2005) New Revision: 3887 Modified: branches/GNUPG-1-9-BRANCH/NEWS branches/GNUPG-1-9-BRANCH/agent/ChangeLog branches/GNUPG-1-9-BRANCH/agent/command-ssh.c branches/GNUPG-1-9-BRANCH/agent/minip12.c branches/GNUPG-1-9-BRANCH/po/de.po branches/GNUPG-1-9-BRANCH/scd/ChangeLog branches/GNUPG-1-9-BRANCH/scd/app-openpgp.c branches/GNUPG-1-9-BRANCH/scd/app-p15.c branches/GNUPG-1-9-BRANCH/scd/ccid-driver.c branches/GNUPG-1-9-BRANCH/scd/ccid-driver.h branches/GNUPG-1-9-BRANCH/scd/iso7816.c branches/GNUPG-1-9-BRANCH/scd/iso7816.h branches/GNUPG-1-9-BRANCH/scd/pcsc-wrapper.c branches/GNUPG-1-9-BRANCH/sm/ChangeLog branches/GNUPG-1-9-BRANCH/sm/export.c Log: Bug fixes and ssh support for the BELPIC. Modified: branches/GNUPG-1-9-BRANCH/NEWS =================================================================== --- branches/GNUPG-1-9-BRANCH/NEWS 2005-09-07 17:05:42 UTC (rev 3886) +++ branches/GNUPG-1-9-BRANCH/NEWS 2005-09-09 11:18:08 UTC (rev 3887) @@ -1,8 +1,10 @@ Noteworthy changes in version 1.9.19 ------------------------------------------------- - * The Belgian eID card is now supported. + * The Belgian eID card is now supported for signatures and ssh. + * Fixed bug in --export-secret-key-p12 so that certificates are again + included. Noteworthy changes in version 1.9.18 (2005-08-01) ------------------------------------------------- Modified: branches/GNUPG-1-9-BRANCH/agent/ChangeLog =================================================================== --- branches/GNUPG-1-9-BRANCH/agent/ChangeLog 2005-09-07 17:05:42 UTC (rev 3886) +++ branches/GNUPG-1-9-BRANCH/agent/ChangeLog 2005-09-09 11:18:08 UTC (rev 3887) @@ -1,3 +1,17 @@ +2005-09-09 Werner Koch + + * minip12.c (p12_build): Oops, array needs to be larger for the + certificate. + + * command-ssh.c (card_key_available): Let the card handler decide + whether the card is supported here. Also get a short serial + number to return from the card handler. + +2005-09-08 Werner Koch + + * minip12.c (build_cert_bag): Use a non constructed object. + i.e. 0x80 and not 0xa0. + 2005-08-16 Werner Koch * gpg-agent.c (main): Use a default file name for --write-env-file. Modified: branches/GNUPG-1-9-BRANCH/agent/command-ssh.c =================================================================== --- branches/GNUPG-1-9-BRANCH/agent/command-ssh.c 2005-09-07 17:05:42 UTC (rev 3886) +++ branches/GNUPG-1-9-BRANCH/agent/command-ssh.c 2005-09-09 11:18:08 UTC (rev 3887) @@ -1583,13 +1583,13 @@ /* Check whether a smartcard is available and whether it has a usable key. Store a copy of that key at R_PK and return 0. If no key is available store NULL at R_PK and return an error code. If CARDSN - is no NULL, a string with the serial number of the card will be + is not NULL, a string with the serial number of the card will be a malloced and stored there. */ static gpg_error_t card_key_available (ctrl_t ctrl, gcry_sexp_t *r_pk, char **cardsn) { gpg_error_t err; - char *appname; + char *authkeyid; char *serialno = NULL; unsigned char *pkbuf; size_t pkbuflen; @@ -1602,7 +1602,7 @@ /* First see whether a card is available and whether the application is supported. */ - err = agent_card_getattr (ctrl, "APPTYPE", &appname); + err = agent_card_getattr (ctrl, "$AUTHKEYID", &authkeyid); if ( gpg_err_code (err) == GPG_ERR_CARD_REMOVED ) { /* Ask for the serial number to reset the card. */ @@ -1615,40 +1615,33 @@ return err; } log_info (_("detected card with S/N: %s\n"), serialno); - err = agent_card_getattr (ctrl, "APPTYPE", &appname); + err = agent_card_getattr (ctrl, "$AUTHKEYID", &authkeyid); } if (err) { - log_error (_("error getting application type of card: %s\n"), + log_error (_("error getting default authentication keyID of card: %s\n"), gpg_strerror (err)); xfree (serialno); return err; } - if (strcmp (appname, "OPENPGP")) - { - log_info (_("card application `%s' is not supported\n"), appname); - xfree (appname); - xfree (serialno); - return gpg_error (GPG_ERR_NOT_SUPPORTED); - } - xfree (appname); - appname = NULL; /* Get the S/N if we don't have it yet. Use the fast getattr method. */ if (!serialno && (err = agent_card_getattr (ctrl, "SERIALNO", &serialno)) ) { log_error (_("error getting serial number of card: %s\n"), gpg_strerror (err)); + xfree (authkeyid); return err; } /* Read the public key. */ - err = agent_card_readkey (ctrl, "OPENPGP.3", &pkbuf); + err = agent_card_readkey (ctrl, authkeyid, &pkbuf); if (err) { if (opt.verbose) log_info (_("no suitable card key found: %s\n"), gpg_strerror (err)); xfree (serialno); + xfree (authkeyid); return err; } @@ -1660,6 +1653,7 @@ gpg_strerror (err)); xfree (pkbuf); xfree (serialno); + xfree (authkeyid); return err; } @@ -1671,6 +1665,7 @@ xfree (pkbuf); gcry_sexp_release (s_pk); xfree (serialno); + xfree (authkeyid); return err; } @@ -1680,13 +1675,14 @@ unsigned char *shadow_info; unsigned char *tmp; - shadow_info = make_shadow_info (serialno, "OPENPGP.3"); + shadow_info = make_shadow_info (serialno, authkeyid); if (!shadow_info) { err = gpg_error_from_errno (errno); xfree (pkbuf); gcry_sexp_release (s_pk); xfree (serialno); + xfree (authkeyid); return err; } err = agent_shadow_key (pkbuf, shadow_info, &tmp); @@ -1697,6 +1693,7 @@ xfree (pkbuf); gcry_sexp_release (s_pk); xfree (serialno); + xfree (authkeyid); return err; } xfree (pkbuf); @@ -1711,18 +1708,23 @@ xfree (pkbuf); gcry_sexp_release (s_pk); xfree (serialno); + xfree (authkeyid); return err; } } if (cardsn) { - size_t snlen = strlen (serialno); + char *dispsn; - if (snlen == 32 - && !memcmp (serialno, "D27600012401", 12)) /* OpenPGP card. */ - *cardsn = xtryasprintf ("cardno:%.12s", serialno+16); - else /* Something is wrong: Print all. */ + /* If the card handler is able to return a short serialnumber, + use that one, else use the complete serialno. */ + if (!agent_card_getattr (ctrl, "$DISPSERIALNO", &dispsn)) + { + *cardsn = xtryasprintf ("cardno:%s", dispsn); + xfree (dispsn); + } + else *cardsn = xtryasprintf ("cardno:%s", serialno); if (!*cardsn) { @@ -1730,12 +1732,14 @@ xfree (pkbuf); gcry_sexp_release (s_pk); xfree (serialno); + xfree (authkeyid); return err; } } xfree (pkbuf); xfree (serialno); + xfree (authkeyid); *r_pk = s_pk; return 0; } Modified: branches/GNUPG-1-9-BRANCH/agent/minip12.c =================================================================== --- branches/GNUPG-1-9-BRANCH/agent/minip12.c 2005-09-07 17:05:42 UTC (rev 3886) +++ branches/GNUPG-1-9-BRANCH/agent/minip12.c 2005-09-09 11:18:08 UTC (rev 3887) @@ -1409,7 +1409,7 @@ p += DIM (oid_encryptedData); /* 2. Store a [0] tag. */ - p = store_tag_length (p, 0xa0, len[2]); + p = store_tag_length (p, 0x80, len[2]); /* 3. Store a sequence. */ p = store_tag_length (p, TAG_SEQUENCE, len[3]); @@ -1553,7 +1553,7 @@ unsigned char *buffer; size_t n, buflen; char salt[8]; - struct buffer_s seqlist[2]; + struct buffer_s seqlist[3]; int seqlistidx = 0; n = buflen = 0; /* (avoid compiler warning). */ Modified: branches/GNUPG-1-9-BRANCH/po/de.po =================================================================== --- branches/GNUPG-1-9-BRANCH/po/de.po 2005-09-07 17:05:42 UTC (rev 3886) +++ branches/GNUPG-1-9-BRANCH/po/de.po 2005-09-09 11:18:08 UTC (rev 3887) @@ -10,7 +10,7 @@ msgstr "" "Project-Id-Version: gnupg2 1.9.18\n" "Report-Msgid-Bugs-To: translations@gnupg.org\n" -"POT-Creation-Date: 2005-09-06 20:01+0200\n" +"POT-Creation-Date: 2005-09-09 12:47+0200\n" "PO-Revision-Date: 2005-08-02 17:02+0200\n" "Last-Translator: Werner Koch \n" "Language-Team: de\n" @@ -605,52 +605,52 @@ msgid "failed to store the creation date: %s\n" msgstr "Das Erzeugungsdatum kann nicht gespeichert werden: %s\n" -#: scd/app-openpgp.c:978 +#: scd/app-openpgp.c:1003 #, c-format msgid "reading public key failed: %s\n" msgstr "Fehler beim Lesen des ?ffentlichen Schl?ssels: %s\n" -#: scd/app-openpgp.c:986 scd/app-openpgp.c:1917 +#: scd/app-openpgp.c:1011 scd/app-openpgp.c:1942 msgid "response does not contain the public key data\n" msgstr "Die Antwort enth?lt keine Public Key Daten\n" -#: scd/app-openpgp.c:994 scd/app-openpgp.c:1925 +#: scd/app-openpgp.c:1019 scd/app-openpgp.c:1950 msgid "response does not contain the RSA modulus\n" msgstr "Die Antwort enth?lt keinen RSA Modulus\n" -#: scd/app-openpgp.c:1003 scd/app-openpgp.c:1935 +#: scd/app-openpgp.c:1028 scd/app-openpgp.c:1960 msgid "response does not contain the RSA public exponent\n" msgstr "Die Antwort enth?lt keinen ?ffenlichen RSA Exponent\n" -#: scd/app-openpgp.c:1266 scd/app-openpgp.c:1354 scd/app-openpgp.c:2157 +#: scd/app-openpgp.c:1291 scd/app-openpgp.c:1379 scd/app-openpgp.c:2182 #, c-format msgid "PIN callback returned error: %s\n" msgstr "Fehler vom PIN \"callback\": %s\n" -#: scd/app-openpgp.c:1272 scd/app-openpgp.c:1360 scd/app-openpgp.c:2163 +#: scd/app-openpgp.c:1297 scd/app-openpgp.c:1385 scd/app-openpgp.c:2188 #, c-format msgid "PIN for CHV%d is too short; minimum length is %d\n" msgstr "Die PIN f?r den CHV%d ist zu kurz; Mindestl?nge ist %d\n" -#: scd/app-openpgp.c:1281 scd/app-openpgp.c:1295 scd/app-openpgp.c:1370 -#: scd/app-openpgp.c:2172 scd/app-openpgp.c:2186 +#: scd/app-openpgp.c:1306 scd/app-openpgp.c:1320 scd/app-openpgp.c:1395 +#: scd/app-openpgp.c:2197 scd/app-openpgp.c:2211 #, c-format msgid "verify CHV%d failed: %s\n" msgstr "Pr?fen von CHV%d fehlgeschlagen: %s\n" -#: scd/app-openpgp.c:1318 +#: scd/app-openpgp.c:1343 msgid "access to admin commands is not configured\n" msgstr "Zugriff auf Admin Kommandos ist nicht konfiguriert\n" -#: scd/app-openpgp.c:1333 scd/app-openpgp.c:2392 +#: scd/app-openpgp.c:1358 scd/app-openpgp.c:2417 msgid "error retrieving CHV status from card\n" msgstr "Fehler beim Holen des CHV Status von der Karte\n" -#: scd/app-openpgp.c:1339 scd/app-openpgp.c:2401 +#: scd/app-openpgp.c:1364 scd/app-openpgp.c:2426 msgid "card is permanently locked!\n" msgstr "Die Karte ist dauerhaft gesperrt!\n" -#: scd/app-openpgp.c:1344 +#: scd/app-openpgp.c:1369 #, c-format msgid "%d Admin PIN attempts remaining before card is permanently locked\n" msgstr "" @@ -659,105 +659,105 @@ #. TRANSLATORS: Do not translate the "|A|" prefix but #. keep it at the start of the string. We need this elsewhere #. to get some infos on the string. -#: scd/app-openpgp.c:1351 +#: scd/app-openpgp.c:1376 msgid "|A|Admin PIN" msgstr "|A|Admin PIN" #. TRANSLATORS: Do not translate the "|*|" prefixes but #. keep it at the start of the string. We need this elsewhere #. to get some infos on the string. -#: scd/app-openpgp.c:1500 +#: scd/app-openpgp.c:1525 msgid "|AN|New Admin PIN" msgstr "|AN|Neue Admin PIN" -#: scd/app-openpgp.c:1500 +#: scd/app-openpgp.c:1525 msgid "|N|New PIN" msgstr "|N|Neue PIN" -#: scd/app-openpgp.c:1504 +#: scd/app-openpgp.c:1529 #, c-format msgid "error getting new PIN: %s\n" msgstr "Fehler beim Holen der neuen PIN: %s\n" -#: scd/app-openpgp.c:1554 scd/app-openpgp.c:2003 +#: scd/app-openpgp.c:1579 scd/app-openpgp.c:2028 msgid "error reading application data\n" msgstr "Fehler beim Lesen der Anwendungsdaten\n" -#: scd/app-openpgp.c:1560 scd/app-openpgp.c:2010 +#: scd/app-openpgp.c:1585 scd/app-openpgp.c:2035 msgid "error reading fingerprint DO\n" msgstr "Fehler beim Lesen des Fingerabdruck Datenobjekts\n" -#: scd/app-openpgp.c:1570 +#: scd/app-openpgp.c:1595 msgid "key already exists\n" msgstr "Schl?ssel existiert bereits\n" -#: scd/app-openpgp.c:1574 +#: scd/app-openpgp.c:1599 msgid "existing key will be replaced\n" msgstr "Existierender Schl?ssel wird ersetzt\n" -#: scd/app-openpgp.c:1576 +#: scd/app-openpgp.c:1601 msgid "generating new key\n" msgstr "Neuer Schl?ssel wird erzeugt\n" -#: scd/app-openpgp.c:1743 +#: scd/app-openpgp.c:1768 msgid "creation timestamp missing\n" msgstr "Erzeugungsdatum fehlt\n" -#: scd/app-openpgp.c:1750 +#: scd/app-openpgp.c:1775 #, c-format msgid "RSA modulus missing or not of size %d bits\n" msgstr "Der RSA Modulus fehlt oder ist nicht %d Bits lang\n" -#: scd/app-openpgp.c:1757 +#: scd/app-openpgp.c:1782 #, c-format msgid "RSA public exponent missing or larger than %d bits\n" msgstr "Der ?ffentliche RSA Exponent fehlt oder ist l?nger als %d Bits\n" -#: scd/app-openpgp.c:1765 scd/app-openpgp.c:1772 +#: scd/app-openpgp.c:1790 scd/app-openpgp.c:1797 #, c-format msgid "RSA prime %s missing or not of size %d bits\n" msgstr "Die RSA Primzahl %s fehlt oder ist nicht %d Bits lang\n" -#: scd/app-openpgp.c:1835 +#: scd/app-openpgp.c:1860 #, c-format msgid "failed to store the key: %s\n" msgstr "Fehler beim Speichern des Schl?ssels: %s\n" -#: scd/app-openpgp.c:1894 +#: scd/app-openpgp.c:1919 msgid "please wait while key is being generated ...\n" msgstr "Bitte warten bis der Schl?ssel erzeugt wurde ...\n" -#: scd/app-openpgp.c:1908 +#: scd/app-openpgp.c:1933 msgid "generating key failed\n" msgstr "Fehler beim Erzeugen des Schl?ssels\n" -#: scd/app-openpgp.c:1911 +#: scd/app-openpgp.c:1936 #, c-format msgid "key generation completed (%d seconds)\n" msgstr "Schl?sselerzeugung vollendet (%d Sekunden)\n" -#: scd/app-openpgp.c:1968 +#: scd/app-openpgp.c:1993 msgid "invalid structure of OpenPGP card (DO 0x93)\n" msgstr "Ung?ltige Struktur der OpenPGP Karte (DO 0x93)\n" -#: scd/app-openpgp.c:2137 +#: scd/app-openpgp.c:2162 #, c-format msgid "signatures created so far: %lu\n" msgstr "Anzahl bereits erzeugter Signaturen: %lu\n" -#: scd/app-openpgp.c:2145 +#: scd/app-openpgp.c:2170 #, c-format msgid "||Please enter the PIN%%0A[sigs done: %lu]" msgstr "||Bitte geben Sie die PIN ein%%0A[Sigs bisher: %lu]" -#: scd/app-openpgp.c:2406 +#: scd/app-openpgp.c:2431 msgid "" "verification of Admin PIN is currently prohibited through this command\n" msgstr "" "Die ?berpr?fung der Admin PIN is momentan durch ein Kommando verboten " "worden\n" -#: scd/app-openpgp.c:2477 scd/app-openpgp.c:2487 +#: scd/app-openpgp.c:2502 scd/app-openpgp.c:2512 #, c-format msgid "can't access %s - invalid OpenPGP card?\n" msgstr "Zugriff auf %s nicht m?glich - ung?ltige OpenPGP Karte?\n" Modified: branches/GNUPG-1-9-BRANCH/scd/ChangeLog =================================================================== --- branches/GNUPG-1-9-BRANCH/scd/ChangeLog 2005-09-07 17:05:42 UTC (rev 3886) +++ branches/GNUPG-1-9-BRANCH/scd/ChangeLog 2005-09-09 11:18:08 UTC (rev 3887) @@ -1,3 +1,15 @@ +2005-09-09 Werner Koch + + * pcsc-wrapper.c (main): Removed bogus free. + + * app-p15.c (do_auth): New. + (do_getattr): New attribs $AUTHKEYID and $DISPSERIALNO. + * app-openpgp.c (do_getattr): Ditto. + +2005-09-08 Werner Koch + + * app-openpgp.c (do_getattr): New key $AUTHKEYID. + 2005-09-06 Werner Koch * app-p15.c (do_sign): Tweaked for BELPIC cards. @@ -8,7 +20,7 @@ * iso7816.c (iso7816_select_path): New. * app-p15.c (select_ef_by_path): Allow for direct path selection. - (app_select_p15): Try using the beigian variant of pkcs#15. + (app_select_p15): Try using the Belgian variant of pkcs#15. (read_home_df): New. (read_ef_odf): Generalized. (read_ef_tokeninfo): New. Modified: branches/GNUPG-1-9-BRANCH/scd/app-openpgp.c =================================================================== --- branches/GNUPG-1-9-BRANCH/scd/app-openpgp.c 2005-09-07 17:05:42 UTC (rev 3886) +++ branches/GNUPG-1-9-BRANCH/scd/app-openpgp.c 2005-09-09 11:18:08 UTC (rev 3887) @@ -696,6 +696,8 @@ { "PRIVATE-DO-2", 0x0102 }, { "PRIVATE-DO-3", 0x0103 }, { "PRIVATE-DO-4", 0x0104 }, + { "$AUTHKEYID", 0x0000, -3 }, + { "$DISPSERIALNO",0x0000, -4 }, { NULL, 0 } }; int idx, i, rc; @@ -742,6 +744,29 @@ send_status_info (ctrl, table[idx].name, tmp, strlen (tmp), NULL, 0); return 0; } + if (table[idx].special == -3) + { + char const tmp[] = "OPENPGP.3"; + send_status_info (ctrl, table[idx].name, tmp, strlen (tmp), NULL, 0); + return 0; + } + if (table[idx].special == -4) + { + char *serial; + time_t stamp; + + if (!app_get_serial_and_stamp (app, &serial, &stamp)) + { + if (strlen (serial) > 16+12) + { + send_status_info (ctrl, table[idx].name, serial+16, 12, NULL, 0); + xfree (serial); + return 0; + } + xfree (serial); + } + return gpg_error (GPG_ERR_INV_NAME); + } relptr = get_one_do (app, table[idx].tag, &value, &valuelen, &rc); if (relptr) @@ -2203,7 +2228,7 @@ fingerprint delimited by a slash. Optionally the id OPENPGP.3 may be given. - Note that this fucntion may return the error code + Note that this function may return the error code GPG_ERR_WRONG_CARD to indicate that the card currently present does not match the one required for the requested action (e.g. the serial number does not match). */ Modified: branches/GNUPG-1-9-BRANCH/scd/app-p15.c =================================================================== --- branches/GNUPG-1-9-BRANCH/scd/app-p15.c 2005-09-07 17:05:42 UTC (rev 3886) +++ branches/GNUPG-1-9-BRANCH/scd/app-p15.c 2005-09-09 11:18:08 UTC (rev 3887) @@ -2629,7 +2629,6 @@ } - /* Handler for the READCERT command. Read the certificate with id CERTID (as returned by learn_status in @@ -2653,6 +2652,95 @@ } + +/* Implement the GETATTR command. This is similar to the LEARN + command but returns just one value via the status interface. */ +static gpg_error_t +do_getattr (app_t app, ctrl_t ctrl, const char *name) +{ + gpg_error_t err; + int i; + + if (!strcmp (name, "$AUTHKEYID")) + { + char *buf, *p; + prkdf_object_t prkdf; + + /* We return the ID of the first private keycapable of + signing. */ + for (prkdf = app->app_local->private_key_info; prkdf; + prkdf = prkdf->next) + if (prkdf->usageflags.sign) + break; + if (prkdf) + { + buf = xtrymalloc (9 + prkdf->objidlen*2 + 1); + if (!buf) + return gpg_error_from_errno (errno); + p = stpcpy (buf, "P15"); + if (app->app_local->home_df) + { + sprintf (p, "-%04hX", (app->app_local->home_df & 0xffff)); + p += 5; + } + p = stpcpy (p, "."); + for (i=0; i < prkdf->objidlen; i++) + { + sprintf (p, "%02X", prkdf->objid[i]); + p += 2; + } + + send_status_info (ctrl, name, buf, strlen (buf), NULL, 0); + xfree (buf); + return 0; + } + } + else if (!strcmp (name, "$DISPSERIALNO")) + { + /* For certain cards we return special IDs. There is no + general rule for it so we need to decide case by case. */ + if (app->app_local->card_type == CARD_TYPE_BELPIC) + { + /* The eID card has a card number printed on the fron matter + which seems to be a good indication. */ + unsigned char *buffer; + const unsigned char *p; + size_t buflen, n; + unsigned short path[] = { 0x3F00, 0xDF01, 0x4031 }; + + err = select_ef_by_path (app, path, DIM(path) ); + if (!err) + err = iso7816_read_binary (app->slot, 0, 0, &buffer, &buflen); + if (err) + { + log_error ("error accessing EF(ID): %s\n", gpg_strerror (err)); + return err; + } + + p = find_tlv (buffer, buflen, 1, &n); + if (p && n == 12) + { + char tmp[12+2+1]; + memcpy (tmp, p, 3); + tmp[3] = '-'; + memcpy (tmp+4, p+3, 7); + tmp[11] = '-'; + memcpy (tmp+12, p+10, 2); + tmp[14] = 0; + send_status_info (ctrl, name, tmp, strlen (tmp), NULL, 0); + xfree (buffer); + return 0; + } + xfree (buffer); + } + + } + return gpg_error (GPG_ERR_INV_NAME); +} + + + + /* Micardo cards require special treatment. This is a helper for the crypto functions to manage the security environment. We expect that the key file has already been selected. FID is the one of the @@ -3086,6 +3174,38 @@ } +/* Handler for the PKAUTH command. + + This is basically the same as the PKSIGN command but we firstcheck + that the requested key is suitable for authentication; that is, it + must match the criteria used for the attribute $AUTHKEYID. See + do_sign for calling conventions; there is no HASHALGO, though. */ +static gpg_error_t +do_auth (app_t app, const char *keyidstr, + gpg_error_t (*pincb)(void*, const char *, char **), + void *pincb_arg, + const void *indata, size_t indatalen, + unsigned char **outdata, size_t *outdatalen ) +{ + gpg_error_t err; + prkdf_object_t prkdf; + + if (!keyidstr || !*keyidstr) + return gpg_error (GPG_ERR_INV_VALUE); + + err = prkdf_object_from_keyidstr (app, keyidstr, &prkdf); + if (err) + return err; + if (!prkdf->usageflags.sign) + { + log_error ("key %s may not be used for authentication\n", keyidstr); + return gpg_error (GPG_ERR_WRONG_KEY_USAGE); + } + return do_sign (app, keyidstr, GCRY_MD_SHA1, pincb, pincb_arg, + indata, indatalen, outdata, outdatalen); +} + + /* Assume that EF(DIR) has been selected. Read its content and figure out the home EF of pkcs#15. Return that home DF or 0 if not found @@ -3270,11 +3390,11 @@ app->fnc.deinit = do_deinit; app->fnc.learn_status = do_learn_status; app->fnc.readcert = do_readcert; - app->fnc.getattr = NULL; + app->fnc.getattr = do_getattr; app->fnc.setattr = NULL; app->fnc.genkey = NULL; app->fnc.sign = do_sign; - app->fnc.auth = NULL; + app->fnc.auth = do_auth; app->fnc.decipher = NULL; app->fnc.change_pin = NULL; app->fnc.check_pin = NULL; @@ -3286,5 +3406,3 @@ return rc; } - - Modified: branches/GNUPG-1-9-BRANCH/scd/ccid-driver.c =================================================================== --- branches/GNUPG-1-9-BRANCH/scd/ccid-driver.c 2005-09-07 17:05:42 UTC (rev 3886) +++ branches/GNUPG-1-9-BRANCH/scd/ccid-driver.c 2005-09-09 11:18:08 UTC (rev 3887) @@ -16,7 +16,8 @@ * * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. * * ALTERNATIVELY, this file may be distributed under the terms of the * following license, in which case the provisions of this license are Modified: branches/GNUPG-1-9-BRANCH/scd/ccid-driver.h =================================================================== --- branches/GNUPG-1-9-BRANCH/scd/ccid-driver.h 2005-09-07 17:05:42 UTC (rev 3886) +++ branches/GNUPG-1-9-BRANCH/scd/ccid-driver.h 2005-09-09 11:18:08 UTC (rev 3887) @@ -15,7 +15,8 @@ * * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. * * ALTERNATIVELY, this file may be distributed under the terms of the * following license, in which case the provisions of this license are Modified: branches/GNUPG-1-9-BRANCH/scd/iso7816.c =================================================================== --- branches/GNUPG-1-9-BRANCH/scd/iso7816.c 2005-09-07 17:05:42 UTC (rev 3886) +++ branches/GNUPG-1-9-BRANCH/scd/iso7816.c 2005-09-09 11:18:08 UTC (rev 3887) @@ -15,7 +15,8 @@ * * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. * * $Id$ */ Modified: branches/GNUPG-1-9-BRANCH/scd/iso7816.h =================================================================== --- branches/GNUPG-1-9-BRANCH/scd/iso7816.h 2005-09-07 17:05:42 UTC (rev 3886) +++ branches/GNUPG-1-9-BRANCH/scd/iso7816.h 2005-09-09 11:18:08 UTC (rev 3887) @@ -15,7 +15,8 @@ * * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. * * $Id$ */ Modified: branches/GNUPG-1-9-BRANCH/scd/pcsc-wrapper.c =================================================================== --- branches/GNUPG-1-9-BRANCH/scd/pcsc-wrapper.c 2005-09-07 17:05:42 UTC (rev 3886) +++ branches/GNUPG-1-9-BRANCH/scd/pcsc-wrapper.c 2005-09-09 11:18:08 UTC (rev 3887) @@ -819,7 +819,6 @@ fprintf (stderr, PGM ": invalid request 0x%02X\n", c); exit (1); } - free (argbuffer); } return 0; } Modified: branches/GNUPG-1-9-BRANCH/sm/ChangeLog =================================================================== --- branches/GNUPG-1-9-BRANCH/sm/ChangeLog 2005-09-07 17:05:42 UTC (rev 3886) +++ branches/GNUPG-1-9-BRANCH/sm/ChangeLog 2005-09-09 11:18:08 UTC (rev 3887) @@ -1,3 +1,9 @@ +2005-09-08 Werner Koch + + * export.c (popen_protect_tool): Add option --have-cert. We + probably lost this option with 1.9.14 due to restructuring of + export.c. + 2005-07-21 Werner Koch * gpgsm.c (main): New options --no-log-file and --debug-none. Modified: branches/GNUPG-1-9-BRANCH/sm/export.c =================================================================== --- branches/GNUPG-1-9-BRANCH/sm/export.c 2005-09-07 17:05:42 UTC (rev 3886) +++ branches/GNUPG-1-9-BRANCH/sm/export.c 2005-09-09 11:18:08 UTC (rev 3887) @@ -520,6 +520,7 @@ argv[i++] = "--homedir"; argv[i++] = opt.homedir; argv[i++] = "--p12-export"; + argv[i++] = "--have-cert"; argv[i++] = "--prompt"; argv[i++] = prompt?prompt:""; argv[i++] = "--enable-status-msg"; From cvs at cvs.gnupg.org Fri Sep 9 15:48:49 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Fri Sep 9 15:22:45 2005 Subject: [svn] GnuPG - r3888 - branches/GNUPG-1-9-BRANCH/agent Message-ID: Author: wk Date: 2005-09-09 15:48:48 +0200 (Fri, 09 Sep 2005) New Revision: 3888 Modified: branches/GNUPG-1-9-BRANCH/agent/ChangeLog branches/GNUPG-1-9-BRANCH/agent/minip12.c Log: Fixed yesterdays change. Importing to Outlook seems to work now. Modified: branches/GNUPG-1-9-BRANCH/agent/ChangeLog =================================================================== --- branches/GNUPG-1-9-BRANCH/agent/ChangeLog 2005-09-09 11:18:08 UTC (rev 3887) +++ branches/GNUPG-1-9-BRANCH/agent/ChangeLog 2005-09-09 13:48:48 UTC (rev 3888) @@ -2,6 +2,7 @@ * minip12.c (p12_build): Oops, array needs to be larger for the certificate. + (build_cert_bag): Fixed yesterdays change. * command-ssh.c (card_key_available): Let the card handler decide whether the card is supported here. Also get a short serial Modified: branches/GNUPG-1-9-BRANCH/agent/minip12.c =================================================================== --- branches/GNUPG-1-9-BRANCH/agent/minip12.c 2005-09-09 11:18:08 UTC (rev 3887) +++ branches/GNUPG-1-9-BRANCH/agent/minip12.c 2005-09-09 13:48:48 UTC (rev 3888) @@ -1409,7 +1409,7 @@ p += DIM (oid_encryptedData); /* 2. Store a [0] tag. */ - p = store_tag_length (p, 0x80, len[2]); + p = store_tag_length (p, 0xa0, len[2]); /* 3. Store a sequence. */ p = store_tag_length (p, TAG_SEQUENCE, len[3]); @@ -1433,7 +1433,7 @@ p += DIM (data_rc2iter2048); /* 8. And finally the [0] tag with the encrypted data. */ - p = store_tag_length (p, 0xa0, buflen); + p = store_tag_length (p, 0x80, buflen); memcpy (p, buffer, buflen); p += buflen; certbaglen = p - certbag; From cvs at cvs.gnupg.org Sat Sep 10 18:50:42 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Sat Sep 10 18:24:27 2005 Subject: [svn] GnuPG - r3889 - trunk/g10 Message-ID: Author: dshaw Date: 2005-09-10 18:50:41 +0200 (Sat, 10 Sep 2005) New Revision: 3889 Modified: trunk/g10/ChangeLog trunk/g10/keyedit.c Log: * keyedit.c (show_names): Moved name display code out from show_key_with_all_names. (keyedit_menu): Call it here for pref and showpref so they can show only the selected user ID. Suggested by Timo Schulz. Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2005-09-09 13:48:48 UTC (rev 3888) +++ trunk/g10/ChangeLog 2005-09-10 16:50:41 UTC (rev 3889) @@ -1,3 +1,10 @@ +2005-09-10 David Shaw + + * keyedit.c (show_names): Moved name display code out from + show_key_with_all_names. + (keyedit_menu): Call it here for pref and showpref so they can + show only the selected user ID. Suggested by Timo Schulz. + 2005-09-07 Werner Koch * cardglue.h (GPG_ERR_TOO_LARGE): New. Modified: trunk/g10/keyedit.c =================================================================== --- trunk/g10/keyedit.c 2005-09-09 13:48:48 UTC (rev 3888) +++ trunk/g10/keyedit.c 2005-09-10 16:50:41 UTC (rev 3889) @@ -48,6 +48,8 @@ #include "keyserver-internal.h" static void show_prefs( PKT_user_id *uid, PKT_signature *selfsig, int verbose); +static void show_names(KBNODE keyblock,PKT_public_key *pk, + unsigned int flag,int with_prefs); static void show_key_with_all_names( KBNODE keyblock, int only_marked, int with_revoker, int with_fpr, int with_subkeys, int with_prefs ); static void show_key_and_fingerprint( KBNODE keyblock ); @@ -2083,11 +2085,21 @@ break; case cmdPREF: - show_key_with_all_names( keyblock, 0, 0, 0, 0, 1 ); + { + int count=count_selected_uids(keyblock); + assert(keyblock->pkt->pkttype==PKT_PUBLIC_KEY); + show_names(keyblock,keyblock->pkt->pkt.public_key, + count?NODFLG_SELUID:0,1); + } break; case cmdSHOWPREF: - show_key_with_all_names( keyblock, 0, 0, 0, 0, 2 ); + { + int count=count_selected_uids(keyblock); + assert(keyblock->pkt->pkttype==PKT_PUBLIC_KEY); + show_names(keyblock,keyblock->pkt->pkt.public_key, + count?NODFLG_SELUID:0,2); + } break; case cmdSETPREF: @@ -2535,7 +2547,64 @@ } } +static void +show_names(KBNODE keyblock,PKT_public_key *pk,unsigned int flag,int with_prefs) +{ + KBNODE node; + int i=0; + for( node = keyblock; node; node = node->next ) + { + if( node->pkt->pkttype == PKT_USER_ID + && !is_deleted_kbnode(node)) + { + PKT_user_id *uid = node->pkt->pkt.user_id; + ++i; + if(!flag || (flag && (node->flag & flag))) + { + if(!(flag&NODFLG_MARK_A) && pk) + tty_printf("%s ",uid_trust_string_fixed(pk,uid)); + + if( flag & NODFLG_MARK_A ) + tty_printf(" "); + else if( node->flag & NODFLG_SELUID ) + tty_printf("(%d)* ", i); + else if( uid->is_primary ) + tty_printf("(%d). ", i); + else + tty_printf("(%d) ", i); + tty_print_utf8_string( uid->name, uid->len ); + tty_printf("\n"); + if(with_prefs && pk) + { + if(pk->version>3 || uid->selfsigversion>3) + { + PKT_signature *selfsig=NULL; + KBNODE signode; + + for(signode=node->next; + signode && signode->pkt->pkttype==PKT_SIGNATURE; + signode=signode->next) + { + if(signode->pkt->pkt.signature-> + flags.chosen_selfsig) + { + selfsig=signode->pkt->pkt.signature; + break; + } + } + + show_prefs (uid, selfsig, with_prefs == 2); + } + else + tty_printf(_("There are no preferences on a" + " PGP 2.x-style user ID.\n")); + } + } + } + } +} + /**************** * Display the key a the user ids, if only_marked is true, do only * so for user ids with mark A flag set and dont display the index number @@ -2713,61 +2782,9 @@ } } } - - /* the user ids */ - i = 0; - for( node = keyblock; node; node = node->next ) - { - if( node->pkt->pkttype == PKT_USER_ID - && !is_deleted_kbnode(node)) - { - PKT_user_id *uid = node->pkt->pkt.user_id; - ++i; - if( !only_marked || (only_marked && (node->flag & NODFLG_MARK_A))) - { - if(!only_marked && primary) - tty_printf("%s ",uid_trust_string_fixed(primary,uid)); + show_names(keyblock,primary,only_marked?NODFLG_MARK_A:0,with_prefs); - if( only_marked ) - tty_printf(" "); - else if( node->flag & NODFLG_SELUID ) - tty_printf("(%d)* ", i); - else if( uid->is_primary ) - tty_printf("(%d). ", i); - else - tty_printf("(%d) ", i); - tty_print_utf8_string( uid->name, uid->len ); - tty_printf("\n"); - if( with_prefs ) - { - if(pk_version>3 || uid->selfsigversion>3) - { - PKT_signature *selfsig=NULL; - KBNODE signode; - - for(signode=node->next; - signode && signode->pkt->pkttype==PKT_SIGNATURE; - signode=signode->next) - { - if(signode->pkt->pkt.signature-> - flags.chosen_selfsig) - { - selfsig=signode->pkt->pkt.signature; - break; - } - } - - show_prefs (uid, selfsig, with_prefs == 2); - } - else - tty_printf(_("There are no preferences on a" - " PGP 2.x-style user ID.\n")); - } - } - } - } - if (do_warn) tty_printf (_("Please note that the shown key validity" " is not necessarily correct\n" @@ -2775,7 +2792,7 @@ } -/* Display basic key information. This fucntion is suitable to show +/* Display basic key information. This function is suitable to show information on the key without any dependencies on the trustdb or any other internal GnuPG stuff. KEYBLOCK may either be a public or a secret key.*/ From cvs at cvs.gnupg.org Mon Sep 12 10:23:34 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Mon Sep 12 09:57:09 2005 Subject: [svn] GnuPG - r3890 - branches/GNUPG-1-9-BRANCH Message-ID: Author: wk Date: 2005-09-12 10:23:33 +0200 (Mon, 12 Sep 2005) New Revision: 3890 Modified: branches/GNUPG-1-9-BRANCH/NEWS branches/GNUPG-1-9-BRANCH/configure.ac Log: About to release 1.9.19 Modified: branches/GNUPG-1-9-BRANCH/NEWS =================================================================== --- branches/GNUPG-1-9-BRANCH/NEWS 2005-09-10 16:50:41 UTC (rev 3889) +++ branches/GNUPG-1-9-BRANCH/NEWS 2005-09-12 08:23:33 UTC (rev 3890) @@ -1,11 +1,13 @@ -Noteworthy changes in version 1.9.19 +Noteworthy changes in version 1.9.19 (2005-09-12) ------------------------------------------------- * The Belgian eID card is now supported for signatures and ssh. + Other pkcs#15 cards should work as well. * Fixed bug in --export-secret-key-p12 so that certificates are again included. + Noteworthy changes in version 1.9.18 (2005-08-01) ------------------------------------------------- Modified: branches/GNUPG-1-9-BRANCH/configure.ac =================================================================== --- branches/GNUPG-1-9-BRANCH/configure.ac 2005-09-10 16:50:41 UTC (rev 3889) +++ branches/GNUPG-1-9-BRANCH/configure.ac 2005-09-12 08:23:33 UTC (rev 3890) @@ -24,7 +24,7 @@ # Version number: Remember to change it immediately *after* a release. # Add a "-cvs" prefix for non-released code. -AC_INIT(gnupg, 1.9.19-cvs, gnupg-devel@gnupg.org) +AC_INIT(gnupg, 1.9.19, gnupg-devel@gnupg.org) # Set development_version to yes if the minor number is odd or you # feel that the default check for a development version is not # sufficient. From cvs at cvs.gnupg.org Mon Sep 12 10:47:55 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Mon Sep 12 10:21:29 2005 Subject: [svn] GnuPG - r3891 - tags Message-ID: Author: wk Date: 2005-09-12 10:47:55 +0200 (Mon, 12 Sep 2005) New Revision: 3891 Added: tags/V1-9-19/ Log: release Copied: tags/V1-9-19 (from rev 3890, branches/GNUPG-1-9-BRANCH) From cvs at cvs.gnupg.org Mon Sep 12 20:15:24 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Mon Sep 12 19:48:57 2005 Subject: [svn] dirmngr - r213 - in trunk: po src Message-ID: Author: wk Date: 2005-09-12 20:15:24 +0200 (Mon, 12 Sep 2005) New Revision: 213 Modified: trunk/po/de.po trunk/po/dirmngr.pot trunk/src/ChangeLog trunk/src/dirmngr.c Log: Fixed translation to match gpgconf Modified: trunk/po/de.po =================================================================== --- trunk/po/de.po 2005-06-15 08:53:35 UTC (rev 212) +++ trunk/po/de.po 2005-09-12 18:15:24 UTC (rev 213) @@ -7,8 +7,8 @@ msgstr "" "Project-Id-Version: dirmngr 0.9.2\n" "Report-Msgid-Bugs-To: gpa-dev@gnupg.org\n" -"POT-Creation-Date: 2005-04-21 09:33+0200\n" -"PO-Revision-Date: 2005-04-21 09:34+0200\n" +"POT-Creation-Date: 2005-09-12 19:45+0200\n" +"PO-Revision-Date: 2005-09-12 19:46+0200\n" "Last-Translator: Werner Koch \n" "Language-Team: de\n" "MIME-Version: 1.0\n" @@ -727,8 +727,8 @@ msgstr "Nicht von der Konsole losl?sen" #: src/dirmngr.c:127 -msgid "|FILE|write logs to FILE" -msgstr "|DATEI|Schreibe Logs in DATEI" +msgid "|FILE|write server mode logs to FILE" +msgstr "|DATEI|Schreibe im Servermodus Logs auf DATEI" #: src/dirmngr.c:128 msgid "run without asking a user" @@ -1303,62 +1303,62 @@ msgid "serialno missing in cert ID" msgstr "Seriennummer fehlt in der Cert-ID" -#: src/server.c:428 src/server.c:544 src/server.c:623 src/server.c:763 -#: src/server.c:791 src/server.c:815 src/server.c:868 src/server.c:921 +#: src/server.c:428 src/server.c:544 src/server.c:623 src/server.c:781 +#: src/server.c:809 src/server.c:833 src/server.c:886 src/server.c:939 #, c-format msgid "command %s failed: %s\n" msgstr "Kommando %s fehlgeschlagen: %s\n" -#: src/server.c:514 src/server.c:596 src/server.c:847 src/server.c:900 +#: src/server.c:514 src/server.c:596 src/server.c:865 src/server.c:918 #, c-format msgid "assuan_inquire failed: %s\n" msgstr "assuan_inquire fehlgeschlagen: %s\n" -#: src/server.c:691 +#: src/server.c:700 #, c-format msgid "start_cert_fetch failed: %s\n" msgstr "start_cert_fetch fehlgeschlagen: %s\n" -#: src/server.c:718 +#: src/server.c:733 #, c-format msgid "fetch_next_cert failed: %s\n" msgstr "fetch_next_cert fehlgeschlagen: %s\n" -#: src/server.c:737 +#: src/server.c:752 #, c-format msgid "error sending data: %s\n" msgstr "Fehler beim Senden der Daten: %s\n" -#: src/server.c:746 +#: src/server.c:761 #, c-format msgid "max_replies %d exceeded\n" msgstr "max_replies %d ?berschritten\n" -#: src/server.c:811 +#: src/server.c:829 msgid "no data stream" msgstr "Kein Datenstrom" -#: src/server.c:974 +#: src/server.c:992 #, c-format msgid "can't allocate control structure: %s\n" msgstr "Fehler beim Erzeugen der Kontrollstruktur: %s\n" -#: src/server.c:997 +#: src/server.c:1015 #, c-format msgid "failed to initialize the server: %s\n" msgstr "Fehler beim Initialisieren des Servers: %s\n" -#: src/server.c:1005 +#: src/server.c:1023 #, c-format msgid "failed to the register commands with Assuan: %s\n" msgstr "Fehler beim Registrieren der Kommandos gegen Assuan: %s\n" -#: src/server.c:1025 +#: src/server.c:1043 #, c-format msgid "Assuan accept problem: %s\n" msgstr "Assuan accept Problem: %s\n" -#: src/server.c:1032 +#: src/server.c:1050 #, c-format msgid "Assuan processing failed: %s\n" msgstr "Assuan Verarbeitung fehlgeschlagen: %s\n" Modified: trunk/po/dirmngr.pot =================================================================== --- trunk/po/dirmngr.pot 2005-06-15 08:53:35 UTC (rev 212) +++ trunk/po/dirmngr.pot 2005-09-12 18:15:24 UTC (rev 213) @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: gpa-dev@gnupg.org\n" -"POT-Creation-Date: 2005-04-21 09:33+0200\n" +"POT-Creation-Date: 2005-09-12 19:45+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -702,7 +702,7 @@ msgstr "" #: src/dirmngr.c:127 -msgid "|FILE|write logs to FILE" +msgid "|FILE|write server mode logs to FILE" msgstr "" #: src/dirmngr.c:128 @@ -1271,62 +1271,62 @@ msgid "serialno missing in cert ID" msgstr "" -#: src/server.c:428 src/server.c:544 src/server.c:623 src/server.c:763 -#: src/server.c:791 src/server.c:815 src/server.c:868 src/server.c:921 +#: src/server.c:428 src/server.c:544 src/server.c:623 src/server.c:781 +#: src/server.c:809 src/server.c:833 src/server.c:886 src/server.c:939 #, c-format msgid "command %s failed: %s\n" msgstr "" -#: src/server.c:514 src/server.c:596 src/server.c:847 src/server.c:900 +#: src/server.c:514 src/server.c:596 src/server.c:865 src/server.c:918 #, c-format msgid "assuan_inquire failed: %s\n" msgstr "" -#: src/server.c:691 +#: src/server.c:700 #, c-format msgid "start_cert_fetch failed: %s\n" msgstr "" -#: src/server.c:718 +#: src/server.c:733 #, c-format msgid "fetch_next_cert failed: %s\n" msgstr "" -#: src/server.c:737 +#: src/server.c:752 #, c-format msgid "error sending data: %s\n" msgstr "" -#: src/server.c:746 +#: src/server.c:761 #, c-format msgid "max_replies %d exceeded\n" msgstr "" -#: src/server.c:811 +#: src/server.c:829 msgid "no data stream" msgstr "" -#: src/server.c:974 +#: src/server.c:992 #, c-format msgid "can't allocate control structure: %s\n" msgstr "" -#: src/server.c:997 +#: src/server.c:1015 #, c-format msgid "failed to initialize the server: %s\n" msgstr "" -#: src/server.c:1005 +#: src/server.c:1023 #, c-format msgid "failed to the register commands with Assuan: %s\n" msgstr "" -#: src/server.c:1025 +#: src/server.c:1043 #, c-format msgid "Assuan accept problem: %s\n" msgstr "" -#: src/server.c:1032 +#: src/server.c:1050 #, c-format msgid "Assuan processing failed: %s\n" msgstr "" Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2005-06-15 08:53:35 UTC (rev 212) +++ trunk/src/ChangeLog 2005-09-12 18:15:24 UTC (rev 213) @@ -1,3 +1,7 @@ +2005-09-12 Werner Koch + + * dirmngr.c: Fixed description to match the one in gpgconf. + 2005-06-15 Werner Koch * server.c (cmd_lookup): Take care of NO_DATA which might get Modified: trunk/src/dirmngr.c =================================================================== --- trunk/src/dirmngr.c 2005-06-15 08:53:35 UTC (rev 212) +++ trunk/src/dirmngr.c 2005-09-12 18:15:24 UTC (rev 213) @@ -124,7 +124,7 @@ { oDebugLevel, "debug-level",2, N_("|LEVEL|set the debugging level to LEVEL")}, { oNoDetach, "no-detach" ,0, N_("do not detach from the console")}, - { oLogFile, "log-file" ,2, N_("|FILE|write logs to FILE")}, + { oLogFile, "log-file" ,2, N_("|FILE|write server mode logs to FILE")}, { oBatch , "batch" ,0, N_("run without asking a user")}, { oForce, "force" ,0, N_("force loading of outdated CRLs")}, { oAllowOCSP, "allow-ocsp",0,N_("allow sending OCSP requests")}, From cvs at cvs.gnupg.org Mon Sep 12 21:06:46 2005 From: cvs at cvs.gnupg.org (svn author marcus) Date: Mon Sep 12 20:40:18 2005 Subject: [svn] gpgme - r1094 - trunk/gpgme Message-ID: Author: marcus Date: 2005-09-12 21:06:45 +0200 (Mon, 12 Sep 2005) New Revision: 1094 Modified: trunk/gpgme/ChangeLog trunk/gpgme/keylist.c Log: 2005-09-12 Marcus Brinkmann * keylist.c (release_op_data): Do not free opd->tmp_uid. Modified: trunk/gpgme/ChangeLog =================================================================== --- trunk/gpgme/ChangeLog 2005-09-08 15:17:58 UTC (rev 1093) +++ trunk/gpgme/ChangeLog 2005-09-12 19:06:45 UTC (rev 1094) @@ -1,3 +1,7 @@ +2005-09-12 Marcus Brinkmann + + * keylist.c (release_op_data): Do not free opd->tmp_uid. + 2005-08-26 Marcus Brinkmann * rungpg.c (command_handler): Use _gpgme_io_write instead of write. Modified: trunk/gpgme/keylist.c =================================================================== --- trunk/gpgme/keylist.c 2005-09-08 15:17:58 UTC (rev 1093) +++ trunk/gpgme/keylist.c 2005-09-12 19:06:45 UTC (rev 1094) @@ -48,6 +48,7 @@ struct _gpgme_op_keylist_result result; gpgme_key_t tmp_key; + /* This points to the last uid in tmp_key. */ gpgme_user_id_t tmp_uid; /* Something new is available. */ int key_cond; @@ -63,8 +64,9 @@ if (opd->tmp_key) gpgme_key_unref (opd->tmp_key); - if (opd->tmp_uid) - free (opd->tmp_uid); + /* opd->tmp_uid is actually part of opd->tmp_key, so we do not need + to release it here. */ + while (key) { struct key_queue_item_s *next = key->next; From cvs at cvs.gnupg.org Mon Sep 12 21:08:30 2005 From: cvs at cvs.gnupg.org (svn author marcus) Date: Mon Sep 12 20:42:01 2005 Subject: [svn] gpgme - r1095 - branches/gpgme-1-0-branch/gpgme Message-ID: Author: marcus Date: 2005-09-12 21:08:29 +0200 (Mon, 12 Sep 2005) New Revision: 1095 Modified: branches/gpgme-1-0-branch/gpgme/ChangeLog branches/gpgme-1-0-branch/gpgme/keylist.c Log: 2005-09-12 Marcus Brinkmann * keylist.c (release_op_data): Do not free opd->tmp_uid. Modified: branches/gpgme-1-0-branch/gpgme/ChangeLog =================================================================== --- branches/gpgme-1-0-branch/gpgme/ChangeLog 2005-09-12 19:06:45 UTC (rev 1094) +++ branches/gpgme-1-0-branch/gpgme/ChangeLog 2005-09-12 19:08:29 UTC (rev 1095) @@ -1,3 +1,7 @@ +2005-09-12 Marcus Brinkmann + + * keylist.c (release_op_data): Do not free opd->tmp_uid. + 2005-07-26 Marcus Brinkmann * keylist.c (gpgme_get_key): Allow key IDs. Modified: branches/gpgme-1-0-branch/gpgme/keylist.c =================================================================== --- branches/gpgme-1-0-branch/gpgme/keylist.c 2005-09-12 19:06:45 UTC (rev 1094) +++ branches/gpgme-1-0-branch/gpgme/keylist.c 2005-09-12 19:08:29 UTC (rev 1095) @@ -48,6 +48,7 @@ struct _gpgme_op_keylist_result result; gpgme_key_t tmp_key; + /* This points to the last uid in tmp_key. */ gpgme_user_id_t tmp_uid; /* Something new is available. */ int key_cond; @@ -63,8 +64,9 @@ if (opd->tmp_key) gpgme_key_unref (opd->tmp_key); - if (opd->tmp_uid) - free (opd->tmp_uid); + /* opd->tmp_uid is actually part of opd->tmp_key, so we do not need + to release it here. */ + while (key) { struct key_queue_item_s *next = key->next; From cvs at cvs.gnupg.org Mon Sep 12 21:14:38 2005 From: cvs at cvs.gnupg.org (svn author marcus) Date: Mon Sep 12 20:48:13 2005 Subject: [svn] gpgme - r1096 - in trunk: . gpgme Message-ID: Author: marcus Date: 2005-09-12 21:14:36 +0200 (Mon, 12 Sep 2005) New Revision: 1096 Removed: trunk/gpgme/ath-compat.c trunk/gpgme/ath-pth-compat.c trunk/gpgme/ath-pthread-compat.c Modified: trunk/ChangeLog trunk/NEWS trunk/gpgme/ChangeLog trunk/gpgme/Makefile.am trunk/gpgme/ath.h trunk/gpgme/posix-sema.c Log: 2005-09-12 Marcus Brinkmann * configure.ac (HAVE_PTH): Don't add $PTH_CFLAGS to $CFLAGS here. gpgme/ 2005-09-12 Marcus Brinkmann * Makefile.am (libgpgme_la_SOURCES): Set to ath.h and ath.c. (ath_pth_src, ath_pthread_src): Removed. (w32_o_files): Replace ath-compat.o with ath.o. (libgpgme_pth_la_CFLAGS): New variable. * ath-compat.c, ath-pthread-compat.c, ath-pth-compat.c: Removed. * ath.h (ath_pthread_available, ath_pth_available): Removed. (ath_init) [!_ATH_EXT_SYM_PREFIX]: Do not define macro. (struct ath_ops, ath_init) [_ATH_COMPAT]: Removed. (_ATH_COMPAT): Macro removed. * posix-sema.c (_gpgme_sema_subsystem_init): Do not call _gpgme_ath_init. Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2005-09-12 19:08:29 UTC (rev 1095) +++ trunk/ChangeLog 2005-09-12 19:14:36 UTC (rev 1096) @@ -1,3 +1,7 @@ +2005-09-12 Marcus Brinkmann + + * configure.ac (HAVE_PTH): Don't add $PTH_CFLAGS to $CFLAGS here. + 2005-08-26 Werner Koch * configure.ac (SEPCONSTANTS): New to define DIRSEP_C et al. Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2005-09-12 19:08:29 UTC (rev 1095) +++ trunk/NEWS 2005-09-12 19:14:36 UTC (rev 1096) @@ -1,12 +1,6 @@ Noteworthy changes in version 1.1.0 (unreleased) ------------------------------------------------ - * "./autogen.sh --build-w32" does now build gpgme.dll. - - * [W32] The environment variable GPGME_DEBUG now uses a semicolon as - delimiter. The standard install directory is used when locating - gpg or gpgsm before finally falling back to the hardwired name. - * You can now configure the backend engine file name and home directory to be used, as default and per context. @@ -27,6 +21,22 @@ if available is made available in the new field plaintext_filename of the respective result structure. + * The code for "automagically detecting the thread library" has been + removed from libgpgme. It is deprecated since version 0.4.3. + Since then, you had to link against libgpgme-pthread for + applications using pthread and libgpgme-pth for applications using + GNU Pth. + + The code was removed because it caused compilation problems on + systems where the pthread.h header from GNU Pth is available in + addition to the system header (FreeBSD 6 and later for example). + + * "./autogen.sh --build-w32" does now build gpgme.dll. + + * [W32] The environment variable GPGME_DEBUG now uses a semicolon as + delimiter. The standard install directory is used when locating + gpg or gpgsm before finally falling back to the hardwired name. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ gpgme_set_engine_info NEW gpgme_ctx_get_engine_info NEW Modified: trunk/gpgme/ChangeLog =================================================================== --- trunk/gpgme/ChangeLog 2005-09-12 19:08:29 UTC (rev 1095) +++ trunk/gpgme/ChangeLog 2005-09-12 19:14:36 UTC (rev 1096) @@ -1,5 +1,19 @@ 2005-09-12 Marcus Brinkmann + * Makefile.am (libgpgme_la_SOURCES): Set to ath.h and ath.c. + (ath_pth_src, ath_pthread_src): Removed. + (w32_o_files): Replace ath-compat.o with ath.o. + (libgpgme_pth_la_CFLAGS): New variable. + * ath-compat.c, ath-pthread-compat.c, ath-pth-compat.c: Removed. + * ath.h (ath_pthread_available, ath_pth_available): Removed. + (ath_init) [!_ATH_EXT_SYM_PREFIX]: Do not define macro. + (struct ath_ops, ath_init) [_ATH_COMPAT]: Removed. + (_ATH_COMPAT): Macro removed. + * posix-sema.c (_gpgme_sema_subsystem_init): Do not call + _gpgme_ath_init. + +2005-09-12 Marcus Brinkmann + * keylist.c (release_op_data): Do not free opd->tmp_uid. 2005-08-26 Marcus Brinkmann Modified: trunk/gpgme/Makefile.am =================================================================== --- trunk/gpgme/Makefile.am 2005-09-12 19:08:29 UTC (rev 1095) +++ trunk/gpgme/Makefile.am 2005-09-12 19:14:36 UTC (rev 1096) @@ -83,18 +83,7 @@ $(gpgsm_components) sema.h priv-io.h $(system_components) \ debug.c debug.h gpgme.c version.c error.c -# libgpgme_la_SOURCES = ath.h ath.c -if HAVE_PTH - ath_pth_src = ath-pth-compat.c -else - ath_pth_src = -endif -if HAVE_PTHREAD - ath_pthread_src = ath-pthread-compat.c -else - ath_pthread_src = -endif -libgpgme_la_SOURCES = ath.h ath-compat.c $(ath_pth_src) $(ath_pthread_src) +libgpgme_la_SOURCES = ath.h ath.c libgpgme_pthread_la_SOURCES = ath.h ath-pthread.c libgpgme_pth_la_SOURCES = ath.h ath-pth.c @@ -114,6 +103,7 @@ libgpgme_pthread_la_LIBADD = libgpgme-real.la $(assuan_libobjs) @LTLIBOBJS@ \ -lpthread @GPG_ERROR_LIBS@ +libgpgme_pth_la_CFLAGS = $(AM_CFLAGS) @PTH_CFLAGS@ libgpgme_pth_la_CPPFLAGS = $(AM_CPPFLAGS) @PTH_CPPFLAGS@ libgpgme_pth_la_LDFLAGS = @PTH_LDFLAGS@ \ $(libgpgme_version_script_cmd) -version-info \ @@ -130,7 +120,7 @@ # able to do this properly; we better use gcc's built in magic. if HAVE_W32_SYSTEM -w32_o_files = ath-compat.o conversion.o data-compat.o data-fd.o \ +w32_o_files = ath.o conversion.o data-compat.o data-fd.o \ data-mem.o data-stream.o data-user.o data.o debug.o \ decrypt-verify.o decrypt.o delete.o edit.o encrypt-sign.o \ encrypt.o engine-gpgsm.o engine.o error.o export.o genkey.o \ Deleted: trunk/gpgme/ath-compat.c Deleted: trunk/gpgme/ath-pth-compat.c Deleted: trunk/gpgme/ath-pthread-compat.c Modified: trunk/gpgme/ath.h =================================================================== --- trunk/gpgme/ath.h 2005-09-12 19:08:29 UTC (rev 1095) +++ trunk/gpgme/ath.h 2005-09-12 19:14:36 UTC (rev 1096) @@ -86,34 +86,4 @@ int ath_sendmsg (int s, const struct msghdr *msg, int flags); int ath_recvmsg (int s, struct msghdr *msg, int flags); -#define _ATH_COMPAT -#ifdef _ATH_COMPAT -struct ath_ops -{ - int (*mutex_init) (void **priv, int just_check); - int (*mutex_destroy) (void *priv); - int (*mutex_lock) (void *priv); - int (*mutex_unlock) (void *priv); - ssize_t (*read) (int fd, void *buf, size_t nbytes); - ssize_t (*write) (int fd, const void *buf, size_t nbytes); - ssize_t (*select) (int nfd, fd_set *rset, fd_set *wset, fd_set *eset, - struct timeval *timeout); - ssize_t (*waitpid) (pid_t pid, int *status, int options); - int (*accept) (int s, struct sockaddr *addr, socklen_t *length_ptr); - int (*connect) (int s, const struct sockaddr *addr, socklen_t length); - int (*sendmsg) (int s, const struct msghdr *msg, int flags); - int (*recvmsg) (int s, struct msghdr *msg, int flags); -}; - -/* Initialize the any-thread package. */ -#define ath_init _ATH_PREFIX(ath_init) -void ath_init (void); - -/* Used by ath_pkg_init. */ -#define ath_pthread_available _ATH_PREFIX(ath_pthread_available) -struct ath_ops *ath_pthread_available (void); -#define ath_pth_available _ATH_PREFIX(ath_pth_available) -struct ath_ops *ath_pth_available (void); -#endif - #endif /* ATH_H */ Modified: trunk/gpgme/posix-sema.c =================================================================== --- trunk/gpgme/posix-sema.c 2005-09-12 19:08:29 UTC (rev 1095) +++ trunk/gpgme/posix-sema.c 2005-09-12 19:14:36 UTC (rev 1096) @@ -40,8 +40,6 @@ void _gpgme_sema_subsystem_init () { - /* FIXME: we should check that there is only one thread running */ - _gpgme_ath_init (); } void From cvs at cvs.gnupg.org Mon Sep 12 21:15:14 2005 From: cvs at cvs.gnupg.org (svn author marcus) Date: Mon Sep 12 20:48:45 2005 Subject: [svn] gpgme - r1097 - trunk Message-ID: Author: marcus Date: 2005-09-12 21:15:14 +0200 (Mon, 12 Sep 2005) New Revision: 1097 Modified: trunk/configure.ac Log: 2005-09-12 Marcus Brinkmann * configure.ac (HAVE_PTH): Don't add $PTH_CFLAGS to $CFLAGS here. gpgme/ 2005-09-12 Marcus Brinkmann * Makefile.am (libgpgme_la_SOURCES): Set to ath.h and ath.c. (ath_pth_src, ath_pthread_src): Removed. (w32_o_files): Replace ath-compat.o with ath.o. (libgpgme_pth_la_CFLAGS): New variable. * ath-compat.c, ath-pthread-compat.c, ath-pth-compat.c: Removed. * ath.h (ath_pthread_available, ath_pth_available): Removed. (ath_init) [!_ATH_EXT_SYM_PREFIX]: Do not define macro. (struct ath_ops, ath_init) [_ATH_COMPAT]: Removed. (_ATH_COMPAT): Macro removed. * posix-sema.c (_gpgme_sema_subsystem_init): Do not call _gpgme_ath_init. Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2005-09-12 19:14:36 UTC (rev 1096) +++ trunk/configure.ac 2005-09-12 19:15:14 UTC (rev 1097) @@ -122,7 +122,6 @@ AC_CHECK_PTH(1.2.0,,,no,have_pth=yes) if test "$have_pth" = yes; then AC_DEFINE(HAVE_PTH, ,[Define if we have Pth.]) - CFLAGS="$CFLAGS $PTH_CFLAGS" fi AC_CHECK_LIB(pthread,pthread_create,have_pthread=yes) if test "$have_pthread" = yes; then From cvs at cvs.gnupg.org Tue Sep 13 12:18:55 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue Sep 13 11:52:22 2005 Subject: [svn] gcry - r1103 - in branches/LIBGCRYPT-1-2-BRANCH: . cipher tests Message-ID: Author: wk Date: 2005-09-13 12:18:54 +0200 (Tue, 13 Sep 2005) New Revision: 1103 Added: branches/LIBGCRYPT-1-2-BRANCH/tests/random.c Modified: branches/LIBGCRYPT-1-2-BRANCH/NEWS branches/LIBGCRYPT-1-2-BRANCH/cipher/ChangeLog branches/LIBGCRYPT-1-2-BRANCH/cipher/random.c branches/LIBGCRYPT-1-2-BRANCH/tests/ChangeLog branches/LIBGCRYPT-1-2-BRANCH/tests/Makefile.am Log: * random.c (gcry_create_nonce): Detect a fork and re-seed. (read_pool): Fixed the fork detection; it used to work only for multi-threaded processes. Modified: branches/LIBGCRYPT-1-2-BRANCH/NEWS =================================================================== --- branches/LIBGCRYPT-1-2-BRANCH/NEWS 2005-08-22 09:30:25 UTC (rev 1102) +++ branches/LIBGCRYPT-1-2-BRANCH/NEWS 2005-09-13 10:18:54 UTC (rev 1103) @@ -1,6 +1,8 @@ Noteworthy changes in version 1.2.2 ------------------------------------------------ + * Made the RNG immune against fork without exec. + * Minor changes to some function declarations. Buffer arguments are now typed as void pointer. This should not affect any compilation. A bug in the definition of gcry_cipher_register has been fixed. Modified: branches/LIBGCRYPT-1-2-BRANCH/cipher/ChangeLog =================================================================== --- branches/LIBGCRYPT-1-2-BRANCH/cipher/ChangeLog 2005-08-22 09:30:25 UTC (rev 1102) +++ branches/LIBGCRYPT-1-2-BRANCH/cipher/ChangeLog 2005-09-13 10:18:54 UTC (rev 1103) @@ -1,3 +1,9 @@ +2005-09-13 Werner Koch + + * random.c (gcry_create_nonce): Detect a fork and re-seed. + (read_pool): Fixed the fork detection; it used to work only for + multi-threaded processes. + 2005-06-16 Werner Koch * cipher.c (gcry_cipher_register): Changed arg ALGORITHM_ID Modified: branches/LIBGCRYPT-1-2-BRANCH/cipher/random.c =================================================================== --- branches/LIBGCRYPT-1-2-BRANCH/cipher/random.c 2005-08-22 09:30:25 UTC (rev 1102) +++ branches/LIBGCRYPT-1-2-BRANCH/cipher/random.c 2005-09-13 10:18:54 UTC (rev 1103) @@ -1,6 +1,6 @@ /* random.c - random number generator * Copyright (C) 1998, 2000, 2001, 2002, 2003, - * 2004 Free Software Foundation, Inc. + * 2004, 2005 Free Software Foundation, Inc. * * This file is part of Libgcrypt. * @@ -693,29 +693,46 @@ /* Read random out of the pool. This function is the core of the - public random fucntions. Note that Level 0 is not anymore handeld - special and in fact an alias for level 1. */ + public random functions. Note that Level 0 is special and in fact + an alias for level 1. */ static void read_pool (byte *buffer, size_t length, int level) { int i; unsigned long *sp, *dp; - volatile pid_t my_pid; /* The volatile is there to make sure the - compiler does not optimize the code away - in case the getpid function is badly - attributed. */ + size_t n; + /* The volatile is there to make sure the compiler does not optimize + the code away in case the getpid function is badly attributed. + Note that we keep a pid in a static variable as well as in a + stack based one; the latter is to detect ill behaving thread + libraries, ignoring the pool mutexes. */ + static volatile pid_t my_pid = (pid_t)(-1); + volatile pid_t my_pid2; retry: /* Get our own pid, so that we can detect a fork. */ - my_pid = getpid (); + my_pid2 = getpid (); + if (my_pid == (pid_t)(-1)) + my_pid = my_pid2; + if ( my_pid != my_pid2 ) + { + /* We detected a plain fork; i.e. we are now the child. Update + the static pid and add some randomness. */ + pid_t x; + my_pid = my_pid2; + x = my_pid; + add_randomness (&x, sizeof(x), 0); + just_mixed = 0; /* Make sure it will get mixed. */ + } + assert (pool_is_locked); /* Our code does not allow to extract more than POOLSIZE. Better check it here. */ if (length > POOLSIZE) { - log_bug("too many random bits requested\n"); + log_bug("too many random bits requested (%lu)\n", (unsigned long)length); } if (!pool_filled) @@ -787,7 +804,7 @@ /* Read the required data. We use a readpointer to read from a different position each time */ - while (length--) + for (n=0; n < length; n++) { *buffer++ = keypool[pool_readpos++]; if (pool_readpos >= POOLSIZE) @@ -803,17 +820,14 @@ /* We need to detect whether a fork has happened. A fork might have an identical pool and thus the child and the parent could emit - the very same random number. Obviously this can only happen when - running multi-threaded and the pool lock should even catch this. - However things do get wrong and thus we better check and retry it - here. We assume that the thread library has no other fatal - faults, though. - */ - if ( getpid () != my_pid ) + the very same random number. This test here is to detect forks + in a multi-threaded process. */ + if ( getpid () != my_pid2 ) { pid_t x = getpid(); add_randomness (&x, sizeof(x), 0); just_mixed = 0; /* Make sure it will get mixed. */ + my_pid = x; /* Also update the static pid. */ goto retry; } } @@ -1103,6 +1117,10 @@ { static unsigned char nonce_buffer[20+8]; static int nonce_buffer_initialized = 0; + static volatile pid_t my_pid; /* The volatile is there to make sure the + compiler does not optimize the code away + in case the getpid function is badly + attributed. */ unsigned char *p; size_t n; int err; @@ -1123,6 +1141,8 @@ pid_t apid = getpid (); time_t atime = time (NULL); + my_pid = apid; + if ((sizeof apid + sizeof atime) > sizeof nonce_buffer) BUG (); @@ -1139,6 +1159,12 @@ nonce_buffer_initialized = 1; } + else if ( my_pid != getpid () ) + { + /* We forked. Need to reseed the buffer - doing this for the + private part should be sufficient. */ + gcry_randomize (nonce_buffer+20, 8, GCRY_WEAK_RANDOM); + } /* Create the nonce by hashing the entire buffer, returning the hash and updating the first 20 bytes of the buffer with this hash. */ Modified: branches/LIBGCRYPT-1-2-BRANCH/tests/ChangeLog =================================================================== --- branches/LIBGCRYPT-1-2-BRANCH/tests/ChangeLog 2005-08-22 09:30:25 UTC (rev 1102) +++ branches/LIBGCRYPT-1-2-BRANCH/tests/ChangeLog 2005-09-13 10:18:54 UTC (rev 1103) @@ -1,3 +1,7 @@ +2005-09-13 Werner Koch + + * random.c: New. + 2005-06-16 Werner Koch * basic.c (check_one_md): Made P unsigned. Modified: branches/LIBGCRYPT-1-2-BRANCH/tests/Makefile.am =================================================================== --- branches/LIBGCRYPT-1-2-BRANCH/tests/Makefile.am 2005-08-22 09:30:25 UTC (rev 1102) +++ branches/LIBGCRYPT-1-2-BRANCH/tests/Makefile.am 2005-09-13 10:18:54 UTC (rev 1103) @@ -18,7 +18,7 @@ ## Process this file with automake to produce Makefile.in -TESTS = prime register ac basic tsexp keygen pubkey benchmark +TESTS = prime register ac basic tsexp keygen pubkey benchmark random INCLUDES = -I$(top_srcdir)/src LDADD = ../src/libgcrypt.la Added: branches/LIBGCRYPT-1-2-BRANCH/tests/random.c =================================================================== --- branches/LIBGCRYPT-1-2-BRANCH/tests/random.c 2005-08-22 09:30:25 UTC (rev 1102) +++ branches/LIBGCRYPT-1-2-BRANCH/tests/random.c 2005-09-13 10:18:54 UTC (rev 1103) @@ -0,0 +1,252 @@ +/* random.c - part of the Libgcrypt test suite. + Copyright (C) 2005 Free Software Foundation, Inc. + + This program 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 + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../src/gcrypt.h" + +static int verbose; + +static void +die (const char *format, ...) +{ + va_list arg_ptr; + + va_start (arg_ptr, format); + vfprintf (stderr, format, arg_ptr); + va_end (arg_ptr); + exit (1); +} + + +static void +print_hex (const char *text, const void *buf, size_t n) +{ + const unsigned char *p = buf; + + fputs (text, stdout); + for (; n; n--, p++) + printf ("%02X", *p); + putchar ('\n'); +} + + +static int +writen (int fd, const void *buf, size_t nbytes) +{ + size_t nleft = nbytes; + int nwritten; + + while (nleft > 0) + { + nwritten = write (fd, buf, nleft); + if (nwritten < 0) + { + if (errno == EINTR) + nwritten = 0; + else + return -1; + } + nleft -= nwritten; + buf = (const char*)buf + nwritten; + } + + return 0; +} + +static int +readn (int fd, void *buf, size_t buflen, size_t *ret_nread) +{ + size_t nleft = buflen; + int nread; + char *p; + + p = buf; + while ( nleft > 0 ) + { + nread = read ( fd, buf, nleft ); + if (nread < 0) + { + if (nread == EINTR) + nread = 0; + else + return -1; + } + else if (!nread) + break; /* EOF */ + nleft -= nread; + buf = (char*)buf + nread; + } + if (ret_nread) + *ret_nread = buflen - nleft; + return 0; +} + + + +/* Check that forking won't return the same random. */ +static void +check_forking (void) +{ + pid_t pid; + int rp[2]; + int i, status; + size_t nread; + char tmp1[16], tmp1c[16], tmp1p[16]; + + /* We better make sure that the RNG has been initialzied. */ + gcry_randomize (tmp1, sizeof tmp1, GCRY_STRONG_RANDOM); + if (verbose) + print_hex ("initial random: ", tmp1, sizeof tmp1); + + if (pipe (rp) == -1) + die ("pipe failed: %s\n", strerror (errno)); + + pid = fork (); + if (pid == (pid_t)(-1)) + die ("fork failed: %s\n", strerror (errno)); + if (!pid) + { + gcry_randomize (tmp1c, sizeof tmp1c, GCRY_STRONG_RANDOM); + if (writen (rp[1], tmp1c, sizeof tmp1c)) + die ("write failed: %s\n", strerror (errno)); + if (verbose) + { + print_hex (" child random: ", tmp1c, sizeof tmp1c); + fflush (stdout); + } + _exit (0); + } + gcry_randomize (tmp1p, sizeof tmp1p, GCRY_STRONG_RANDOM); + if (verbose) + print_hex (" parent random: ", tmp1p, sizeof tmp1p); + + close (rp[1]); + if (readn (rp[0], tmp1c, sizeof tmp1c, &nread)) + die ("read failed: %s\n", strerror (errno)); + if (nread != sizeof tmp1c) + die ("read too short\n"); + + while ( (i=waitpid (pid, &status, 0)) == -1 && errno == EINTR) + ; + if (i != (pid_t)(-1) + && WIFEXITED (status) && !WEXITSTATUS (status)) + ; + else + die ("child failed\n"); + + if (!memcmp (tmp1p, tmp1c, sizeof tmp1c)) + die ("parent and child got the same random number\n"); +} + + + +/* Check that forking won't return the same nonce. */ +static void +check_nonce_forking (void) +{ + pid_t pid; + int rp[2]; + int i, status; + size_t nread; + char nonce1[10], nonce1c[10], nonce1p[10]; + + /* We won't get the same nonce back if we never initialized the + nonce subsystem, thus we get one nonce here and forget about + it. */ + gcry_create_nonce (nonce1, sizeof nonce1); + if (verbose) + print_hex ("initial nonce: ", nonce1, sizeof nonce1); + + if (pipe (rp) == -1) + die ("pipe failed: %s\n", strerror (errno)); + + pid = fork (); + if (pid == (pid_t)(-1)) + die ("fork failed: %s\n", strerror (errno)); + if (!pid) + { + gcry_create_nonce (nonce1c, sizeof nonce1c); + if (writen (rp[1], nonce1c, sizeof nonce1c)) + die ("write failed: %s\n", strerror (errno)); + if (verbose) + { + print_hex (" child nonce: ", nonce1c, sizeof nonce1c); + fflush (stdout); + } + _exit (0); + } + gcry_create_nonce (nonce1p, sizeof nonce1p); + if (verbose) + print_hex (" parent nonce: ", nonce1p, sizeof nonce1p); + + close (rp[1]); + if (readn (rp[0], nonce1c, sizeof nonce1c, &nread)) + die ("read failed: %s\n", strerror (errno)); + if (nread != sizeof nonce1c) + die ("read too short\n"); + + while ( (i=waitpid (pid, &status, 0)) == -1 && errno == EINTR) + ; + if (i != (pid_t)(-1) + && WIFEXITED (status) && !WEXITSTATUS (status)) + ; + else + die ("child failed\n"); + + if (!memcmp (nonce1p, nonce1c, sizeof nonce1c)) + die ("parent and child got the same nonce\n"); +} + + + + + + +int +main (int argc, char **argv) +{ + int debug = 0; + + if ((argc > 1) && (! strcmp (argv[1], "--verbose"))) + verbose = 1; + else if ((argc > 1) && (! strcmp (argv[1], "--debug"))) + verbose = debug = 1; + + signal (SIGPIPE, SIG_IGN); + + gcry_control (GCRYCTL_DISABLE_SECMEM, 0); + if (!gcry_check_version (GCRYPT_VERSION)) + die ("version mismatch\n"); + + gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); + if (debug) + gcry_control (GCRYCTL_SET_DEBUG_FLAGS, 1u, 0); + + check_forking (); + check_nonce_forking (); + + return 0; +} From cvs at cvs.gnupg.org Tue Sep 13 16:17:05 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue Sep 13 15:50:38 2005 Subject: [svn] gpgme - r1098 - trunk/gpgme Message-ID: Author: wk Date: 2005-09-13 16:17:04 +0200 (Tue, 13 Sep 2005) New Revision: 1098 Modified: trunk/gpgme/ChangeLog trunk/gpgme/ath.c trunk/gpgme/w32-io.c Log: * ath.c: Changes to make it work under W32. * w32-io.c (build_commandline): Quote argv[0]. Modified: trunk/gpgme/ChangeLog =================================================================== --- trunk/gpgme/ChangeLog 2005-09-12 19:15:14 UTC (rev 1097) +++ trunk/gpgme/ChangeLog 2005-09-13 14:17:04 UTC (rev 1098) @@ -1,3 +1,7 @@ +2005-09-13 Werner Koch + + * ath.c: Changes to make it work under W32. + 2005-09-12 Marcus Brinkmann * Makefile.am (libgpgme_la_SOURCES): Set to ath.h and ath.c. @@ -16,6 +20,10 @@ * keylist.c (release_op_data): Do not free opd->tmp_uid. +2005-09-07 Werner Koch + + * w32-io.c (build_commandline): Quote argv[0]. + 2005-08-26 Marcus Brinkmann * rungpg.c (command_handler): Use _gpgme_io_write instead of write. Modified: trunk/gpgme/ath.c =================================================================== --- trunk/gpgme/ath.c 2005-09-12 19:15:14 UTC (rev 1097) +++ trunk/gpgme/ath.c 2005-09-13 14:17:04 UTC (rev 1098) @@ -30,7 +30,9 @@ # include #endif #include +#ifndef HAVE_W32_SYSTEM #include +#endif #include "ath.h" @@ -104,40 +106,64 @@ ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset, struct timeval *timeout) { +#ifdef HAVE_W32_SYSTEM + return -1; /* Not supported. */ +#else return select (nfd, rset, wset, eset, timeout); +#endif } ssize_t ath_waitpid (pid_t pid, int *status, int options) { +#ifdef HAVE_W32_SYSTEM + return -1; /* Not supported. */ +#else return waitpid (pid, status, options); +#endif } int ath_accept (int s, struct sockaddr *addr, socklen_t *length_ptr) { +#ifdef HAVE_W32_SYSTEM + return -1; /* Not supported. */ +#else return accept (s, addr, length_ptr); +#endif } int ath_connect (int s, const struct sockaddr *addr, socklen_t length) { +#ifdef HAVE_W32_SYSTEM + return -1; /* Not supported. */ +#else return connect (s, addr, length); +#endif } int ath_sendmsg (int s, const struct msghdr *msg, int flags) { +#ifdef HAVE_W32_SYSTEM + return -1; /* Not supported. */ +#else return sendmsg (s, msg, flags); +#endif } int ath_recvmsg (int s, struct msghdr *msg, int flags) { +#ifdef HAVE_W32_SYSTEM + return -1; /* Not supported. */ +#else return recvmsg (s, msg, flags); +#endif } Modified: trunk/gpgme/w32-io.c =================================================================== --- trunk/gpgme/w32-io.c 2005-09-12 19:15:14 UTC (rev 1097) +++ trunk/gpgme/w32-io.c 2005-09-13 14:17:04 UTC (rev 1098) @@ -762,27 +762,36 @@ static char * build_commandline ( char **argv ) { - int i, n = 0; - char *buf, *p; - - /* FIXME: we have to quote some things because under Windows the - * program parses the commandline and does some unquoting */ - for (i=0; argv[i]; i++) - n += strlen (argv[i]) + 2 + 1; /* 2 extra bytes for possible quoting */ - buf = p = malloc (n); - if ( !buf ) - return NULL; - *buf = 0; - if ( argv[0] ) + int i, n = 0; + char *buf, *p; + + /* FIXME: we have to quote some things because under Windows the + * program parses the commandline and does some unquoting. For now + * we only do very basic quoting to the first argument because this + * one often contains a space (e.g. C:\\Program Files\GNU\GnuPG\gpg.exe) + * and we would produce an invalid line in that case. */ + for (i=0; argv[i]; i++) + n += strlen (argv[i]) + 2 + 1; /* 2 extra bytes for possible quoting */ + buf = p = malloc (n); + if ( !buf ) + return NULL; + *buf = 0; + if ( argv[0] ) + { + if (strpbrk (argv[0], " \t")) + p = stpcpy (stpcpy (stpcpy (p, "\""), argv[0]), "\""); + else p = stpcpy (p, argv[0]); - for (i = 1; argv[i]; i++) { - if (!*argv[i]) + for (i = 1; argv[i]; i++) + { + if (!*argv[i]) p = stpcpy (p, " \"\""); - else + else p = stpcpy (stpcpy (p, " "), argv[i]); + } } - - return buf; + + return buf; } From cvs at cvs.gnupg.org Tue Sep 13 19:21:30 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue Sep 13 18:54:57 2005 Subject: [svn] GPGol - r93 - trunk/src Message-ID: Author: wk Date: 2005-09-13 19:21:29 +0200 (Tue, 13 Sep 2005) New Revision: 93 Modified: trunk/src/ChangeLog trunk/src/engine-gpgme.c trunk/src/engine.h trunk/src/gpgmsg.cpp trunk/src/pgpmime.c trunk/src/pgpmime.h trunk/src/util.h Log: Add some new features - not fully working yet. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2005-09-09 05:29:48 UTC (rev 92) +++ trunk/src/ChangeLog 2005-09-13 17:21:29 UTC (rev 93) @@ -1,5 +1,23 @@ -2004-09-08 Timo Schulz +2005-09-13 Werner Koch + * pgpmime.c (pgpmime_decrypt): New arg ATTESTATION. + * engine-gpgme.c (add_verify_attestation): New. + (op_decrypt, op_verify_detached_sig, op_verify_detached_sig) + (op_verify_detached_sig): Add new arg ATTESTATION. Changed all + callers. + (at_sig_summary, at_sig_validity, add_verify_attestation): New. + The code has been taken and modified from Mutt's crypt-gpgme.c and + entirely been writen by g10 Code. + (at_fingerprint): Ditto. + + * gpgmsg.cpp (class GpgMsgImpl): New member ATTESTATION. Use it + in all calls to the functions above. + + * gpgmsg.cpp (decryptAttachment, decrypt): Save plaintext back + into the MAPI if desired. + +g2004-09-08 Timo Schulz + * passphrase-dialog.c (lod_recipbox): Use gpgme directly to resolve the keyids to userids. * usermap.c, usermap.h: Removed. Modified: trunk/src/engine-gpgme.c =================================================================== --- trunk/src/engine-gpgme.c 2005-09-09 05:29:48 UTC (rev 92) +++ trunk/src/engine-gpgme.c 2005-09-13 17:21:29 UTC (rev 93) @@ -48,6 +48,14 @@ static char *debug_file = NULL; static int init_done = 0; + +static void add_verify_attestation (gpgme_data_t at, + gpgme_ctx_t ctx, + gpgme_verify_result_t res, + const char *filename); + + + static void cleanup (void) { @@ -474,9 +482,11 @@ /* Run the decryption. Decrypts INBUF to OUTBUF, caller must xfree the result at OUTBUF. TTL is the time in seconds to cache a passphrase. If FILENAME is not NULL it will be displayed along - with status outputs. */ + with status outputs. If ATTESTATION is not NULL a text with the + result of the signature verification will get printed to it. */ int -op_decrypt (const char *inbuf, char **outbuf, int ttl, const char *filename) +op_decrypt (const char *inbuf, char **outbuf, int ttl, const char *filename, + gpgme_data_t attestation) { struct decrypt_key_s dk; gpgme_data_t in = NULL; @@ -524,6 +534,8 @@ res = gpgme_op_verify_result (ctx); if (res && res->signatures) verify_dialog_box (res, filename); + if (res && res->signatures && attestation) + add_verify_attestation (attestation, ctx, res, filename); } else if (gpgme_err_code (err) == GPG_ERR_DECRYPT_FAILED) { @@ -560,10 +572,12 @@ /* Decrypt the GPGME data object IN into the data object OUT. Returns 0 on success or an gpgme error code on failure. If FILENAME is not - NULL it will be displayed along with status outputs. */ + NULL it will be displayed along with status outputs. If ATTESTATION + is not NULL a text with the result of the signature verification + will get printed to it. */ static int decrypt_stream (gpgme_data_t in, gpgme_data_t out, int ttl, - const char *filename) + const char *filename, gpgme_data_t attestation) { struct decrypt_key_s dk; gpgme_ctx_t ctx = NULL; @@ -590,6 +604,8 @@ res = gpgme_op_verify_result (ctx); if (res && res->signatures) verify_dialog_box (res, filename); + if (res && res->signatures && attestation) + add_verify_attestation (attestation, ctx, res, filename); } else if (gpgme_err_code (err) == GPG_ERR_DECRYPT_FAILED) { @@ -625,7 +641,7 @@ outputs. */ int op_decrypt_stream (LPSTREAM instream, LPSTREAM outstream, int ttl, - const char *filename) + const char *filename, gpgme_data_t attestation) { struct gpgme_data_cbs cbs; gpgme_data_t in = NULL; @@ -640,7 +656,7 @@ if (!err) err = gpgme_data_new_from_cbs (&out, &cbs, outstream); if (!err) - err = decrypt_stream (in, out, ttl, filename); + err = decrypt_stream (in, out, ttl, filename, attestation); if (in) gpgme_data_release (in); @@ -656,7 +672,7 @@ outputs. */ int op_decrypt_stream_to_buffer (LPSTREAM instream, char **outbuf, int ttl, - const char *filename) + const char *filename, gpgme_data_t attestation) { struct gpgme_data_cbs cbs; gpgme_data_t in = NULL; @@ -672,7 +688,7 @@ if (!err) err = gpgme_data_new (&out); if (!err) - err = decrypt_stream (in, out, ttl, filename); + err = decrypt_stream (in, out, ttl, filename, attestation); if (!err) { /* Return the buffer but first make sure it is a string. */ @@ -697,7 +713,7 @@ outputs. */ int op_decrypt_stream_to_gpgme (LPSTREAM instream, gpgme_data_t out, int ttl, - const char *filename) + const char *filename, gpgme_data_t attestation) { struct gpgme_data_cbs cbs; gpgme_data_t in = NULL; @@ -708,7 +724,7 @@ err = gpgme_data_new_from_cbs (&in, &cbs, instream); if (!err) - err = decrypt_stream (in, out, ttl, filename); + err = decrypt_stream (in, out, ttl, filename, attestation); if (in) gpgme_data_release (in); @@ -722,9 +738,12 @@ OUTBUF. If OUTBUF is NULL only the verification result will be displayed (this is suitable for PGP/MIME messages). A dialog box will show the result of the verification. If FILENAME is not NULL - it will be displayed along with status outputs. */ + it will be displayed along with status outputs. If ATTESTATION is + not NULL a text with the result of the signature verification will + get printed to it. */ int -op_verify (const char *inbuf, char **outbuf, const char *filename) +op_verify (const char *inbuf, char **outbuf, const char *filename, + gpgme_data_t attestation) { gpgme_data_t in = NULL; gpgme_data_t out = NULL; @@ -765,6 +784,8 @@ } if (res) verify_dialog_box (res, filename); + if (res && attestation) + add_verify_attestation (attestation, ctx, res, filename); leave: if (out) @@ -779,10 +800,12 @@ /* Verify a detached message where the data is to be read from the DATA_STREAM and the signature itself is expected to be the string SIG_STRING. FILENAME will be shown by the verification status - dialog box. */ + dialog box. If ATTESTATION is not NULL a text with the result of + the signature verification will get printed to it. */ int op_verify_detached_sig (LPSTREAM data_stream, - const char *sig_string, const char *filename) + const char *sig_string, const char *filename, + gpgme_data_t attestation) { struct gpgme_data_cbs cbs; gpgme_data_t data = NULL; @@ -815,6 +838,8 @@ res = gpgme_op_verify_result (ctx); if (res) verify_dialog_box (res, filename); + if (res && attestation) + add_verify_attestation (attestation, ctx, res, filename); } leave: @@ -828,7 +853,335 @@ } + +static void +at_puts (gpgme_data_t a, const char *s) +{ + gpgme_data_write (a, s, strlen (s)); +} +static void +at_print_time (gpgme_data_t a, time_t t) +{ + char buf[200]; + + strftime (buf, sizeof (buf)-1, "%c", localtime (&t)); + at_puts (a, buf); +} + +static void +at_fingerprint (gpgme_data_t a, gpgme_key_t key) +{ + const char *s; + int i, is_pgp; + char *buf, *p; + const char *prefix = _("Fingerprint: "); + + if (!key) + return; + s = key->subkeys ? key->subkeys->fpr : NULL; + if (!s) + return; + is_pgp = (key->protocol == GPGME_PROTOCOL_OpenPGP); + + buf = xmalloc ( strlen (prefix) + strlen(s) * 4 + 2 ); + p = stpcpy (buf, prefix); + if (is_pgp && strlen (s) == 40) + { + /* v4 style formatted. */ + for (i=0; *s && s[1] && s[2] && s[3] && s[4]; s += 4, i++) + { + *p++ = s[0]; + *p++ = s[1]; + *p++ = s[2]; + *p++ = s[3]; + *p++ = ' '; + if (i == 4) + *p++ = ' '; + } + } + else + { + /* v3 style or X.509 formatted. */ + for (i=0; *s && s[1] && s[2]; s += 2, i++) + { + *p++ = s[0]; + *p++ = s[1]; + *p++ = is_pgp? ' ':':'; + if (is_pgp && i == 7) + *p++ = ' '; + } + } + + /* Just in case print remaining odd digits */ + for (; *s; s++) + *p++ = *s; + *p++ = '\n'; + *p = 0; + at_puts (a, buf); + xfree (buf); +} + + +/* Print common attributes of the signature summary SUM. Returns + trues if a severe warning has been encountered. */ +static int +at_sig_summary (gpgme_data_t a, + unsigned long sum, gpgme_signature_t sig, gpgme_key_t key) +{ + int severe = 0; + + if ((sum & GPGME_SIGSUM_VALID)) + at_puts (a, _("This signature is valid\n")); + if ((sum & GPGME_SIGSUM_GREEN)) + at_puts (a, _("signature state is \"green\"\n")); + if ((sum & GPGME_SIGSUM_RED)) + at_puts (a, _("signature state is \"red\"\n")); + + if ((sum & GPGME_SIGSUM_KEY_REVOKED)) + { + at_puts (a, _("Warning: One of the keys has been revoked\n")); + severe = 1; + } + + if ((sum & GPGME_SIGSUM_KEY_EXPIRED)) + { + time_t t = key->subkeys->expires ? key->subkeys->expires : 0; + + if (t) + { + at_puts (a, _("Warning: The key used to create the " + "signature expired at: ")); + at_print_time (a, t); + at_puts (a, "\n"); + } + else + at_puts (a, _("Warning: At least one certification key " + "has expired\n")); + } + + if ((sum & GPGME_SIGSUM_SIG_EXPIRED)) + { + at_puts (a, _("Warning: The signature expired at: ")); + at_print_time (a, sig ? sig->exp_timestamp : 0); + at_puts (a, "\n"); + } + + if ((sum & GPGME_SIGSUM_KEY_MISSING)) + at_puts (a, _("Can't verify due to a missing key or certificate\n")); + + if ((sum & GPGME_SIGSUM_CRL_MISSING)) + { + at_puts (a, _("The CRL is not available\n")); + severe = 1; + } + + if ((sum & GPGME_SIGSUM_CRL_TOO_OLD)) + { + at_puts (a, _("Available CRL is too old\n")); + severe = 1; + } + + if ((sum & GPGME_SIGSUM_BAD_POLICY)) + at_puts (a, _("A policy requirement was not met\n")); + + if ((sum & GPGME_SIGSUM_SYS_ERROR)) + { + const char *t0 = NULL, *t1 = NULL; + + at_puts (a, _("A system error occured")); + + /* Try to figure out some more detailed system error information. */ + if (sig) + { + t0 = ""; + t1 = sig->wrong_key_usage ? "Wrong_Key_Usage" : ""; + } + + if (t0 || t1) + { + at_puts (a, ": "); + if (t0) + at_puts (a, t0); + if (t1 && !(t0 && !strcmp (t0, t1))) + { + if (t0) + at_puts (a, ","); + at_puts (a, t1); + } + } + at_puts (a, "\n"); + } + + return severe; +} + + +/* Print the validity of a key used for one signature. */ +static void +at_sig_validity (gpgme_data_t a, gpgme_signature_t sig) +{ + const char *txt = NULL; + + switch (sig ? sig->validity : 0) + { + case GPGME_VALIDITY_UNKNOWN: + txt = _("WARNING: We have NO indication whether " + "the key belongs to the person named " + "as shown above\n"); + break; + case GPGME_VALIDITY_UNDEFINED: + break; + case GPGME_VALIDITY_NEVER: + txt = _("WARNING: The key does NOT BELONG to " + "the person named as shown above\n"); + break; + case GPGME_VALIDITY_MARGINAL: + txt = _("WARNING: It is NOT certain that the key " + "belongs to the person named as shown above\n"); + break; + case GPGME_VALIDITY_FULL: + case GPGME_VALIDITY_ULTIMATE: + txt = NULL; + break; + } + + if (txt) + at_puts (a, txt); +} + + +/* Print a text with the attestation of the signature verification + (which is in RES) to A. FILENAME may also be used in the + attestation. */ +static void +add_verify_attestation (gpgme_data_t a, gpgme_ctx_t ctx, + gpgme_verify_result_t res, const char *filename) +{ + time_t created; + const char *fpr, *uid; + gpgme_key_t key = NULL; + int i, anybad = 0, anywarn = 0; + unsigned int sum; + gpgme_user_id_t uids = NULL; + gpgme_signature_t sig; + gpgme_error_t err; + + if (!gpgme_data_seek (a, 0, SEEK_CUR)) + { + /* Nothing yet written to the stream. Insert the curretn time. */ + at_puts (a, _("Verification started at: ")); + at_print_time (a, time (NULL)); + at_puts (a, "\n\n"); + } + + at_puts (a, _("Verification result for: ")); + at_puts (a, filename ? filename : _("[unnamed part]")); + at_puts (a, "\n"); + if (res) + { + for (sig = res->signatures; sig; sig = sig->next) + { + created = sig->timestamp; + fpr = sig->fpr; + sum = sig->summary; + + if (gpg_err_code (sig->status) != GPG_ERR_NO_ERROR) + anybad = 1; + + err = gpgme_get_key (ctx, fpr, &key, 0); + uid = !err && key->uids && key->uids->uid ? key->uids->uid : "[?]"; + + if ((sum & GPGME_SIGSUM_GREEN)) + { + at_puts (a, _("Good signature from: ")); + at_puts (a, uid); + at_puts (a, "\n"); + for (i = 1, uids = key->uids; uids; i++, uids = uids->next) + { + if (uids->revoked) + continue; + at_puts (a, _(" aka: ")); + at_puts (a, uids->uid); + at_puts (a, "\n"); + } + at_puts (a, _(" created: ")); + at_print_time (a, created); + at_puts (a, "\n"); + if (at_sig_summary (a, sum, sig, key)) + anywarn = 1; + at_sig_validity (a, sig); + } + else if ((sum & GPGME_SIGSUM_RED)) + { + at_puts (a, _("*BAD* signature claimed to be from: ")); + at_puts (a, uid); + at_puts (a, "\n"); + at_sig_summary (a, sum, sig, key); + } + else if (!anybad && key && (key->protocol == GPGME_PROTOCOL_OpenPGP)) + { /* We can't decide (yellow) but this is a PGP key with a + good signature, so we display what a PGP user + expects: The name, fingerprint and the key validity + (which is neither fully or ultimate). */ + at_puts (a, _("Good signature from: ")); + at_puts (a, uid); + at_puts (a, "\n"); + at_puts (a, _(" created: ")); + at_print_time (a, created); + at_puts (a, "\n"); + at_sig_validity (a, sig); + at_fingerprint (a, key); + if (at_sig_summary (a, sum, sig, key)) + anywarn = 1; + } + else /* can't decide (yellow) */ + { + at_puts (a, _("Error checking signature")); + at_puts (a, "\n"); + at_sig_summary (a, sum, sig, key); + } + + gpgme_key_release (key); + } + + if (!anybad ) + { + gpgme_sig_notation_t notation; + + for (sig = res->signatures; sig; sig = sig->next) + { + if (!sig->notations) + continue; + at_puts (a, _("*** Begin Notation (signature by: ")); + at_puts (a, sig->fpr); + at_puts (a, ") ***\n"); + for (notation = sig->notations; notation; + notation = notation->next) + { + if (notation->name) + { + at_puts (a, notation->name); + at_puts (a, "="); + } + if (notation->value) + { + at_puts (a, notation->value); + if (!(*notation->value + && (notation->value[strlen (notation->value)-1] + =='\n'))) + at_puts (a, "\n"); + } + } + at_puts (a, _("*** End Notation ***\n")); + } + } + } + at_puts (a, "\n"); +} + + + /* Try to find a key for each item in array NAMES. If one ore more items were not found, they are stored as malloced strings to the Modified: trunk/src/engine.h =================================================================== --- trunk/src/engine.h 2005-09-09 05:29:48 UTC (rev 92) +++ trunk/src/engine.h 2005-09-13 17:21:29 UTC (rev 93) @@ -57,17 +57,20 @@ gpgme_key_t sign_key, int ttl); int op_decrypt (const char *inbuf, char **outbuf, int ttl, - const char *filename); + const char *filename, gpgme_data_t attestation); int op_decrypt_stream (LPSTREAM instream, LPSTREAM outstream, int ttl, - const char *filename); + const char *filename, gpgme_data_t attestation); int op_decrypt_stream_to_buffer (LPSTREAM instream, char **outbuf, int ttl, - const char *filename); + const char *filename, + gpgme_data_t attestation); int op_decrypt_stream_to_gpgme (LPSTREAM instream, gpgme_data_t out, int ttl, - const char *filename); + const char *filename, + gpgme_data_t attestation); -int op_verify (const char *inbuf, char **outbuf, const char *filename); +int op_verify (const char *inbuf, char **outbuf, const char *filename, + gpgme_data_t attestation); int op_verify_detached_sig (LPSTREAM data, const char *sig, - const char *filename); + const char *filename, gpgme_data_t attestation); int op_export_keys (const char *pattern[], const char *outfile); Modified: trunk/src/gpgmsg.cpp =================================================================== --- trunk/src/gpgmsg.cpp 2005-09-09 05:29:48 UTC (rev 92) +++ trunk/src/gpgmsg.cpp 2005-09-13 17:21:29 UTC (rev 93) @@ -101,6 +101,8 @@ is_pgpmime = false; silent = false; + attestation = NULL; + attach.att_table = NULL; attach.rows = NULL; } @@ -112,6 +114,9 @@ xfree (body); xfree (body_plain); + if (attestation) + gpgme_data_release (attestation); + if (attach.att_table) { attach.att_table->Release (); @@ -196,8 +201,12 @@ char *body_plain; /* Plaintext version of BODY or NULL. */ bool is_pgpmime; /* True if the message is a PGP/MIME encrypted one. */ bool silent; /* Don't pop up message boxes. Currently this - is only used with decryption. g*/ + is only used with decryption. */ + /* If not NULL, collect attestation information here. */ + gpgme_data_t attestation; + + /* This structure collects the information about attachments. */ struct { @@ -207,6 +216,7 @@ void loadBody (void); bool isPgpmimeVersionPart (int pos); + void writeAttestation (void); attach_info_t gatherAttachmentInfo (void); int encrypt_and_sign (HWND hwnd, bool sign); }; @@ -666,8 +676,110 @@ } +/* Write an Attestation to the current message. */ +void +GpgMsgImpl::writeAttestation (void) +{ + HRESULT hr; + ULONG newpos; + SPropValue prop; + LPATTACH newatt = NULL; + LPSTREAM to = NULL; + char *buffer = NULL; + ULONG nwritten; + if (!message || !attestation) + return; + hr = message->CreateAttach (NULL, 0, &newpos, &newatt); + if (hr != S_OK) + { + log_error ("%s:%s: can't create attachment: hr=%#lx\n", + __FILE__, __func__, hr); + goto leave; + } + + prop.ulPropTag = PR_ATTACH_METHOD; + prop.Value.ul = ATTACH_BY_VALUE; + hr = HrSetOneProp (newatt, &prop); + if (hr != S_OK) + { + log_error ("%s:%s: can't set attach method: hr=%#lx\n", + __FILE__, __func__, hr); + goto leave; + } + + prop.ulPropTag = PR_ATTACH_LONG_FILENAME_A; + prop.Value.lpszA = "GPGol-Attestation.txt"; + hr = HrSetOneProp (newatt, &prop); + if (hr != S_OK) + { + log_error ("%s:%s: can't set attach filename: hr=%#lx\n", + __FILE__, __func__, hr); + goto leave; + } + + hr = newatt->OpenProperty (PR_ATTACH_DATA_BIN, &IID_IStream, 0, + MAPI_CREATE|MAPI_MODIFY, (LPUNKNOWN*)&to); + if (FAILED (hr)) + { + log_error ("%s:%s: can't create output stream: hr=%#lx\n", + __FILE__, __func__, hr); + goto leave; + } + + + if (gpgme_data_write (attestation, "", 1) != 1 + || !(buffer = gpgme_data_release_and_get_mem (attestation, NULL))) + { + attestation = NULL; + log_error ("%s:%s: gpgme_data_write failed\n", __FILE__, __func__); + goto leave; + } + attestation = NULL; + + log_debug ("writing attestation `%s'\n", buffer); + + hr = to->Write (buffer, strlen (buffer), &nwritten); + if (hr != S_OK) + { + log_debug ("%s:%s: Write failed: hr=%#lx", __FILE__, __func__, hr); + goto leave; + } + + to->Commit (0); + to->Release (); + to = NULL; + + hr = newatt->SaveChanges (0); + if (hr != S_OK) + { + log_error ("%s:%s: SaveChanges(attachment) failed: hr=%#lx\n", + __FILE__, __func__, hr); + goto leave; + } + hr = message->SaveChanges (KEEP_OPEN_READWRITE|FORCE_SAVE); + if (hr != S_OK) + { + log_error ("%s:%s: SaveChanges(message) failed: hr=%#lx\n", + __FILE__, __func__, hr); + goto leave; + } + + + leave: + if (to) + { + to->Revert (); + to->Release (); + } + if (newatt) + newatt->Release (); + xfree (buffer); +} + + + /* Decrypt the message MSG and update the window. HWND identifies the current window. */ int @@ -711,8 +823,8 @@ means of update_display and the SetWindowText API). Thus it happens sometimes that the ciphertext is still displayed although the MAPI calls in loadBody returned the plaintext - (becuase we once used set_message_body). The effect is that - when cliching the decrypt button, we won't have any + (because we once used set_message_body). The effect is that + when clicking the decrypt button, we won't have any ciphertext to decrypt and thus get to here. We try solving this by updating the window if we also have a cached entry. @@ -744,6 +856,14 @@ return 0; } + /* We always want an attestation. Note that we ignore any error + because that would anyway be a out of core situation and thus we + can't do much about it. */ + if (!attestation) + gpgme_data_new (&attestation); + + + /* Process according to type of message. */ if (is_pgpmime) { LPATTACH att; @@ -789,7 +909,7 @@ return gpg_error (GPG_ERR_GENERAL); } - err = pgpmime_decrypt (from, opt.passwd_ttl, &plaintext); + err = pgpmime_decrypt (from, opt.passwd_ttl, &plaintext, attestation); from->Release (); att->Release (); @@ -797,9 +917,10 @@ pgpmime_succeeded = 1; } else if (mtype == OPENPGP_CLEARSIG) - err = op_verify (getOrigText (), NULL, NULL); + err = op_verify (getOrigText (), NULL, NULL, attestation); else if (*getOrigText()) - err = op_decrypt (getOrigText (), &plaintext, opt.passwd_ttl, NULL); + err = op_decrypt (getOrigText (), &plaintext, opt.passwd_ttl, + NULL, attestation); else err = gpg_error (GPG_ERR_NO_DATA); if (err) @@ -836,11 +957,19 @@ plaintext = NULL; msgcache_put (body_plain, 0, message); - /* XXX: find a way to handle text/html message in a better way! */ - /* I have disabled the kludge to see what happens to a html - message. */ - if (!silent && /*is_html ||*/ update_display (hwnd, this, exchange_cb)) + if (opt.save_decrypted_attach) { + /* User wants us to replace the encrypted message with the + plaintext version. */ + hr = message->SaveChanges (KEEP_OPEN_READWRITE|FORCE_SAVE); + if (FAILED (hr)) + log_debug ("%s:%s: SaveChanges failed: hr=%#lx", + __FILE__, __func__, hr); + update_display (hwnd, this, exchange_cb); + + } + else if (!silent && update_display (hwnd, this, exchange_cb)) + { const char s[] = "The message text cannot be displayed.\n" "You have to save the decrypted message to view it.\n" @@ -912,6 +1041,8 @@ } } + writeAttestation (); + release_attach_info (table); log_debug ("%s:%s: leave (rc=%d)\n", __FILE__, __func__, err); return err; @@ -1793,7 +1924,7 @@ goto leave; } err = op_verify_detached_sig (stream, sig_data, - table[pos_data].filename); + table[pos_data].filename, attestation); if (err) { log_debug ("%s:%s: verify detached signature failed: %s", @@ -1827,6 +1958,9 @@ HRESULT hr; LPATTACH att; int method, err; + LPATTACH newatt = NULL; + char *outname = NULL; + log_debug ("%s:%s: processing attachment %d", __FILE__, __func__, pos); @@ -1885,14 +2019,13 @@ else if (method == ATTACH_BY_VALUE) { char *s; - char *outname; char *suggested_name; LPSTREAM from, to; suggested_name = get_attach_filename (att); if (suggested_name) log_debug ("%s:%s: attachment %d, filename `%s'", - __FILE__, __func__, pos, suggested_name); + __FILE__, __func__, pos, suggested_name); /* Strip of know extensions or use a default name. */ if (!suggested_name) { @@ -1907,58 +2040,138 @@ { *s = 0; } - outname = get_save_filename (hwnd, suggested_name); - xfree (suggested_name); - + if (opt.save_decrypted_attach) + outname = suggested_name; + else + { + outname = get_save_filename (hwnd, suggested_name); + xfree (suggested_name); + } + hr = att->OpenProperty (PR_ATTACH_DATA_BIN, &IID_IStream, 0, 0, (LPUNKNOWN*) &from); if (FAILED (hr)) { log_error ("%s:%s: can't open data of attachment %d: hr=%#lx", __FILE__, __func__, pos, hr); - xfree (outname); goto leave; } - hr = OpenStreamOnFile (MAPIAllocateBuffer, MAPIFreeBuffer, - (STGM_CREATE | STGM_READWRITE), - outname, NULL, &to); - if (FAILED (hr)) + + if (opt.save_decrypted_attach) /* Decrypt and save in the MAPI. */ { - log_error ("%s:%s: can't create stream for `%s': hr=%#lx\n", - __FILE__, __func__, outname, hr); + ULONG newpos; + SPropValue prop; + + hr = message->CreateAttach (NULL, 0, &newpos, &newatt); + if (hr != S_OK) + { + log_error ("%s:%s: can't create attachment: hr=%#lx\n", + __FILE__, __func__, hr); + goto leave; + } + + prop.ulPropTag = PR_ATTACH_METHOD; + prop.Value.ul = ATTACH_BY_VALUE; + hr = HrSetOneProp (newatt, &prop); + if (hr != S_OK) + { + log_error ("%s:%s: can't set attach method: hr=%#lx\n", + __FILE__, __func__, hr); + goto leave; + } + + prop.ulPropTag = PR_ATTACH_LONG_FILENAME_A; + prop.Value.lpszA = outname; + hr = HrSetOneProp (newatt, &prop); + if (hr != S_OK) + { + log_error ("%s:%s: can't set attach filename: hr=%#lx\n", + __FILE__, __func__, hr); + goto leave; + } + log_debug ("%s:%s: setting filename of attachment %d/%ld to `%s'", + __FILE__, __func__, pos, newpos, outname); + + + hr = newatt->OpenProperty (PR_ATTACH_DATA_BIN, &IID_IStream, 0, + MAPI_CREATE|MAPI_MODIFY, (LPUNKNOWN*)&to); + if (FAILED (hr)) + { + log_error ("%s:%s: can't create output stream: hr=%#lx\n", + __FILE__, __func__, hr); + goto leave; + } + + err = op_decrypt_stream (from, to, ttl, filename, attestation); + if (err) + { + log_debug ("%s:%s: decrypt stream failed: %s", + __FILE__, __func__, op_strerror (err)); + to->Revert (); + to->Release (); + from->Release (); + MessageBox (hwnd, op_strerror (err), + "GPG Attachment Decryption", MB_ICONERROR|MB_OK); + goto leave; + } + + to->Commit (0); + to->Release (); from->Release (); - xfree (outname); - goto leave; + + hr = newatt->SaveChanges (0); + if (hr != S_OK) + { + log_error ("%s:%s: SaveChanges failed: hr=%#lx\n", + __FILE__, __func__, hr); + goto leave; + } + + /* Delete the orginal attachment. FIXME: Should we really do + that or better just mark it in the table and delete + later? */ + att->Release (); + att = NULL; + if (message->DeleteAttach (pos, 0, NULL, 0) == S_OK) + log_error ("%s:%s: failed to delete attacghment %d: %s", + __FILE__, __func__, pos, op_strerror (err)); + } + else /* Save attachment to a file. */ + { + hr = OpenStreamOnFile (MAPIAllocateBuffer, MAPIFreeBuffer, + (STGM_CREATE | STGM_READWRITE), + outname, NULL, &to); + if (FAILED (hr)) + { + log_error ("%s:%s: can't create stream for `%s': hr=%#lx\n", + __FILE__, __func__, outname, hr); + from->Release (); + goto leave; + } - err = op_decrypt_stream (from, to, ttl, filename); - if (err) - { - log_debug ("%s:%s: decrypt stream failed: %s", - __FILE__, __func__, op_strerror (err)); - to->Revert (); + err = op_decrypt_stream (from, to, ttl, filename, attestation); + if (err) + { + log_debug ("%s:%s: decrypt stream failed: %s", + __FILE__, __func__, op_strerror (err)); + to->Revert (); + to->Release (); + from->Release (); + MessageBox (hwnd, op_strerror (err), + "GPG Attachment Decryption", MB_ICONERROR|MB_OK); + /* FIXME: We might need to delete outname now. However a + sensible implementation of the stream object should have + done it through the Revert call. */ + goto leave; + } + + to->Commit (0); to->Release (); from->Release (); - MessageBox (hwnd, op_strerror (err), - "GPG Attachment Decryption", MB_ICONERROR|MB_OK); - /* FIXME: We might need to delete outname now. However a - sensible implementation of the stream object should have - done it trhough the Revert call. */ - xfree (outname); - goto leave; } - - to->Commit (0); - to->Release (); - from->Release (); - - /* Hmmm: Why are we deleting the attachment now????? - Disabled until clarified. FIXME */ - //if (message->DeleteAttach (pos, 0, NULL, 0) == S_OK) - // show error; - - xfree (outname); + } else { @@ -1967,8 +2180,11 @@ } leave: - /* Close this attachment. */ - att->Release (); + xfree (outname); + if (newatt) + newatt->Release (); + if (att) + att->Release (); } Modified: trunk/src/pgpmime.c =================================================================== --- trunk/src/pgpmime.c 2005-09-09 05:29:48 UTC (rev 92) +++ trunk/src/pgpmime.c 2005-09-13 17:21:29 UTC (rev 93) @@ -273,9 +273,12 @@ /* Decrypt the PGP/MIME INSTREAM (i.e the second part of the multipart/mixed) and allow saving of all attachments. On success a - newly allocated body will be stored at BODY. */ + newly allocated body will be stored at BODY. If ATTESTATION is not + NULL a text with the result of the signature verification will get + printed to it. */ int -pgpmime_decrypt (LPSTREAM instream, int ttl, char **body) +pgpmime_decrypt (LPSTREAM instream, int ttl, char **body, + gpgme_data_t attestation) { gpg_error_t err; struct gpgme_data_cbs cbs; @@ -302,7 +305,8 @@ if (err) goto leave; - err = op_decrypt_stream_to_gpgme (instream, plaintext, ttl, NULL); + err = op_decrypt_stream_to_gpgme (instream, plaintext, ttl, + NULL, NULL); if (!err && (ctx->parser_error || ctx->line_too_long)) err = gpg_error (GPG_ERR_GENERAL); Modified: trunk/src/pgpmime.h =================================================================== --- trunk/src/pgpmime.h 2005-09-09 05:29:48 UTC (rev 92) +++ trunk/src/pgpmime.h 2005-09-13 17:21:29 UTC (rev 93) @@ -28,7 +28,8 @@ #endif #endif -int pgpmime_decrypt (LPSTREAM instream, int ttl, char **body); +int pgpmime_decrypt (LPSTREAM instream, int ttl, char **body, + gpgme_data_t attestation); Modified: trunk/src/util.h =================================================================== --- trunk/src/util.h 2005-09-09 05:29:48 UTC (rev 92) +++ trunk/src/util.h 2005-09-13 17:21:29 UTC (rev 93) @@ -43,7 +43,11 @@ } while(0) +/* i18n stuff (dummies for now). */ +#define _(a) (a) + + /*-- common.c --*/ void* xmalloc (size_t n); void* xcalloc (size_t m, size_t n); From cvs at cvs.gnupg.org Wed Sep 14 20:56:37 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed Sep 14 20:29:57 2005 Subject: [svn] gcry - r1104 - in branches/LIBGCRYPT-1-2-BRANCH: . mpi Message-ID: Author: wk Date: 2005-09-14 20:56:36 +0200 (Wed, 14 Sep 2005) New Revision: 1104 Modified: branches/LIBGCRYPT-1-2-BRANCH/ChangeLog branches/LIBGCRYPT-1-2-BRANCH/configure.ac branches/LIBGCRYPT-1-2-BRANCH/mpi/ChangeLog branches/LIBGCRYPT-1-2-BRANCH/mpi/Makefile.am Log: New configure option --enable-noexecstack. Modified: branches/LIBGCRYPT-1-2-BRANCH/ChangeLog =================================================================== --- branches/LIBGCRYPT-1-2-BRANCH/ChangeLog 2005-09-13 10:18:54 UTC (rev 1103) +++ branches/LIBGCRYPT-1-2-BRANCH/ChangeLog 2005-09-14 18:56:36 UTC (rev 1104) @@ -1,3 +1,7 @@ +2005-09-14 Werner Koch + + * configure.ac: New option --enable-noexecstack. + 2005-06-10 Werner Koch * configure.ac: Moved basic tests to the top. Modified: branches/LIBGCRYPT-1-2-BRANCH/configure.ac =================================================================== --- branches/LIBGCRYPT-1-2-BRANCH/configure.ac 2005-09-13 10:18:54 UTC (rev 1103) +++ branches/LIBGCRYPT-1-2-BRANCH/configure.ac 2005-09-14 18:56:36 UTC (rev 1104) @@ -383,8 +383,17 @@ [use_capabilities="$withval"],[use_capabilities=no]) AC_MSG_RESULT($use_capabilities) +# We don't have a test to check whether as(1) knows about the +# non executable stack option. Thus we provide an option to enable it. +AC_MSG_CHECKING([whether non excutable stack support is requested]) +AC_ARG_ENABLE(noexecstack, + AC_HELP_STRING([--enable-noexecstack], + [enable non executable stack support (gcc only)]), + noexecstack_support=$enableval, noexecstack_support=no) +AC_MSG_RESULT($noexecstack_support) + AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME", [A human readable text with the name of the OS]) @@ -621,7 +630,15 @@ else CFLAGS="$CFLAGS -Wall" fi + + # Non exec stack hack. Fixme: Write a test to check whether as + # can cope with it and use the enable-noexecstack option only to + # disable it in case it is required on some platforms. + if test "$noexecstack_support" = yes; then + NOEXECSTACK_FLAGS="-Wa,--noexecstack" + fi fi +AC_SUBST(NOEXECSTACK_FLAGS) # # Make the version number in src/gcrypt.h the same as the one here. Modified: branches/LIBGCRYPT-1-2-BRANCH/mpi/ChangeLog =================================================================== --- branches/LIBGCRYPT-1-2-BRANCH/mpi/ChangeLog 2005-09-13 10:18:54 UTC (rev 1103) +++ branches/LIBGCRYPT-1-2-BRANCH/mpi/ChangeLog 2005-09-14 18:56:36 UTC (rev 1104) @@ -1,3 +1,7 @@ +2005-09-14 Werner Koch + + * Makefile.am (AM_CCASFLAGS): Add AM_CCASFLAGS. + 2005-06-16 Werner Koch * mpiutil.c (gcry_mpi_randomize): Made P unsigned. Modified: branches/LIBGCRYPT-1-2-BRANCH/mpi/Makefile.am =================================================================== --- branches/LIBGCRYPT-1-2-BRANCH/mpi/Makefile.am 2005-09-13 10:18:54 UTC (rev 1103) +++ branches/LIBGCRYPT-1-2-BRANCH/mpi/Makefile.am 2005-09-14 18:56:36 UTC (rev 1104) @@ -23,6 +23,7 @@ INCLUDES = -I$(top_srcdir)/src ASFLAGS = @MPI_SFLAGS@ +AM_CCASFLAGS = $(NOEXECSTACK_FLAGS) # We don't have .S sources listed, so automake does not autocreate these CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS) From cvs at cvs.gnupg.org Thu Sep 15 00:31:30 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Thu Sep 15 00:04:49 2005 Subject: [svn] GnuPG - r3892 - trunk/g10 Message-ID: Author: dshaw Date: 2005-09-15 00:31:21 +0200 (Thu, 15 Sep 2005) New Revision: 3892 Modified: trunk/g10/ChangeLog trunk/g10/export.c trunk/g10/g10.c trunk/g10/import.c trunk/g10/keyserver.c trunk/g10/main.h trunk/g10/misc.c Log: * main.h, misc.c (parse_options): Add the ability to have help strings in xxx-options commands. * keyserver.c (keyserver_opts), import.c (parse_import_options), export.c (parse_export_options), g10.c (parse_list_options, main): Add help strings to xxx-options. Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2005-09-12 08:47:55 UTC (rev 3891) +++ trunk/g10/ChangeLog 2005-09-14 22:31:21 UTC (rev 3892) @@ -1,3 +1,12 @@ +2005-09-14 David Shaw + + * main.h, misc.c (parse_options): Add the ability to have help + strings in xxx-options commands. + + * keyserver.c (keyserver_opts), import.c (parse_import_options), + export.c (parse_export_options), g10.c (parse_list_options, main): + Add help strings to xxx-options. + 2005-09-10 David Shaw * keyedit.c (show_names): Moved name display code out from Modified: trunk/g10/export.c =================================================================== --- trunk/g10/export.c 2005-09-12 08:47:55 UTC (rev 3891) +++ trunk/g10/export.c 2005-09-14 22:31:21 UTC (rev 3892) @@ -47,23 +47,30 @@ { struct parse_options export_opts[]= { - {"export-local-sigs",EXPORT_LOCAL_SIGS,NULL}, - {"export-attributes",EXPORT_ATTRIBUTES,NULL}, - {"export-sensitive-revkeys",EXPORT_SENSITIVE_REVKEYS,NULL}, - {"export-minimal",EXPORT_MINIMAL|EXPORT_CLEAN_SIGS|EXPORT_CLEAN_UIDS,NULL}, - {"export-clean",EXPORT_CLEAN_SIGS|EXPORT_CLEAN_UIDS,NULL}, - {"export-clean-sigs",EXPORT_CLEAN_SIGS,NULL}, - {"export-clean-uids",EXPORT_CLEAN_UIDS,NULL}, - - {"export-reset-subkey-passwd", EXPORT_RESET_SUBKEY_PASSWD, NULL}, - + {"export-local-sigs",EXPORT_LOCAL_SIGS,NULL, + N_("export signatures that are marked as local-only")}, + {"export-attributes",EXPORT_ATTRIBUTES,NULL, + N_("export attribute user IDs (generally photo IDs)")}, + {"export-sensitive-revkeys",EXPORT_SENSITIVE_REVKEYS,NULL, + N_("export revocation keys that are marked as \"sensitive\"")}, + {"export-clean-sigs",EXPORT_CLEAN_SIGS,NULL, + N_("remove unusable signatures during export")}, + {"export-clean-uids",EXPORT_CLEAN_UIDS,NULL, + N_("remove unusable user IDs during export")}, + {"export-clean",EXPORT_CLEAN_SIGS|EXPORT_CLEAN_UIDS,NULL, + N_("all export-clean-* options from above")}, + {"export-minimal", + EXPORT_MINIMAL|EXPORT_CLEAN_SIGS|EXPORT_CLEAN_UIDS,NULL, + N_("export the smallest key possible")}, + {"export-reset-subkey-passwd",EXPORT_RESET_SUBKEY_PASSWD,NULL, + N_("remove the passphrase from exported subkeys")}, /* Aliases for backward compatibility */ - {"include-local-sigs",EXPORT_LOCAL_SIGS,NULL}, - {"include-attributes",EXPORT_ATTRIBUTES,NULL}, - {"include-sensitive-revkeys",EXPORT_SENSITIVE_REVKEYS,NULL}, + {"include-local-sigs",EXPORT_LOCAL_SIGS,NULL,NULL}, + {"include-attributes",EXPORT_ATTRIBUTES,NULL,NULL}, + {"include-sensitive-revkeys",EXPORT_SENSITIVE_REVKEYS,NULL,NULL}, /* dummy */ - {"export-unusable-sigs",0,NULL}, - {NULL,0,NULL} + {"export-unusable-sigs",0,NULL,NULL}, + {NULL,0,NULL,NULL} /* add tags for include revoked and disabled? */ }; Modified: trunk/g10/g10.c =================================================================== --- trunk/g10/g10.c 2005-09-12 08:47:55 UTC (rev 3891) +++ trunk/g10/g10.c 2005-09-14 22:31:21 UTC (rev 3892) @@ -1504,20 +1504,33 @@ char *subpackets=""; /* something that isn't NULL */ struct parse_options lopts[]= { - {"show-photos",LIST_SHOW_PHOTOS,NULL}, - {"show-policy-urls",LIST_SHOW_POLICY_URLS,NULL}, - {"show-notations",LIST_SHOW_NOTATIONS,NULL}, - {"show-std-notations",LIST_SHOW_STD_NOTATIONS,NULL}, - {"show-standard-notations",LIST_SHOW_STD_NOTATIONS,NULL}, - {"show-user-notations",LIST_SHOW_USER_NOTATIONS,NULL}, - {"show-keyserver-urls",LIST_SHOW_KEYSERVER_URLS,NULL}, - {"show-uid-validity",LIST_SHOW_UID_VALIDITY,NULL}, - {"show-unusable-uids",LIST_SHOW_UNUSABLE_UIDS,NULL}, - {"show-unusable-subkeys",LIST_SHOW_UNUSABLE_SUBKEYS,NULL}, - {"show-keyring",LIST_SHOW_KEYRING,NULL}, - {"show-sig-expire",LIST_SHOW_SIG_EXPIRE,NULL}, - {"show-sig-subpackets",LIST_SHOW_SIG_SUBPACKETS,NULL}, - {NULL,0,NULL} + {"show-photos",LIST_SHOW_PHOTOS,NULL, + N_("display photo IDs during key listings")}, + {"show-policy-urls",LIST_SHOW_POLICY_URLS,NULL, + N_("show policy URLs during signature listings")}, + {"show-notations",LIST_SHOW_NOTATIONS,NULL, + N_("show all notations during signature listings")}, + {"show-std-notations",LIST_SHOW_STD_NOTATIONS,NULL, + N_("show IETF standard notations during signature listings")}, + {"show-standard-notations",LIST_SHOW_STD_NOTATIONS,NULL, + NULL}, + {"show-user-notations",LIST_SHOW_USER_NOTATIONS,NULL, + N_("show user-supplied notations during signature listings")}, + {"show-keyserver-urls",LIST_SHOW_KEYSERVER_URLS,NULL, + N_("show preferred keyserver URLs during signature listings")}, + {"show-uid-validity",LIST_SHOW_UID_VALIDITY,NULL, + N_("show user ID validity during key listings")}, + {"show-unusable-uids",LIST_SHOW_UNUSABLE_UIDS,NULL, + N_("show revoked and expired user IDs in key listings")}, + {"show-unusable-subkeys",LIST_SHOW_UNUSABLE_SUBKEYS,NULL, + N_("show revoked and expired subkeys in key listings")}, + {"show-keyring",LIST_SHOW_KEYRING,NULL, + N_("show the keyring name in key listings")}, + {"show-sig-expire",LIST_SHOW_SIG_EXPIRE,NULL, + N_("show expiration dates during signature listings")}, + {"show-sig-subpackets",LIST_SHOW_SIG_SUBPACKETS,NULL, + NULL}, + {NULL,0,NULL,NULL} }; /* C99 allows for non-constant initializers, but we'd like to @@ -2396,16 +2409,25 @@ { struct parse_options vopts[]= { - {"show-photos",VERIFY_SHOW_PHOTOS,NULL}, - {"show-policy-urls",VERIFY_SHOW_POLICY_URLS,NULL}, - {"show-notations",VERIFY_SHOW_NOTATIONS,NULL}, - {"show-std-notations",VERIFY_SHOW_STD_NOTATIONS,NULL}, - {"show-standard-notations",VERIFY_SHOW_STD_NOTATIONS,NULL}, - {"show-user-notations",VERIFY_SHOW_USER_NOTATIONS,NULL}, - {"show-keyserver-urls",VERIFY_SHOW_KEYSERVER_URLS,NULL}, - {"show-uid-validity",VERIFY_SHOW_UID_VALIDITY,NULL}, - {"show-unusable-uids",VERIFY_SHOW_UNUSABLE_UIDS,NULL}, - {NULL,0,NULL} + {"show-photos",VERIFY_SHOW_PHOTOS,NULL, + N_("display photo IDs during signature verification")}, + {"show-policy-urls",VERIFY_SHOW_POLICY_URLS,NULL, + N_("show policy URLs during signature verification")}, + {"show-notations",VERIFY_SHOW_NOTATIONS,NULL, + N_("show all notations during signature verification")}, + {"show-std-notations",VERIFY_SHOW_STD_NOTATIONS,NULL, + N_("show IETF standard notations during signature verification")}, + {"show-standard-notations",VERIFY_SHOW_STD_NOTATIONS,NULL, + NULL}, + {"show-user-notations",VERIFY_SHOW_USER_NOTATIONS,NULL, + N_("show user-supplied notations during signature verification")}, + {"show-keyserver-urls",VERIFY_SHOW_KEYSERVER_URLS,NULL, + N_("show preferred keyserver URLs during signature verification")}, + {"show-uid-validity",VERIFY_SHOW_UID_VALIDITY,NULL, + N_("show user ID validity during signature verification")}, + {"show-unusable-uids",VERIFY_SHOW_UNUSABLE_UIDS,NULL, + N_("show revoked and expired user IDs in signature verification")}, + {NULL,0,NULL,NULL} }; if(!parse_options(pargs.r.ret_str,&opt.verify_options,vopts,1)) Modified: trunk/g10/import.c =================================================================== --- trunk/g10/import.c 2005-09-12 08:47:55 UTC (rev 3891) +++ trunk/g10/import.c 2005-09-14 22:31:21 UTC (rev 3892) @@ -91,20 +91,28 @@ { struct parse_options import_opts[]= { - {"import-local-sigs",IMPORT_LOCAL_SIGS,NULL}, - {"repair-pks-subkey-bug",IMPORT_REPAIR_PKS_SUBKEY_BUG,NULL}, - {"fast-import",IMPORT_FAST,NULL}, - {"convert-sk-to-pk",IMPORT_SK2PK,NULL}, - {"merge-only",IMPORT_MERGE_ONLY,NULL}, - {"import-clean",IMPORT_CLEAN_SIGS|IMPORT_CLEAN_UIDS,NULL}, - {"import-clean-sigs",IMPORT_CLEAN_SIGS,NULL}, - {"import-clean-uids",IMPORT_CLEAN_UIDS,NULL}, + {"import-local-sigs",IMPORT_LOCAL_SIGS,NULL, + N_("import signatures that are marked as local-only")}, + {"repair-pks-subkey-bug",IMPORT_REPAIR_PKS_SUBKEY_BUG,NULL, + N_("repair damage from the pks keyserver during import")}, + {"fast-import",IMPORT_FAST,NULL, + N_("do not update the trustdb after import")}, + {"convert-sk-to-pk",IMPORT_SK2PK,NULL, + N_("create a public key when importing a secret key")}, + {"merge-only",IMPORT_MERGE_ONLY,NULL, + N_("only accept updates to existing keys")}, + {"import-clean-sigs",IMPORT_CLEAN_SIGS,NULL, + N_("remove unusable signatures after import")}, + {"import-clean-uids",IMPORT_CLEAN_UIDS,NULL, + N_("remove unusable user IDs after import")}, + {"import-clean",IMPORT_CLEAN_SIGS|IMPORT_CLEAN_UIDS,NULL, + N_("all import-clean-* options from above")}, /* Aliases for backward compatibility */ - {"allow-local-sigs",IMPORT_LOCAL_SIGS,NULL}, - {"repair-hkp-subkey-bug",IMPORT_REPAIR_PKS_SUBKEY_BUG,NULL}, + {"allow-local-sigs",IMPORT_LOCAL_SIGS,NULL,NULL}, + {"repair-hkp-subkey-bug",IMPORT_REPAIR_PKS_SUBKEY_BUG,NULL,NULL}, /* dummy */ - {"import-unusable-sigs",0,NULL}, - {NULL,0,NULL} + {"import-unusable-sigs",0,NULL,NULL}, + {NULL,0,NULL,NULL} }; return parse_options(str,options,import_opts,noisy); Modified: trunk/g10/keyserver.c =================================================================== --- trunk/g10/keyserver.c 2005-09-12 08:47:55 UTC (rev 3891) +++ trunk/g10/keyserver.c 2005-09-14 22:31:21 UTC (rev 3892) @@ -74,15 +74,26 @@ static struct parse_options keyserver_opts[]= { - {"include-revoked",KEYSERVER_INCLUDE_REVOKED,NULL}, - {"include-subkeys",KEYSERVER_INCLUDE_SUBKEYS,NULL}, - {"keep-temp-files",KEYSERVER_KEEP_TEMP_FILES,NULL}, - {"refresh-add-fake-v3-keyids",KEYSERVER_ADD_FAKE_V3,NULL}, - {"auto-key-retrieve",KEYSERVER_AUTO_KEY_RETRIEVE,NULL}, - {"auto-pka-retrieve",KEYSERVER_AUTO_PKA_RETRIEVE,NULL}, - {"try-dns-srv",KEYSERVER_TRY_DNS_SRV,NULL}, - {"honor-keyserver-url",KEYSERVER_HONOR_KEYSERVER_URL,NULL}, - {NULL,0,NULL} + {"include-revoked",KEYSERVER_INCLUDE_REVOKED,NULL, + N_("include revoked keys in search results")}, + {"include-subkeys",KEYSERVER_INCLUDE_SUBKEYS,NULL, + N_("include subkeys when searching by key ID")}, + /* not a real option - just for the help message */ + {"use-temp-files",0,NULL, + N_("use temporary files to pass data to keyserver helpers")}, + {"keep-temp-files",KEYSERVER_KEEP_TEMP_FILES,NULL, + N_("do not delete temporary files after using them")}, + {"refresh-add-fake-v3-keyids",KEYSERVER_ADD_FAKE_V3,NULL, + NULL}, + {"auto-key-retrieve",KEYSERVER_AUTO_KEY_RETRIEVE,NULL, + N_("automatically retrieve keys when verifying signatures")}, + {"auto-pka-retrieve",KEYSERVER_AUTO_PKA_RETRIEVE,NULL, + NULL}, + {"try-dns-srv",KEYSERVER_TRY_DNS_SRV,NULL, + NULL}, + {"honor-keyserver-url",KEYSERVER_HONOR_KEYSERVER_URL,NULL, + N_("honor the preferred keyserver URL set on the key")}, + {NULL,0,NULL,NULL} }; static int keyserver_work(int action,STRLIST list,KEYDB_SEARCH_DESC *desc, Modified: trunk/g10/main.h =================================================================== --- trunk/g10/main.h 2005-09-12 08:47:55 UTC (rev 3891) +++ trunk/g10/main.h 2005-09-14 22:31:21 UTC (rev 3892) @@ -118,6 +118,7 @@ char *name; unsigned int bit; char **value; + char *help; }; char *optsep(char **stringp); Modified: trunk/g10/misc.c =================================================================== --- trunk/g10/misc.c 2005-09-12 08:47:55 UTC (rev 3891) +++ trunk/g10/misc.c 2005-09-14 22:31:21 UTC (rev 3892) @@ -968,11 +968,20 @@ if (str && !strcmp (str, "help")) { - int i; + int i,maxlen=0; + /* Figure out the longest option name so we can line these up + neatly. */ for(i=0;opts[i].name;i++) - printf ("%s\n", opts[i].name); - g10_exit (0); + if(opts[i].help && maxlen Author: wk Date: 2005-09-15 11:36:29 +0200 (Thu, 15 Sep 2005) New Revision: 94 Modified: trunk/TODO trunk/src/ChangeLog trunk/src/gpgmsg.cpp trunk/src/myexchext.h trunk/src/olflange.cpp Log: Check that we only encrypt plain text bodies Modified: trunk/TODO =================================================================== --- trunk/TODO 2005-09-13 17:21:29 UTC (rev 93) +++ trunk/TODO 2005-09-15 09:36:29 UTC (rev 94) @@ -7,12 +7,11 @@ * find out why sometimes the new body cannot set to a MAPI object. In this case the body is empty but the W32 API said it was correctly set. This might be due to the length of the object. HrGetOneProp has - such limitations adn thus it owould be reasonable to assume that the - same holds true for HrSetOneProp. We might want to use Openproperty + such limitations adn thus it would be reasonable to assume that the + same holds true for HrSetOneProp. We might want to use OpenProperty for longer texts. -* There is no verification status for attachments. What about - generating a new text attachemnts with the status information? We - need to make sure that it can be identified as locally generated. - * IMPORTANT: msgcache.c grows without limit - fix it. + +* Hook into OnDelivery and rename attachments named like the + Attestation attachment we generate locally. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2005-09-13 17:21:29 UTC (rev 93) +++ trunk/src/ChangeLog 2005-09-15 09:36:29 UTC (rev 94) @@ -1,3 +1,17 @@ +2005-09-15 Werner Koch + + * olflange.cpp (OnWriteComplete): Take care of EEME_FAILED. + (OnWrite): Check that we are encrypting only plain text messages. + + * myexchext.h: Add flags used by OnReadComplete. + +2005-09-14 Werner Koch + + * gpgmsg.cpp (writeAttestation): Add a content type. + (gatherAttachmentInfo): Detect whether we already have an attestation. + (decrypt): Don't create duplicate attestations. + (writeAttestation): Translate LF to CRLF. + 2005-09-13 Werner Koch * pgpmime.c (pgpmime_decrypt): New arg ATTESTATION. Modified: trunk/src/gpgmsg.cpp =================================================================== --- trunk/src/gpgmsg.cpp 2005-09-13 17:21:29 UTC (rev 93) +++ trunk/src/gpgmsg.cpp 2005-09-15 09:36:29 UTC (rev 94) @@ -99,6 +99,7 @@ body = NULL; body_plain = NULL; is_pgpmime = false; + has_attestation = false; silent = false; attestation = NULL; @@ -200,6 +201,7 @@ char *body; /* utf-8 encoded body string or NULL. */ char *body_plain; /* Plaintext version of BODY or NULL. */ bool is_pgpmime; /* True if the message is a PGP/MIME encrypted one. */ + bool has_attestation;/* True if we found an attestation attachment. */ bool silent; /* Don't pop up message boxes. Currently this is only used with decryption. */ @@ -686,6 +688,7 @@ LPATTACH newatt = NULL; LPSTREAM to = NULL; char *buffer = NULL; + char *p, *pend; ULONG nwritten; if (!message || !attestation) @@ -709,6 +712,20 @@ goto leave; } + /* It seem that we need to insert a short filename. Without it the + _displayed_ list of attachments won't get updated although the + attachment has been created. */ + prop.ulPropTag = PR_ATTACH_FILENAME_A; + prop.Value.lpszA = "gpgtstt0.txt"; + hr = HrSetOneProp (newatt, &prop); + if (hr != S_OK) + { + log_error ("%s:%s: can't set attach filename: hr=%#lx\n", + __FILE__, __func__, hr); + goto leave; + } + + /* And not for the real name. */ prop.ulPropTag = PR_ATTACH_LONG_FILENAME_A; prop.Value.lpszA = "GPGol-Attestation.txt"; hr = HrSetOneProp (newatt, &prop); @@ -718,7 +735,28 @@ __FILE__, __func__, hr); goto leave; } - + + prop.ulPropTag = PR_ATTACH_TAG; + prop.Value.bin.cb = sizeof oid_mimetag; + prop.Value.bin.lpb = (LPBYTE)oid_mimetag; + hr = HrSetOneProp (newatt, &prop); + if (hr != S_OK) + { + log_error ("%s:%s: can't set attach tag: hr=%#lx\n", + __FILE__, __func__, hr); + goto leave; + } + + prop.ulPropTag = PR_ATTACH_MIME_TAG_A; + prop.Value.lpszA = "text/plain; charset=utf-8"; + hr = HrSetOneProp (newatt, &prop); + if (hr != S_OK) + { + log_error ("%s:%s: can't set attach mime tag: hr=%#lx\n", + __FILE__, __func__, hr); + goto leave; + } + hr = newatt->OpenProperty (PR_ATTACH_DATA_BIN, &IID_IStream, 0, MAPI_CREATE|MAPI_MODIFY, (LPUNKNOWN*)&to); if (FAILED (hr)) @@ -739,13 +777,29 @@ attestation = NULL; log_debug ("writing attestation `%s'\n", buffer); - - hr = to->Write (buffer, strlen (buffer), &nwritten); + hr = S_OK; + if (!*buffer) + { + p = _("[No attestation computed (e.g. messages was not signed)"); + hr = to->Write (p, strlen (p), &nwritten); + } + else + { + for (p=buffer; hr == S_OK && (pend = strchr (p, '\n')); p = pend+1) + { + hr = to->Write (p, pend - p, &nwritten); + if (hr == S_OK) + hr = to->Write ("\r\n", 2, &nwritten); + } + if (*p && hr == S_OK) + hr = to->Write (p, strlen (p), &nwritten); + } if (hr != S_OK) { log_debug ("%s:%s: Write failed: hr=%#lx", __FILE__, __func__, hr); goto leave; } + to->Commit (0); to->Release (); @@ -859,7 +913,14 @@ /* We always want an attestation. Note that we ignore any error because that would anyway be a out of core situation and thus we can't do much about it. */ - if (!attestation) + if (has_attestation) + { + if (attestation) + gpgme_data_release (attestation); + log_debug ("%s:%s: we already have an attestation\n", + __FILE__, __func__); + } + else if (!attestation) gpgme_data_new (&attestation); @@ -1726,6 +1787,7 @@ const char *s; is_pgpmime = false; + has_attestation = false; n_attach = getAttachments (); log_debug ("%s:%s: message has %u attachments\n", __FILE__, __func__, n_attach); @@ -1766,6 +1828,12 @@ && !stricmp (s, ".asc")) table[pos].armor_type = get_pgp_armor_type (att,table[pos].method); } + if (table[pos].filename + && !stricmp (table[pos].filename, "GPGol-Attestation.txt") + && table[pos].content_type + && !stricmp (table[pos].content_type, "text/plain")) + has_attestation = true; + att->Release (); } table[pos].end_of_table = 1; @@ -1835,7 +1903,7 @@ } /* Simple check whether this is PGP/MIME encrypted. At least with - OL2003 the conent-type of the body is also correctly set but we + OL2003 the content-type of the body is also correctly set but we don't make use of this as it is not clear whether this is true for othyer storage providers. */ if (!opt.compat.no_pgpmime Modified: trunk/src/myexchext.h =================================================================== --- trunk/src/myexchext.h 2005-09-13 17:21:29 UTC (rev 93) +++ trunk/src/myexchext.h 2005-09-15 09:36:29 UTC (rev 94) @@ -61,7 +61,11 @@ #define EEPS_STORE 0x00000003 #define EEPS_TOOLSOPTIONS 0x00000004 +/* Flags used by OnFooComplete. */ +#define EEME_FAILED 0x00000001 +#define EEME_COMPLETE_FAILED 0x00000002 + /* Command IDs. */ #define EECMDID_ToolsCustomizeToolbar 134 #define EECMDID_ToolsOptions 136 Modified: trunk/src/olflange.cpp =================================================================== --- trunk/src/olflange.cpp 2005-09-13 17:21:29 UTC (rev 93) +++ trunk/src/olflange.cpp 2005-09-15 09:36:29 UTC (rev 94) @@ -691,16 +691,86 @@ STDMETHODIMP CGPGExchExtMessageEvents::OnWrite (LPEXCHEXTCALLBACK pEECB) { - log_debug ("%s:%s: received\n", __FILE__, __func__); - return S_FALSE; + log_debug ("%s:%s: received\n", __FILE__, __func__); + + HRESULT hr; + LPDISPATCH pDisp; + DISPID dispid; + VARIANT aVariant; + DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0}; + HWND hWnd = NULL; + + + /* If we are going to encrypt, check that the BodyFormat is + something we support. This helps avoiding surprise by sending + out unencrypted messages. */ + if (m_pExchExt->m_gpgEncrypt) + { + pDisp = find_outlook_property (pEECB, "BodyFormat", &dispid); + if (!pDisp) + { + log_debug ("%s:%s: BodyFormat not found\n", __FILE__, __func__); + m_bWriteFailed = TRUE; + return E_FAIL; + } + + aVariant.bstrVal = NULL; + hr = pDisp->Invoke (dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT, + DISPATCH_PROPERTYGET, &dispparamsNoArgs, + &aVariant, NULL, NULL); + if (hr != S_OK) + { + log_debug ("%s:%s: retrieving BodyFormat failed: %#lx", + __FILE__, __func__, hr); + m_bWriteFailed = TRUE; + pDisp->Release(); + return E_FAIL; + } + + if (aVariant.vt != VT_INT && aVariant.vt != VT_I4) + { + log_debug ("%s:%s: BodyFormat is not an integer (%d)", + __FILE__, __func__, aVariant.vt); + m_bWriteFailed = TRUE; + pDisp->Release(); + return E_FAIL; + } + + if (aVariant.intVal != 1) + { + + log_debug ("%s:%s: BodyFormat is %d", + __FILE__, __func__, aVariant.intVal); + + if (FAILED(pEECB->GetWindow (&hWnd))) + hWnd = NULL; + MessageBox (hWnd, + "Sorry, we can only encrypt plain text messages and no\n" + "HTML or RTF messages. Please make sure that only the\n" + "text format has been selected.", + "GPGol", MB_ICONERROR|MB_OK); + + m_bWriteFailed = TRUE; + pDisp->Release(); + return E_FAIL; + } + pDisp->Release(); + + } + + + return S_FALSE; } /* Called by Exchange when the data has been written to the message. Encrypts and signs the message if the options are set. PEECB is a pointer to the IExchExtCallback interface. Returns: S_FALSE to - signal Exchange to continue calling extensions. E_FAIL to signals - Exchange an error; the message will not be sent */ + signal Exchange to continue calling extensions. We return E_FAIL + to signals Exchange an error; the message will not be sent. Note + that we don't return S_OK because this would mean that we rolled + back the write operation and that no further extensions should be + called. */ STDMETHODIMP CGPGExchExtMessageEvents::OnWriteComplete (LPEXCHEXTCALLBACK pEECB, ULONG lFlags) @@ -712,16 +782,20 @@ LPMDB pMDB = NULL; HWND hWnd = NULL; int rc; + + if (lFlags & (EEME_FAILED|EEME_COMPLETE_FAILED)) + return S_FALSE; /* We don't need to rollback anything in case + other extensions flagged a failire. */ - if (FAILED(pEECB->GetWindow (&hWnd))) - hWnd = NULL; - - if (!m_bOnSubmitActive) /* the user is just saving the message */ + if (!m_bOnSubmitActive) /* The user is just saving the message. */ return S_FALSE; - if (m_bWriteFailed) /* operation failed already */ + if (m_bWriteFailed) /* Operation failed already. */ return S_FALSE; + if (FAILED(pEECB->GetWindow (&hWnd))) + hWnd = NULL; + HRESULT hr = pEECB->GetObject (&pMDB, (LPMAPIPROP *)&msg); if (SUCCEEDED (hr)) { @@ -954,7 +1028,7 @@ ((unsigned char*)key)[keylen++] = xtoi_2 (p); /* FIXME: Do we need to free the string returned in - AVARIANT? Check at other palces too. */ + AVARIANT? Check at other places too. */ } pDisp->Release(); From cvs at cvs.gnupg.org Fri Sep 16 10:22:48 2005 From: cvs at cvs.gnupg.org (svn author twoaday) Date: Fri Sep 16 18:21:50 2005 Subject: [svn] GPGol - r96 - trunk/src Message-ID: Author: twoaday Date: 2005-09-16 10:22:43 +0200 (Fri, 16 Sep 2005) New Revision: 96 Modified: trunk/src/watcher.cpp Log: Use global hinstance. Modified: trunk/src/watcher.cpp =================================================================== --- trunk/src/watcher.cpp 2005-09-15 21:17:52 UTC (rev 95) +++ trunk/src/watcher.cpp 2005-09-16 08:22:43 UTC (rev 96) @@ -7,12 +7,12 @@ #include "mymapitags.h" #include "gpgmsg.hh" #include "util.h" +#include "intern.h" /* Exchange callback context to retrieve the last message. */ static LPEXCHEXTCALLBACK g_cb = NULL; -/* DLL instance and the hook handle. */ -static HINSTANCE g_hinst = NULL; +/* The current hook handle. */ static HHOOK g_cbt_hook = NULL; /* MAPI message and storage handle. */ @@ -47,7 +47,7 @@ w = find_message_window2 (child); if (w) { - log_debug ("%s: watcher found message window.\n", __func__); + log_debug ("%s: watcher found message window: %p\n", __func__, w); return w; } @@ -117,7 +117,7 @@ { if (g_cbt_hook != NULL) return 0; - g_cbt_hook = SetWindowsHookEx (WH_CBT, cbt_proc, g_hinst, 0); + g_cbt_hook = SetWindowsHookEx (WH_CBT, cbt_proc, glob_hinst, 0); if (!g_cbt_hook) { log_debug ("%s: SetWindowsHookEx failed ec=%d\n", From cvs at cvs.gnupg.org Fri Sep 16 14:49:54 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Fri Sep 16 18:22:13 2005 Subject: [svn] GnuPG - r3894 - branches/GNUPG-1-9-BRANCH/agent Message-ID: Author: wk Date: 2005-09-16 14:49:53 +0200 (Fri, 16 Sep 2005) New Revision: 3894 Modified: branches/GNUPG-1-9-BRANCH/agent/ChangeLog branches/GNUPG-1-9-BRANCH/agent/minip12.c Log: Fixed padding in pkcs#12 Modified: branches/GNUPG-1-9-BRANCH/agent/ChangeLog =================================================================== --- branches/GNUPG-1-9-BRANCH/agent/ChangeLog 2005-09-15 17:36:30 UTC (rev 3893) +++ branches/GNUPG-1-9-BRANCH/agent/ChangeLog 2005-09-16 12:49:53 UTC (rev 3894) @@ -1,3 +1,8 @@ +2005-09-16 Werner Koch + + * minip12.c (build_key_sequence, build_cert_sequence): Fixed + padding. + 2005-09-15 Moritz Schulte * t-protect.c (test_agent_protect): Implemented. Modified: branches/GNUPG-1-9-BRANCH/agent/minip12.c =================================================================== --- branches/GNUPG-1-9-BRANCH/agent/minip12.c 2005-09-15 17:36:30 UTC (rev 3893) +++ branches/GNUPG-1-9-BRANCH/agent/minip12.c 2005-09-16 12:49:53 UTC (rev 3894) @@ -745,6 +745,15 @@ startoffset = 0; buffer = p = plain; +/* { */ +/* # warning debug code is enabled */ +/* FILE *fp = fopen ("tmp-rc2-plain-key.der", "wb"); */ +/* if (!fp || fwrite (p, n, 1, fp) != 1) */ +/* exit (2); */ +/* fclose (fp); */ +/* } */ + + where = "decrypted-text"; if (parse_tag (&p, &n, &ti) || ti.class || ti.tag != TAG_SEQUENCE) goto bailout; @@ -1229,7 +1238,7 @@ assert (needed == plainlen); /* Append some pad characters; we already allocated extra space. */ n = 8 - plainlen % 8; - for (;(plainlen % 8); plainlen++) + for (i=0; i < n; i++, plainlen++) *p++ = n; *r_length = plainlen; @@ -1453,6 +1462,7 @@ size_t len[8], needed, n; unsigned char *p, *certseq; size_t certseqlen; + int i; /* Walk 8 steps down to collect the info: */ @@ -1535,7 +1545,7 @@ /* Append some pad characters; we already allocated extra space. */ n = 8 - certseqlen % 8; - for (;(certseqlen % 8); certseqlen++) + for (i=0; i < n; i++, certseqlen++) *p++ = n; *r_length = certseqlen; From cvs at cvs.gnupg.org Fri Sep 16 13:12:16 2005 From: cvs at cvs.gnupg.org (svn author twoaday) Date: Fri Sep 16 18:22:33 2005 Subject: [svn] GPGol - r98 - trunk/src Message-ID: Author: twoaday Date: 2005-09-16 13:12:16 +0200 (Fri, 16 Sep 2005) New Revision: 98 Modified: trunk/src/watcher.cpp Log: Forgot to add copyright, license header... Modified: trunk/src/watcher.cpp =================================================================== --- trunk/src/watcher.cpp 2005-09-16 11:05:40 UTC (rev 97) +++ trunk/src/watcher.cpp 2005-09-16 11:12:16 UTC (rev 98) @@ -1,3 +1,24 @@ +/* watcher.cpp + * Copyright (C) 2005 g10 Code GmbH + * + * This file is part of GPGol. + * + * GPGol 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 of the License, or (at your option) any later version. + * + * GPGol 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + #include #include #include From cvs at cvs.gnupg.org Thu Sep 15 23:17:53 2005 From: cvs at cvs.gnupg.org (svn author twoaday) Date: Fri Sep 16 18:22:35 2005 Subject: [svn] GPGol - r95 - trunk/src Message-ID: Author: twoaday Date: 2005-09-15 23:17:52 +0200 (Thu, 15 Sep 2005) New Revision: 95 Added: trunk/src/watcher.cpp Modified: trunk/src/ChangeLog trunk/src/Makefile.am trunk/src/display.cpp trunk/src/intern.h trunk/src/main.c trunk/src/olflange-dlgs.cpp trunk/src/olflange.cpp Log: See ChangeLog. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2005-09-15 09:36:29 UTC (rev 94) +++ trunk/src/ChangeLog 2005-09-15 21:17:52 UTC (rev 95) @@ -1,3 +1,13 @@ +2005-09-15 Timo Schulz + + * util.h: Provider watcher prototypes. + * watcher.cpp (watcher_init_hook): New. + (watcher_free_hook): New. + (watcher_set_callback_ctx): New. + (cbt_proc): New. + * display.cpp (find_message_window): Removed GpgMsg param. + Changed all callers. + 2005-09-15 Werner Koch * olflange.cpp (OnWriteComplete): Take care of EEME_FAILED. Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2005-09-15 09:36:29 UTC (rev 94) +++ trunk/src/Makefile.am 2005-09-15 21:17:52 UTC (rev 95) @@ -42,7 +42,8 @@ recipient-dialog.c \ verify-dialog.c \ mymapi.h mymapitags.h \ - vasprintf.c + vasprintf.c \ + watcher.cpp gpgol_LDADD = gpgol.def \ $(GPGME_LIBS) mapi32.dll -lshell32 -lgdi32 -lcomdlg32 Modified: trunk/src/display.cpp =================================================================== --- trunk/src/display.cpp 2005-09-15 09:36:29 UTC (rev 94) +++ trunk/src/display.cpp 2005-09-15 21:17:52 UTC (rev 95) @@ -84,7 +84,7 @@ the text of the window instead of the MAPI object itself. To do this we walk all windows to find a PGP signature. */ static HWND -find_message_window (HWND parent, GpgMsg *msg) +find_message_window (HWND parent) { HWND child; @@ -107,7 +107,7 @@ && (!strncmp (s+15, "MESSAGE-----", 12) || !strncmp (s+15, "SIGNED MESSAGE-----", 19))) return child; - w = find_message_window (child, msg); + w = find_message_window (child); if (w) return w; child = GetNextWindow (child, GW_HWNDNEXT); @@ -123,7 +123,7 @@ { HWND window; - window = find_message_window (hwnd, msg); + window = find_message_window (hwnd); if (window) { log_debug ("%s:%s: window handle %p\n", __FILE__, __func__, window); Modified: trunk/src/intern.h =================================================================== --- trunk/src/intern.h 2005-09-15 09:36:29 UTC (rev 94) +++ trunk/src/intern.h 2005-09-15 21:17:52 UTC (rev 95) @@ -121,9 +121,11 @@ HRESULT w32_shgetfolderpath (HWND a, int b, HANDLE c, DWORD d, LPSTR e); -/*-- olflange.cpp --*/ +/*-- watcher.cpp --*/ +int watcher_init_hook (void); +int watcher_free_hook (void); +void watcher_set_callback_ctx (void *cb); - /*-- recipient-dialog.c --*/ int recipient_dialog_box(gpgme_key_t **ret_rset, int *ret_opts); int recipient_dialog_box2 (gpgme_key_t *fnd, char **unknown, size_t n, Modified: trunk/src/main.c =================================================================== --- trunk/src/main.c 2005-09-15 09:36:29 UTC (rev 94) +++ trunk/src/main.c 2005-09-15 21:17:52 UTC (rev 95) @@ -79,8 +79,9 @@ int WINAPI DllMain (HINSTANCE hinst, DWORD reason, LPVOID reserved) { - if (reason == DLL_PROCESS_ATTACH ) + if (reason == DLL_PROCESS_ATTACH) { + log_debug ("%s: attached to process\n", __func__); set_global_hinstance (hinst); /* The next call initializes subsystems of gpgme and should be done as early as possible. The actual return value is (the @@ -97,7 +98,12 @@ return FALSE; init_options (); } - + else if (reason == DLL_PROCESS_DETACH) + { + watcher_free_hook (); + log_debug ("%s: detached from process\n", __func__); + } + return TRUE; } Modified: trunk/src/olflange-dlgs.cpp =================================================================== --- trunk/src/olflange-dlgs.cpp 2005-09-15 09:36:29 UTC (rev 94) +++ trunk/src/olflange-dlgs.cpp 2005-09-15 21:17:52 UTC (rev 95) @@ -112,7 +112,8 @@ if (HIWORD (wParam) == BN_CLICKED && LOWORD (wParam) == IDC_ENCRYPT_WITH_STANDARD_KEY) { enable ^= 1; - EnableWindow (GetDlgItem (hDlg, IDC_ENCRYPT_TO), enable==0? FALSE: TRUE); + EnableWindow (GetDlgItem (hDlg, IDC_ENCRYPT_TO), + enable==0? FALSE: TRUE); } if (LOWORD(wParam) == IDC_GPG_OPTIONS) config_dialog_box (hDlg); Modified: trunk/src/olflange.cpp =================================================================== --- trunk/src/olflange.cpp 2005-09-15 09:36:29 UTC (rev 94) +++ trunk/src/olflange.cpp 2005-09-15 21:17:52 UTC (rev 95) @@ -54,9 +54,8 @@ } while (0) -bool g_bInitDll = FALSE; +bool g_initdll = FALSE; - /* Registers this module as an Exchange extension. This basically updates some Registry entries. */ STDAPI @@ -467,12 +466,12 @@ || !m_pExchExtPropertySheets) out_of_core (); - if (!g_bInitDll) + if (!g_initdll) { - /*MAPIInitialize (NULL);*/ + watcher_init_hook (); read_options (); op_init (); - g_bInitDll = TRUE; + g_initdll = TRUE; log_debug ("%s:%s: first time initialization done\n", __FILE__, __func__); } @@ -486,12 +485,12 @@ if (m_lContext == EECONTEXT_SESSION) { - if (g_bInitDll) + if (g_initdll) { - /*MAPIUninitialize ();*/ + watcher_free_hook (); op_deinit (); write_options (); - g_bInitDll = FALSE; + g_initdll = FALSE; log_debug ("%s:%s: DLL closed down\n", __FILE__, __func__); } } @@ -1082,6 +1081,7 @@ HWND hwndToolbar = NULL; CHAR szBuffer[128]; + watcher_set_callback_ctx ((void *)pEECB); pEECB->GetMenuPos (EECMDID_ToolsCustomizeToolbar, &hMenuTools, NULL, NULL, 0); AppendMenu (hMenuTools, MF_SEPARATOR, 0, NULL); Added: trunk/src/watcher.cpp =================================================================== --- trunk/src/watcher.cpp 2005-09-15 09:36:29 UTC (rev 94) +++ trunk/src/watcher.cpp 2005-09-15 21:17:52 UTC (rev 95) @@ -0,0 +1,173 @@ +#include +#include +#include + +#include "mymapi.h" +#include "myexchext.h" +#include "mymapitags.h" +#include "gpgmsg.hh" +#include "util.h" + +/* Exchange callback context to retrieve the last message. */ +static LPEXCHEXTCALLBACK g_cb = NULL; + +/* DLL instance and the hook handle. */ +static HINSTANCE g_hinst = NULL; +static HHOOK g_cbt_hook = NULL; + +/* MAPI message and storage handle. */ +static LPMESSAGE g_msg = NULL; +static LPMDB g_mdb = NULL; +static HWND g_creat_wnd = 0; + +static HWND +find_message_window2 (HWND parent) +{ + HWND child; + + if (!parent) + return NULL; + + child = GetWindow (parent, GW_CHILD); + while (child) + { + char buf[1024+1]; + HWND w; + size_t len; + const char *s; + + memset (buf, 0, sizeof (buf)); + GetWindowText (child, buf, sizeof (buf)-1); + len = strlen (buf); + if (len > 22 + && (s = strstr (buf, "-----BEGIN PGP ")) + && (!strncmp (s+15, "MESSAGE-----", 12) + || !strncmp (s+15, "SIGNED MESSAGE-----", 19))) + return child; + w = find_message_window2 (child); + if (w) + { + log_debug ("%s: watcher found message window.\n", __func__); + return w; + } + + child = GetNextWindow (child, GW_HWNDNEXT); + } + + return NULL; +} + + +static void +decrypt_message (HWND hwnd, LPMESSAGE msg) +{ + GpgMsg *m = CreateGpgMsg (msg); + m->setExchangeCallback ((void *)g_cb); + m->decrypt (hwnd); + delete m; + UlRelease (msg); + msg = NULL; +} + + +/* XXX: describe what we are doing here! */ + +static LRESULT CALLBACK +cbt_proc (int code, WPARAM w, LPARAM l) +{ + char wclass[128]; + HWND msgwnd, hwnd; + + if (code < 0) + return CallNextHookEx (g_cbt_hook, code, w, l); + + hwnd = (HWND)w; + if (code == HCBT_CREATEWND) + { + GetClassName (hwnd, wclass, 127); + if (strstr (wclass, "rctrl_renwnd32")) + { + g_creat_wnd = hwnd; + log_debug ("%s: watch for window %p\n", __func__, hwnd); + } + + } + + if (code == HCBT_ACTIVATE && g_creat_wnd == hwnd) + { + log_debug ("%s: %p == %p?\n", __func__, g_creat_wnd, hwnd); + g_creat_wnd = NULL; + msgwnd = find_message_window2 (hwnd); + if (msgwnd && g_msg) + { + log_debug ("%s: decrypt_message(%p, %p)\n", __func__, hwnd, g_msg); + decrypt_message (hwnd, g_msg); + UlRelease (g_mdb); + g_mdb = NULL; + } + } + + return CallNextHookEx (g_cbt_hook, code, w, l); +} + + +/* Initialize the CBT hook. */ +extern "C" int +watcher_init_hook (void) +{ + if (g_cbt_hook != NULL) + return 0; + g_cbt_hook = SetWindowsHookEx (WH_CBT, cbt_proc, g_hinst, 0); + if (!g_cbt_hook) + { + log_debug ("%s: SetWindowsHookEx failed ec=%d\n", + __func__, (int)GetLastError ()); + return -1; + } + return 0; +} + + +/* Remove the CBT hook. */ +extern "C" int +watcher_free_hook (void) +{ + if (g_msg != NULL) + { + UlRelease (g_msg); + g_msg = NULL; + } + if (g_mdb != NULL) + { + UlRelease (g_mdb); + g_mdb = NULL; + } + if (g_cbt_hook != NULL) + { + UnhookWindowsHookEx (g_cbt_hook); + g_cbt_hook = NULL; + } + return 0; +} + + +/* Set the Exchange callback context. */ +extern "C" void +watcher_set_callback_ctx (void *cb) +{ + HRESULT hr; + + g_cb = (LPEXCHEXTCALLBACK)cb; + + if (g_msg != NULL) + UlRelease (g_msg); + if (g_mdb != NULL) + UlRelease (g_mdb); + hr = g_cb->GetObject (&g_mdb, (LPMAPIPROP *)&g_msg); + if (FAILED (hr)) + { + log_debug ("%s: GetObject() failed ec=%lx\n", __func__, hr); + g_mdb = NULL; + g_msg = NULL; + } +} From cvs at cvs.gnupg.org Thu Sep 15 19:36:30 2005 From: cvs at cvs.gnupg.org (svn author mo) Date: Fri Sep 16 18:22:36 2005 Subject: [svn] GnuPG - r3893 - branches/GNUPG-1-9-BRANCH/agent Message-ID: Author: mo Date: 2005-09-15 19:36:30 +0200 (Thu, 15 Sep 2005) New Revision: 3893 Modified: branches/GNUPG-1-9-BRANCH/agent/ChangeLog branches/GNUPG-1-9-BRANCH/agent/t-protect.c Log: 2005-09-15 Moritz Schulte * t-protect.c (test_agent_protect): Implemented. (main): Disable use of secure memory. Modified: branches/GNUPG-1-9-BRANCH/agent/ChangeLog =================================================================== --- branches/GNUPG-1-9-BRANCH/agent/ChangeLog 2005-09-14 22:31:21 UTC (rev 3892) +++ branches/GNUPG-1-9-BRANCH/agent/ChangeLog 2005-09-15 17:36:30 UTC (rev 3893) @@ -1,3 +1,8 @@ +2005-09-15 Moritz Schulte + + * t-protect.c (test_agent_protect): Implemented. + (main): Disable use of secure memory. + 2005-09-09 Werner Koch * minip12.c (p12_build): Oops, array needs to be larger for the Modified: branches/GNUPG-1-9-BRANCH/agent/t-protect.c =================================================================== --- branches/GNUPG-1-9-BRANCH/agent/t-protect.c 2005-09-14 22:31:21 UTC (rev 3892) +++ branches/GNUPG-1-9-BRANCH/agent/t-protect.c 2005-09-15 17:36:30 UTC (rev 3893) @@ -39,8 +39,169 @@ { /* Protect the key encoded in canonical format in PLAINKEY. We assume a valid S-Exp here. */ -/* int agent_protect (const unsigned char *plainkey, const char *passphrase, */ -/* unsigned char **result, size_t *resultlen); */ + + unsigned int i; + int ret; + struct key_spec + { + const char *string; + }; + /* Valid RSA key. */ + struct key_spec key_rsa_valid = + { + "\x28\x31\x31\x3A\x70\x72\x69\x76\x61\x74\x65\x2D\x6B\x65\x79\x28\x33\x3A\x72\x73" + "\x61\x28\x31\x3A\x6E\x31\x32\x39\x3A\x00\xB6\xB5\x09\x59\x6A\x9E\xCA\xBC\x93\x92" + "\x12\xF8\x91\xE6\x56\xA6\x26\xBA\x07\xDA\x85\x21\xA9\xCA\xD4\xC0\x8E\x64\x0C\x04" + "\x05\x2F\xBB\x87\xF4\x24\xEF\x1A\x02\x75\xA4\x8A\x92\x99\xAC\x9D\xB6\x9A\xBE\x3D" + "\x01\x24\xE6\xC7\x56\xB1\xF7\xDF\xB9\xB8\x42\xD6\x25\x1A\xEA\x6E\xE8\x53\x90\x49" + "\x5C\xAD\xA7\x3D\x67\x15\x37\xFC\xE5\x85\x0A\x93\x2F\x32\xBA\xB6\x0A\xB1\xAC\x1F" + "\x85\x2C\x1F\x83\xC6\x25\xE7\xA7\xD7\x0C\xDA\x9E\xF1\x6D\x5C\x8E\x47\x73\x9D\x77" + "\xDF\x59\x26\x1A\xBE\x84\x54\x80\x7F\xF4\x41\xE1\x43\xFB\xD3\x7F\x85\x45\x29\x28" + "\x31\x3A\x65\x33\x3A\x01\x00\x01\x29\x28\x31\x3A\x64\x31\x32\x38\x3A\x07\x7A\xD3" + "\xDE\x28\x42\x45\xF4\x80\x6A\x1B\x82\xB7\x9E\x61\x6F\xBD\xE8\x21\xC8\x2D\x69\x1A" + "\x65\x66\x5E\x57\xB5\xFA\xD3\xF3\x4E\x67\xF4\x01\xE7\xBD\x2E\x28\x69\x9E\x89\xD9" + "\xC4\x96\xCF\x82\x19\x45\xAE\x83\xAC\x7A\x12\x31\x17\x6A\x19\x6B\xA6\x02\x7E\x77" + "\xD8\x57\x89\x05\x5D\x50\x40\x4A\x7A\x2A\x95\xB1\x51\x2F\x91\xF1\x90\xBB\xAE\xF7" + "\x30\xED\x55\x0D\x22\x7D\x51\x2F\x89\xC0\xCD\xB3\x1A\xC0\x6F\xA9\xA1\x95\x03\xDD" + "\xF6\xB6\x6D\x0B\x42\xB9\x69\x1B\xFD\x61\x40\xEC\x17\x20\xFF\xC4\x8A\xE0\x0C\x34" + "\x79\x6D\xC8\x99\xE5\x29\x28\x31\x3A\x70\x36\x35\x3A\x00\xD5\x86\xC7\x8E\x5F\x1B" + "\x4B\xF2\xE7\xCD\x7A\x04\xCA\x09\x19\x11\x70\x6F\x19\x78\x8B\x93\xE4\x4E\xE2\x0A" + "\xAF\x46\x2E\x83\x63\xE9\x8A\x72\x25\x3E\xD8\x45\xCC\xBF\x24\x81\xBB\x35\x1E\x85" + "\x57\xC8\x5B\xCF\xFF\x0D\xAB\xDB\xFF\x8E\x26\xA7\x9A\x09\x38\x09\x6F\x27\x29\x28" + "\x31\x3A\x71\x36\x35\x3A\x00\xDB\x0C\xDF\x60\xF2\x6F\x2A\x29\x6C\x88\xD6\xBF\x9F" + "\x8E\x5B\xE4\x5C\x0D\xDD\x71\x3C\x96\xCC\x73\xEB\xCB\x48\xB0\x61\x74\x09\x43\xF2" + "\x1D\x2A\x93\xD6\xE4\x2A\x72\x11\xE7\xF0\x2A\x95\xDC\xED\x6C\x39\x0A\x67\xAD\x21" + "\xEC\xF7\x39\xAE\x8A\x0C\xA4\x6F\xF2\xEB\xB3\x29\x28\x31\x3A\x75\x36\x34\x3A\x33" + "\x14\x91\x95\xF1\x69\x12\xDB\x20\xA4\x8D\x02\x0D\xBC\x3B\x9E\x38\x81\xB3\x9D\x72" + "\x2B\xF7\x93\x78\xF6\x34\x0F\x43\x14\x8A\x6E\x9F\xC5\xF5\x3E\x28\x53\xB7\x38\x7B" + "\xA4\x44\x3B\xA5\x3A\x52\xFC\xA8\x17\x3D\xE6\xE8\x5B\x42\xF9\x78\x3D\x4A\x78\x17" + "\xD0\x68\x0B\x29\x29\x29\x00" + }; + /* This RSA key is missing the last closing brace. */ + struct key_spec key_rsa_bogus_0 = + { + "\x28\x31\x31\x3A\x70\x72\x69\x76\x61\x74\x65\x2D\x6B\x65\x79\x28\x33\x3A\x72\x73" + "\x61\x28\x31\x3A\x6E\x31\x32\x39\x3A\x00\xB6\xB5\x09\x59\x6A\x9E\xCA\xBC\x93\x92" + "\x12\xF8\x91\xE6\x56\xA6\x26\xBA\x07\xDA\x85\x21\xA9\xCA\xD4\xC0\x8E\x64\x0C\x04" + "\x05\x2F\xBB\x87\xF4\x24\xEF\x1A\x02\x75\xA4\x8A\x92\x99\xAC\x9D\xB6\x9A\xBE\x3D" + "\x01\x24\xE6\xC7\x56\xB1\xF7\xDF\xB9\xB8\x42\xD6\x25\x1A\xEA\x6E\xE8\x53\x90\x49" + "\x5C\xAD\xA7\x3D\x67\x15\x37\xFC\xE5\x85\x0A\x93\x2F\x32\xBA\xB6\x0A\xB1\xAC\x1F" + "\x85\x2C\x1F\x83\xC6\x25\xE7\xA7\xD7\x0C\xDA\x9E\xF1\x6D\x5C\x8E\x47\x73\x9D\x77" + "\xDF\x59\x26\x1A\xBE\x84\x54\x80\x7F\xF4\x41\xE1\x43\xFB\xD3\x7F\x85\x45\x29\x28" + "\x31\x3A\x65\x33\x3A\x01\x00\x01\x29\x28\x31\x3A\x64\x31\x32\x38\x3A\x07\x7A\xD3" + "\xDE\x28\x42\x45\xF4\x80\x6A\x1B\x82\xB7\x9E\x61\x6F\xBD\xE8\x21\xC8\x2D\x69\x1A" + "\x65\x66\x5E\x57\xB5\xFA\xD3\xF3\x4E\x67\xF4\x01\xE7\xBD\x2E\x28\x69\x9E\x89\xD9" + "\xC4\x96\xCF\x82\x19\x45\xAE\x83\xAC\x7A\x12\x31\x17\x6A\x19\x6B\xA6\x02\x7E\x77" + "\xD8\x57\x89\x05\x5D\x50\x40\x4A\x7A\x2A\x95\xB1\x51\x2F\x91\xF1\x90\xBB\xAE\xF7" + "\x30\xED\x55\x0D\x22\x7D\x51\x2F\x89\xC0\xCD\xB3\x1A\xC0\x6F\xA9\xA1\x95\x03\xDD" + "\xF6\xB6\x6D\x0B\x42\xB9\x69\x1B\xFD\x61\x40\xEC\x17\x20\xFF\xC4\x8A\xE0\x0C\x34" + "\x79\x6D\xC8\x99\xE5\x29\x28\x31\x3A\x70\x36\x35\x3A\x00\xD5\x86\xC7\x8E\x5F\x1B" + "\x4B\xF2\xE7\xCD\x7A\x04\xCA\x09\x19\x11\x70\x6F\x19\x78\x8B\x93\xE4\x4E\xE2\x0A" + "\xAF\x46\x2E\x83\x63\xE9\x8A\x72\x25\x3E\xD8\x45\xCC\xBF\x24\x81\xBB\x35\x1E\x85" + "\x57\xC8\x5B\xCF\xFF\x0D\xAB\xDB\xFF\x8E\x26\xA7\x9A\x09\x38\x09\x6F\x27\x29\x28" + "\x31\x3A\x71\x36\x35\x3A\x00\xDB\x0C\xDF\x60\xF2\x6F\x2A\x29\x6C\x88\xD6\xBF\x9F" + "\x8E\x5B\xE4\x5C\x0D\xDD\x71\x3C\x96\xCC\x73\xEB\xCB\x48\xB0\x61\x74\x09\x43\xF2" + "\x1D\x2A\x93\xD6\xE4\x2A\x72\x11\xE7\xF0\x2A\x95\xDC\xED\x6C\x39\x0A\x67\xAD\x21" + "\xEC\xF7\x39\xAE\x8A\x0C\xA4\x6F\xF2\xEB\xB3\x29\x28\x31\x3A\x75\x36\x34\x3A\x33" + "\x14\x91\x95\xF1\x69\x12\xDB\x20\xA4\x8D\x02\x0D\xBC\x3B\x9E\x38\x81\xB3\x9D\x72" + "\x2B\xF7\x93\x78\xF6\x34\x0F\x43\x14\x8A\x6E\x9F\xC5\xF5\x3E\x28\x53\xB7\x38\x7B" + "\xA4\x44\x3B\xA5\x3A\x52\xFC\xA8\x17\x3D\xE6\xE8\x5B\x42\xF9\x78\x3D\x4A\x78\x17" + "\xD0\x68\x0B\x29\x29\x00" + }; + /* This RSA key is the `e' value. */ + struct key_spec key_rsa_bogus_1 = + { + "\x28\x31\x31\x3A\x70\x72\x69\x76\x61\x74\x65\x2D\x6B\x65\x79\x28\x33\x3A\x72\x73" + "\x61\x28\x31\x3A\x6E\x31\x32\x39\x3A\x00\xA8\x80\xB6\x71\xF4\x95\x9F\x49\x84\xED" + "\xC1\x1D\x5F\xFF\xED\x14\x7B\x9C\x6A\x62\x0B\x7B\xE2\x3E\x41\x48\x49\x85\xF5\x64" + "\x50\x04\x9D\x30\xFC\x84\x1F\x01\xC3\xC3\x15\x03\x48\x6D\xFE\x59\x0B\xB0\xD0\x3E" + "\x68\x8A\x05\x7A\x62\xB0\xB9\x6E\xC5\xD2\xA8\xEE\x0C\x6B\xDE\x5E\x3D\x8E\xE8\x8F" + "\xB3\xAE\x86\x99\x7E\xDE\x2B\xC2\x4D\x60\x51\xDB\xB1\x2C\xD0\x38\xEC\x88\x62\x3E" + "\xA9\xDD\x11\x53\x04\x17\xE4\xF2\x07\x50\xDC\x44\xED\x14\xF5\x0B\xAB\x9C\xBC\x24" + "\xC6\xCB\xAD\x0F\x05\x25\x94\xE2\x73\xEB\x14\xD5\xEE\x5E\x18\xF0\x40\x31\x29\x28" + "\x31\x3A\x64\x31\x32\x38\x3A\x40\xD0\x55\x9D\x2A\xA7\xBC\xBF\xE2\x3E\x33\x98\x71" + "\x7B\x37\x3D\xB8\x38\x57\xA1\x43\xEA\x90\x81\x42\xCA\x23\xE1\xBF\x9C\xA8\xBC\xC5" + "\x9B\xF8\x9D\x77\x71\xCD\xD3\x85\x8B\x20\x3A\x92\xE9\xBC\x79\xF3\xF7\xF5\x6D\x15" + "\xA3\x58\x3F\xC2\xEB\xED\x72\xD4\xE0\xCF\xEC\xB3\xEC\xEB\x09\xEA\x1E\x72\x6A\xBA" + "\x95\x82\x2C\x7E\x30\x95\x66\x3F\xA8\x2D\x40\x0F\x7A\x12\x4E\xF0\x71\x0F\x97\xDB" + "\x81\xE4\x39\x6D\x24\x58\xFA\xAB\x3A\x36\x73\x63\x01\x77\x42\xC7\x9A\xEA\x87\xDA" + "\x93\x8F\x6C\x64\xAD\x9E\xF0\xCA\xA2\x89\xA4\x0E\xB3\x25\x73\x29\x28\x31\x3A\x70" + "\x36\x35\x3A\x00\xC3\xF7\x37\x3F\x9D\x93\xEC\xC7\x5E\x4C\xB5\x73\x29\x62\x35\x80" + "\xC6\x7C\x1B\x1E\x68\x5F\x92\x56\x77\x0A\xE2\x8E\x95\x74\x87\xA5\x2F\x83\x2D\xF7" + "\xA1\xC2\x78\x54\x18\x6E\xDE\x35\xF0\x9F\x7A\xCA\x80\x5C\x83\x5C\x44\xAD\x8B\xE7" + "\x5B\xE2\x63\x7D\x6A\xC7\x98\x97\x29\x28\x31\x3A\x71\x36\x35\x3A\x00\xDC\x1F\xB1" + "\xB3\xD8\x13\xE0\x09\x19\xFD\x1C\x58\xA1\x2B\x02\xB4\xC8\xF2\x1C\xE7\xF9\xC6\x3B" + "\x68\xB9\x72\x43\x86\xEF\xA9\x94\x68\x02\xEF\x7D\x77\xE0\x0A\xD1\xD7\x48\xFD\xCD" + "\x98\xDA\x13\x8A\x76\x48\xD4\x0F\x63\x28\xFA\x01\x1B\xF3\xC7\x15\xB8\x53\x22\x7E" + "\x77\x29\x28\x31\x3A\x75\x36\x35\x3A\x00\xB3\xBB\x4D\xEE\x5A\xAF\xD0\xF2\x56\x8A" + "\x10\x2D\x6F\x4B\x2D\x76\x49\x9B\xE9\xA8\x60\x5D\x9E\x7E\x50\x86\xF1\xA1\x0F\x28" + "\x9B\x7B\xE8\xDD\x1F\x87\x4E\x79\x7B\x50\x12\xA7\xB4\x8B\x52\x38\xEC\x7C\xBB\xB9" + "\x55\x87\x11\x1C\x74\xE7\x7F\xA0\xBA\xE3\x34\x5D\x61\xBF\x29\x29\x29\x00" + }; + + struct + { + const char *key; + const char *passphrase; + int no_result_expected; + int compare_results; + unsigned char *result_expected; + size_t resultlen_expected; + int ret_expected; + unsigned char *result; + size_t resultlen; + } specs[] = + { + /* Invalid S-Expressions */ + /* - non-NULL */ + { "", + "passphrase", 1, 0, NULL, 0, GPG_ERR_INV_SEXP, NULL, 0 }, + /* - NULL; disabled, this segfaults */ + //{ NULL, + // "passphrase", 1, NULL, 0, GPG_ERR_INV_SEXP, NULL, 0 }, + + /* Valid and invalid keys. */ + { key_rsa_valid.string, + "passphrase", 0, 0, NULL, 0, 0, NULL, 0 }, + { key_rsa_bogus_0.string, + "passphrase", 0, 0, NULL, 0, GPG_ERR_INV_SEXP, NULL, 0 }, + { key_rsa_bogus_1.string, + "passphrase", 0, 0, NULL, 0, GPG_ERR_INV_SEXP, NULL, 0 }, + + /* FIXME: add more test data. */ + }; + + for (i = 0; i < DIM (specs); i++) + { + ret = agent_protect (specs[i].key, specs[i].passphrase, + &specs[i].result, &specs[i].resultlen); + if (gpg_err_code (ret) != specs[i].ret_expected) + { + printf ("agent_protect() returned `%i/%s'; expected `%i/%s'\n", + ret, gpg_strerror (ret), + specs[i].ret_expected, gpg_strerror (specs[i].ret_expected)); + abort (); + } + + if (specs[i].no_result_expected) + { + assert (! specs[i].result); + assert (! specs[i].resultlen); + } + else + { + if (specs[i].compare_results) + { + assert (specs[i].resultlen == specs[i].resultlen_expected); + if (specs[i].result_expected) + assert (! memcmp (specs[i].result, specs[i].result_expected, + specs[i].resultlen)); + else + assert (! specs[i].result); + } + xfree (specs[i].result); + } + } } @@ -133,6 +294,8 @@ int main (int argc, char **argv) { + gcry_control (GCRYCTL_DISABLE_SECMEM); + test_agent_protect (); test_agent_unprotect (); test_agent_private_key_type (); From cvs at cvs.gnupg.org Thu Sep 15 18:24:48 2005 From: cvs at cvs.gnupg.org (svn author mo) Date: Fri Sep 16 18:22:38 2005 Subject: [svn] gcry - r1105 - trunk/tests Message-ID: Author: mo Date: 2005-09-15 18:24:48 +0200 (Thu, 15 Sep 2005) New Revision: 1105 Added: trunk/tests/keygrip.c Modified: trunk/tests/ChangeLog trunk/tests/Makefile.am trunk/tests/basic.c Log: 2005-09-15 Moritz Schulte * Makefile.am (TESTS): Added keygrip. * keygrip.c: New. Modified: trunk/tests/ChangeLog =================================================================== --- trunk/tests/ChangeLog 2005-09-14 18:56:36 UTC (rev 1104) +++ trunk/tests/ChangeLog 2005-09-15 16:24:48 UTC (rev 1105) @@ -1,3 +1,8 @@ +2005-09-15 Moritz Schulte + + * Makefile.am (TESTS): Added keygrip. + * keygrip.c: New. + 2005-08-19 Werner Koch * hmac.c (main): Added all FIPS tests. Modified: trunk/tests/Makefile.am =================================================================== --- trunk/tests/Makefile.am 2005-09-14 18:56:36 UTC (rev 1104) +++ trunk/tests/Makefile.am 2005-09-15 16:24:48 UTC (rev 1105) @@ -19,7 +19,7 @@ ## Process this file with automake to produce Makefile.in TESTS = prime register ac ac-schemes ac-data basic \ - tsexp keygen pubkey benchmark pkbench hmac + tsexp keygen pubkey benchmark pkbench hmac keygrip INCLUDES = -I$(top_srcdir)/src LDADD = ../src/libgcrypt.la Modified: trunk/tests/basic.c =================================================================== --- trunk/tests/basic.c 2005-09-14 18:56:36 UTC (rev 1104) +++ trunk/tests/basic.c 2005-09-15 16:24:48 UTC (rev 1105) @@ -850,6 +850,8 @@ GPG_ERR_DIGEST_ALGO }, { "(data\n (flags )\n" " (value #11223344556677889900AA#))\n", 0 }, + { "(data\n (flags )\n" " (value #0090223344556677889900AA#))\n", + 0 }, { "(data\n (flags raw)\n" " (value #11223344556677889900AA#))\n", 0 }, { "(data\n (flags pkcs1)\n" Added: trunk/tests/keygrip.c =================================================================== --- trunk/tests/keygrip.c 2005-09-14 18:56:36 UTC (rev 1104) +++ trunk/tests/keygrip.c 2005-09-15 16:24:48 UTC (rev 1105) @@ -0,0 +1,139 @@ +/* keygrip.c - verifies that keygrips are calculated as expected + * Copyright (C) 2005 Free Software Foundation, Inc. + * + * This file is part of Libgcrypt. + * + * Libgcrypt 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. + * + * Libgcrypt 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include +#include + +#include "../src/gcrypt.h" + +static int verbose; + + + +static void +die (const char *format, ...) +{ + va_list arg_ptr; + + va_start (arg_ptr, format); + vfprintf (stderr, format, arg_ptr); + va_end (arg_ptr); + exit (1); +} + + + +static struct +{ + const char *key; + const unsigned char grip[20]; +} key_grips[] = + { + { + "(private-key" + " (rsa" + " (n #00B6B509596A9ECABC939212F891E656A626BA07DA8521A9CAD4C08E640C04052FBB87F424EF1A0275A48A9299AC9DB69ABE3D0124E6C756B1F7DFB9B842D6251AEA6EE85390495CADA73D671537FCE5850A932F32BAB60AB1AC1F852C1F83C625E7A7D70CDA9EF16D5C8E47739D77DF59261ABE8454807FF441E143FBD37F8545#)" + " (e #010001#)" + " (d #077AD3DE284245F4806A1B82B79E616FBDE821C82D691A65665E57B5FAD3F34E67F401E7BD2E28699E89D9C496CF821945AE83AC7A1231176A196BA6027E77D85789055D50404A7A2A95B1512F91F190BBAEF730ED550D227D512F89C0CDB31AC06FA9A19503DDF6B66D0B42B9691BFD6140EC1720FFC48AE00C34796DC899E5#)" + " (p #00D586C78E5F1B4BF2E7CD7A04CA091911706F19788B93E44EE20AAF462E8363E98A72253ED845CCBF2481BB351E8557C85BCFFF0DABDBFF8E26A79A0938096F27#)" + " (q #00DB0CDF60F26F2A296C88D6BF9F8E5BE45C0DDD713C96CC73EBCB48B061740943F21D2A93D6E42A7211E7F02A95DCED6C390A67AD21ECF739AE8A0CA46FF2EBB3#)" + " (u #33149195F16912DB20A48D020DBC3B9E3881B39D722BF79378F6340F43148A6E9FC5F53E2853B7387BA4443BA53A52FCA8173DE6E85B42F9783D4A7817D0680B#)))", + "\x32\xCF\xFA\x85\xB1\x79\x1F\xBB\x26\x14\xE9\x1A\xFD\xF3\xAF\xE3\x32\x08\x2E\x25" + }, + { + " (public-key" + " (dsa" + " (p #0084E4C626E16005770BD9509ABF7354492E85B8C0060EFAAAEC617F725B592FAA59DF5460575F41022776A9718CE62EDD542AB73C7720869EBDBC834D174ADCD7136827DF51E2613545A25CA573BC502A61B809000B6E35F5EB7FD6F18C35678C23EA1C3638FB9CFDBA2800EE1B62F41A4479DE824F2834666FBF8DC5B53C2617#)" + " (q #00B0E6F710051002A9F425D98A677B18E0E5B038AB#)" + " (g #44370CEE0FE8609994183DBFEBA7EEA97D466838BCF65EFF506E35616DA93FA4E572A2F08886B74977BC00CA8CD3DBEA7AEB7DB8CBB180E6975E0D2CA76E023E6DE9F8CCD8826EBA2F72B8516532F6001DEFFAE76AA5E59E0FA33DBA3999B4E92D1703098CDEDCC416CF008801964084CDE1980132B2B78CB4CE9C15A559528B#)" + " (y #3D5DD14AFA2BF24A791E285B90232213D0E3BA74AB1109E768AED19639A322F84BB7D959E2BA92EF73DE4C7F381AA9F4053CFA3CD4527EF9043E304E5B95ED0A3A5A9D590AA641C13DB2B6E32B9B964A6A2C730DD3EA7C8E13F7A140AFF1A91CE375E9B9B960384779DC4EA180FA1F827C52288F366C0770A220F50D6D8FD6F6#)))", + "\x04\xA3\x4F\xA0\x2B\x03\x94\xD7\x32\xAD\xD5\x9B\x50\xAF\xDB\x5D\x57\x22\xA6\x10" + + }, + { + "(private-key" + " (dsa" + " (p #0084E4C626E16005770BD9509ABF7354492E85B8C0060EFAAAEC617F725B592FAA59DF5460575F41022776A9718CE62EDD542AB73C7720869EBDBC834D174ADCD7136827DF51E2613545A25CA573BC502A61B809000B6E35F5EB7FD6F18C35678C23EA1C3638FB9CFDBA2800EE1B62F41A4479DE824F2834666FBF8DC5B53C2617#)" + " (q #00B0E6F710051002A9F425D98A677B18E0E5B038AB#)" + " (g #44370CEE0FE8609994183DBFEBA7EEA97D466838BCF65EFF506E35616DA93FA4E572A2F08886B74977BC00CA8CD3DBEA7AEB7DB8CBB180E6975E0D2CA76E023E6DE9F8CCD8826EBA2F72B8516532F6001DEFFAE76AA5E59E0FA33DBA3999B4E92D1703098CDEDCC416CF008801964084CDE1980132B2B78CB4CE9C15A559528B#)" + " (y #3D5DD14AFA2BF24A791E285B90232213D0E3BA74AB1109E768AED19639A322F84BB7D959E2BA92EF73DE4C7F381AA9F4053CFA3CD4527EF9043E304E5B95ED0A3A5A9D590AA641C13DB2B6E32B9B964A6A2C730DD3EA7C8E13F7A140AFF1A91CE375E9B9B960384779DC4EA180FA1F827C52288F366C0770A220F50D6D8FD6F6#)" + " (x #0087F9E91BFBCC1163DE71ED86D557708E32F8ADDE#)))", + "\x04\xA3\x4F\xA0\x2B\x03\x94\xD7\x32\xAD\xD5\x9B\x50\xAF\xDB\x5D\x57\x22\xA6\x10" + } + }; + +static void +check (void) +{ + unsigned char buf[20]; + unsigned char *ret; + gcry_error_t err; + gcry_sexp_t sexp; + unsigned int i; + + for (i = 0; i < (sizeof (key_grips) / sizeof (*key_grips)); i++) + { + err = gcry_sexp_sscan (&sexp, NULL, key_grips[i].key, + strlen (key_grips[i].key)); + assert (! err); + ret = gcry_pk_get_keygrip (sexp, buf); + assert (ret); + assert (! memcmp (key_grips[i].grip, buf, sizeof (buf))); + gcry_sexp_release (sexp); + } +} + + + +static void +progress_handler (void *cb_data, const char *what, int printchar, + int current, int total) +{ + putchar (printchar); +} + +int +main (int argc, char **argv) +{ + int debug = 0; + + if (argc > 1 && !strcmp (argv[1], "--verbose")) + verbose = 1; + else if (argc > 1 && !strcmp (argv[1], "--debug")) + verbose = debug = 1; + + if (!gcry_check_version (GCRYPT_VERSION)) + die ("version mismatch\n"); + + gcry_set_progress_handler (progress_handler, NULL); + + gcry_control (GCRYCTL_DISABLE_SECMEM, 0); + + check (); + + return 0; +} From cvs at cvs.gnupg.org Fri Sep 16 13:05:40 2005 From: cvs at cvs.gnupg.org (svn author twoaday) Date: Fri Sep 16 18:23:05 2005 Subject: [svn] GPGol - r97 - trunk/src Message-ID: Author: twoaday Date: 2005-09-16 13:05:40 +0200 (Fri, 16 Sep 2005) New Revision: 97 Removed: trunk/src/test.c Log: Remove old regression tests. Deleted: trunk/src/test.c From cvs at cvs.gnupg.org Thu Sep 15 19:51:15 2005 From: cvs at cvs.gnupg.org (svn author mo) Date: Fri Sep 16 18:23:08 2005 Subject: [svn] gcry - r1106 - in trunk: . src Message-ID: Author: mo Date: 2005-09-15 19:51:14 +0200 (Thu, 15 Sep 2005) New Revision: 1106 Modified: trunk/ChangeLog trunk/Makefile.am trunk/src/gcrypt.h Log: 2005-09-15 Moritz Schulte * Makefile.am (EXTRA_DIST): Depend on README.SVN, not on README.CVS. Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2005-09-15 16:24:48 UTC (rev 1105) +++ trunk/ChangeLog 2005-09-15 17:51:14 UTC (rev 1106) @@ -1,3 +1,7 @@ +2005-09-15 Moritz Schulte + + * Makefile.am (EXTRA_DIST): Depend on README.SVN, not on README.CVS. + 2005-06-25 Moritz Schulte * configure.ac: Removed src/libgcrypt.pc from AC_CONFIG_FILES. Modified: trunk/Makefile.am =================================================================== --- trunk/Makefile.am 2005-09-15 16:24:48 UTC (rev 1105) +++ trunk/Makefile.am 2005-09-15 17:51:14 UTC (rev 1106) @@ -22,7 +22,7 @@ DIST_SUBDIRS = mpi cipher src doc tests w32-dll SUBDIRS = mpi cipher src doc tests -EXTRA_DIST = BUGS autogen.sh README.apichanges README.CVS +EXTRA_DIST = BUGS autogen.sh README.apichanges README.SVN DISTCLEANFILES = Modified: trunk/src/gcrypt.h =================================================================== --- trunk/src/gcrypt.h 2005-09-15 16:24:48 UTC (rev 1105) +++ trunk/src/gcrypt.h 2005-09-15 17:51:14 UTC (rev 1106) @@ -1,5 +1,5 @@ /* gcrypt.h - GNU cryptographic library interface - * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, * 2004 Free Software Foundation, Inc. * * This file is part of Libgcrypt. From cvs at cvs.gnupg.org Mon Sep 19 12:00:27 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Mon Sep 19 11:33:19 2005 Subject: [svn] GPGol - r99 - trunk/src Message-ID: Author: wk Date: 2005-09-19 12:00:26 +0200 (Mon, 19 Sep 2005) New Revision: 99 Modified: trunk/src/ChangeLog trunk/src/display.cpp trunk/src/gpgmsg.cpp trunk/src/main.c trunk/src/watcher.cpp Log: Merged Timos changes. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2005-09-16 11:12:16 UTC (rev 98) +++ trunk/src/ChangeLog 2005-09-19 10:00:26 UTC (rev 99) @@ -1,3 +1,12 @@ +2005-09-19 Werner Koch + + * main.c (DllMain): Removed debug output; this should not be + used before initialization! + + * watcher.cpp: Include config.h. Removed weird line endings. + + * gpgmsg.cpp (encrypt_and_sign): Call SaveChanges. + 2005-09-15 Timo Schulz * util.h: Provider watcher prototypes. @@ -40,7 +49,7 @@ * gpgmsg.cpp (decryptAttachment, decrypt): Save plaintext back into the MAPI if desired. -g2004-09-08 Timo Schulz +2004-09-08 Timo Schulz * passphrase-dialog.c (lod_recipbox): Use gpgme directly to resolve the keyids to userids. Property changes on: trunk/src/display.cpp ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/src/gpgmsg.cpp =================================================================== --- trunk/src/gpgmsg.cpp 2005-09-16 11:12:16 UTC (rev 98) +++ trunk/src/gpgmsg.cpp 2005-09-19 10:00:26 UTC (rev 99) @@ -1193,6 +1193,7 @@ GpgMsgImpl::encrypt_and_sign (HWND hwnd, bool sign_flag) { log_debug ("%s:%s: enter\n", __FILE__, __func__); + HRESULT hr; gpgme_key_t *keys = NULL; gpgme_key_t sign_key = NULL; bool is_html; @@ -1331,6 +1332,14 @@ err = set_message_body (message, ciphertext); if (err) goto leave; + hr = message->SaveChanges (KEEP_OPEN_READWRITE|FORCE_SAVE); + if (hr != S_OK) + { + log_error ("%s:%s: SaveChanges(message) failed: hr=%#lx\n", + __FILE__, __func__, hr); + err = gpg_error (GPG_ERR_GENERAL); + goto leave; + } } @@ -2256,7 +2265,7 @@ } -/* Sign the attachment with the internal number POS. TTL is caching +/* Sign the attachment with the internal number POS. TTL is the caching time for a required passphrase. */ void GpgMsgImpl::signAttachment (HWND hwnd, int pos, gpgme_key_t sign_key, int ttl) Property changes on: trunk/src/gpgmsg.cpp ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/src/main.c =================================================================== --- trunk/src/main.c 2005-09-16 11:12:16 UTC (rev 98) +++ trunk/src/main.c 2005-09-19 10:00:26 UTC (rev 99) @@ -81,7 +81,6 @@ { if (reason == DLL_PROCESS_ATTACH) { - log_debug ("%s: attached to process\n", __func__); set_global_hinstance (hinst); /* The next call initializes subsystems of gpgme and should be done as early as possible. The actual return value is (the @@ -101,7 +100,6 @@ else if (reason == DLL_PROCESS_DETACH) { watcher_free_hook (); - log_debug ("%s: detached from process\n", __func__); } return TRUE; Modified: trunk/src/watcher.cpp =================================================================== --- trunk/src/watcher.cpp 2005-09-16 11:12:16 UTC (rev 98) +++ trunk/src/watcher.cpp 2005-09-19 10:00:26 UTC (rev 99) @@ -19,176 +19,178 @@ * 02110-1301, USA. */ -#include -#include -#include - -#include "mymapi.h" -#include "myexchext.h" -#include "mymapitags.h" -#include "gpgmsg.hh" -#include "util.h" -#include "intern.h" - -/* Exchange callback context to retrieve the last message. */ -static LPEXCHEXTCALLBACK g_cb = NULL; - -/* The current hook handle. */ -static HHOOK g_cbt_hook = NULL; - -/* MAPI message and storage handle. */ -static LPMESSAGE g_msg = NULL; -static LPMDB g_mdb = NULL; -static HWND g_creat_wnd = 0; - -static HWND -find_message_window2 (HWND parent) -{ - HWND child; - - if (!parent) - return NULL; - - child = GetWindow (parent, GW_CHILD); - while (child) - { - char buf[1024+1]; - HWND w; - size_t len; - const char *s; - - memset (buf, 0, sizeof (buf)); - GetWindowText (child, buf, sizeof (buf)-1); - len = strlen (buf); - if (len > 22 - && (s = strstr (buf, "-----BEGIN PGP ")) - && (!strncmp (s+15, "MESSAGE-----", 12) - || !strncmp (s+15, "SIGNED MESSAGE-----", 19))) - return child; - w = find_message_window2 (child); - if (w) - { - log_debug ("%s: watcher found message window: %p\n", __func__, w); - return w; - } - - child = GetNextWindow (child, GW_HWNDNEXT); - } - - return NULL; -} - - -static void -decrypt_message (HWND hwnd, LPMESSAGE msg) -{ - GpgMsg *m = CreateGpgMsg (msg); - m->setExchangeCallback ((void *)g_cb); - m->decrypt (hwnd); - delete m; - UlRelease (msg); - msg = NULL; -} - - -/* XXX: describe what we are doing here! */ - -static LRESULT CALLBACK -cbt_proc (int code, WPARAM w, LPARAM l) -{ - char wclass[128]; - HWND msgwnd, hwnd; - - if (code < 0) - return CallNextHookEx (g_cbt_hook, code, w, l); - - hwnd = (HWND)w; - if (code == HCBT_CREATEWND) - { - GetClassName (hwnd, wclass, 127); - if (strstr (wclass, "rctrl_renwnd32")) - { - g_creat_wnd = hwnd; - log_debug ("%s: watch for window %p\n", __func__, hwnd); - } - - } - - if (code == HCBT_ACTIVATE && g_creat_wnd == hwnd) - { - log_debug ("%s: %p == %p?\n", __func__, g_creat_wnd, hwnd); - g_creat_wnd = NULL; - msgwnd = find_message_window2 (hwnd); - if (msgwnd && g_msg) - { - log_debug ("%s: decrypt_message(%p, %p)\n", __func__, hwnd, g_msg); - decrypt_message (hwnd, g_msg); - UlRelease (g_mdb); - g_mdb = NULL; - } - } - - return CallNextHookEx (g_cbt_hook, code, w, l); -} - - -/* Initialize the CBT hook. */ -extern "C" int -watcher_init_hook (void) -{ - if (g_cbt_hook != NULL) - return 0; - g_cbt_hook = SetWindowsHookEx (WH_CBT, cbt_proc, glob_hinst, 0); - if (!g_cbt_hook) - { - log_debug ("%s: SetWindowsHookEx failed ec=%d\n", - __func__, (int)GetLastError ()); - return -1; - } - return 0; -} - - -/* Remove the CBT hook. */ -extern "C" int -watcher_free_hook (void) -{ - if (g_msg != NULL) - { - UlRelease (g_msg); - g_msg = NULL; - } - if (g_mdb != NULL) - { - UlRelease (g_mdb); - g_mdb = NULL; - } - if (g_cbt_hook != NULL) - { - UnhookWindowsHookEx (g_cbt_hook); - g_cbt_hook = NULL; - } - return 0; -} - - -/* Set the Exchange callback context. */ -extern "C" void -watcher_set_callback_ctx (void *cb) -{ - HRESULT hr; - - g_cb = (LPEXCHEXTCALLBACK)cb; - - if (g_msg != NULL) - UlRelease (g_msg); - if (g_mdb != NULL) - UlRelease (g_mdb); - hr = g_cb->GetObject (&g_mdb, (LPMAPIPROP *)&g_msg); - if (FAILED (hr)) - { - log_debug ("%s: GetObject() failed ec=%lx\n", __func__, hr); - g_mdb = NULL; - g_msg = NULL; - } -} +#include + +#include +#include +#include + +#include "mymapi.h" +#include "myexchext.h" +#include "mymapitags.h" +#include "gpgmsg.hh" +#include "util.h" +#include "intern.h" + +/* Exchange callback context to retrieve the last message. */ +static LPEXCHEXTCALLBACK g_cb = NULL; + +/* The current hook handle. */ +static HHOOK g_cbt_hook = NULL; + +/* MAPI message and storage handle. */ +static LPMESSAGE g_msg = NULL; +static LPMDB g_mdb = NULL; +static HWND g_creat_wnd = 0; + +static HWND +find_message_window2 (HWND parent) +{ + HWND child; + + if (!parent) + return NULL; + + child = GetWindow (parent, GW_CHILD); + while (child) + { + char buf[1024+1]; + HWND w; + size_t len; + const char *s; + + memset (buf, 0, sizeof (buf)); + GetWindowText (child, buf, sizeof (buf)-1); + len = strlen (buf); + if (len > 22 + && (s = strstr (buf, "-----BEGIN PGP ")) + && (!strncmp (s+15, "MESSAGE-----", 12) + || !strncmp (s+15, "SIGNED MESSAGE-----", 19))) + return child; + w = find_message_window2 (child); + if (w) + { + log_debug ("%s: watcher found message window: %p\n", __func__, w); + return w; + } + + child = GetNextWindow (child, GW_HWNDNEXT); + } + + return NULL; +} + + +static void +decrypt_message (HWND hwnd, LPMESSAGE msg) +{ + GpgMsg *m = CreateGpgMsg (msg); + m->setExchangeCallback ((void *)g_cb); + m->decrypt (hwnd); + delete m; + UlRelease (msg); + msg = NULL; +} + + +/* XXX: describe what we are doing here! */ + +static LRESULT CALLBACK +cbt_proc (int code, WPARAM w, LPARAM l) +{ + char wclass[128]; + HWND msgwnd, hwnd; + + if (code < 0) + return CallNextHookEx (g_cbt_hook, code, w, l); + + hwnd = (HWND)w; + if (code == HCBT_CREATEWND) + { + GetClassName (hwnd, wclass, 127); + if (strstr (wclass, "rctrl_renwnd32")) + { + g_creat_wnd = hwnd; + log_debug ("%s: watch for window %p\n", __func__, hwnd); + } + + } + + if (code == HCBT_ACTIVATE && g_creat_wnd == hwnd) + { + log_debug ("%s: %p == %p?\n", __func__, g_creat_wnd, hwnd); + g_creat_wnd = NULL; + msgwnd = find_message_window2 (hwnd); + if (msgwnd && g_msg) + { + log_debug ("%s: decrypt_message(%p, %p)\n", __func__, hwnd, g_msg); + decrypt_message (hwnd, g_msg); + UlRelease (g_mdb); + g_mdb = NULL; + } + } + + return CallNextHookEx (g_cbt_hook, code, w, l); +} + + +/* Initialize the CBT hook. */ +extern "C" int +watcher_init_hook (void) +{ + if (g_cbt_hook != NULL) + return 0; + g_cbt_hook = SetWindowsHookEx (WH_CBT, cbt_proc, glob_hinst, 0); + if (!g_cbt_hook) + { + log_debug ("%s: SetWindowsHookEx failed ec=%d\n", + __func__, (int)GetLastError ()); + return -1; + } + return 0; +} + + +/* Remove the CBT hook. */ +extern "C" int +watcher_free_hook (void) +{ + if (g_msg != NULL) + { + UlRelease (g_msg); + g_msg = NULL; + } + if (g_mdb != NULL) + { + UlRelease (g_mdb); + g_mdb = NULL; + } + if (g_cbt_hook != NULL) + { + UnhookWindowsHookEx (g_cbt_hook); + g_cbt_hook = NULL; + } + return 0; +} + + +/* Set the Exchange callback context. */ +extern "C" void +watcher_set_callback_ctx (void *cb) +{ + HRESULT hr; + + g_cb = (LPEXCHEXTCALLBACK)cb; + + if (g_msg != NULL) + UlRelease (g_msg); + if (g_mdb != NULL) + UlRelease (g_mdb); + hr = g_cb->GetObject (&g_mdb, (LPMAPIPROP *)&g_msg); + if (FAILED (hr)) + { + log_debug ("%s: GetObject() failed ec=%lx\n", __func__, hr); + g_mdb = NULL; + g_msg = NULL; + } +} Property changes on: trunk/src/watcher.cpp ___________________________________________________________________ Name: svn:eol-style + native From cvs at cvs.gnupg.org Mon Sep 19 18:47:56 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Mon Sep 19 18:20:47 2005 Subject: [svn] GPGol - r100 - in trunk: . src Message-ID: Author: wk Date: 2005-09-19 18:47:55 +0200 (Mon, 19 Sep 2005) New Revision: 100 Modified: trunk/ChangeLog trunk/NEWS trunk/README trunk/TODO trunk/configure.ac trunk/src/ChangeLog trunk/src/gpgmsg.cpp trunk/src/intern.h trunk/src/main.c trunk/src/msgcache.c trunk/src/olflange.cpp trunk/src/passcache.c Log: About to release 0.9.1 Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2005-09-19 10:00:26 UTC (rev 99) +++ trunk/ChangeLog 2005-09-19 16:47:55 UTC (rev 100) @@ -1,6 +1,10 @@ +2005-09-19 Werner Koch + + Released 0.9.1. + 2005-09-04 Werner Koch - Release version 0.9.0. + Released 0.9.0. 2005-08-30 Werner Koch Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2005-09-19 10:00:26 UTC (rev 99) +++ trunk/NEWS 2005-09-19 16:47:55 UTC (rev 100) @@ -1,3 +1,9 @@ +Noteworthy changes for version 0.9.1 (2005-09-19) +================================================= + +* Bug fixes + + Noteworthy changes for version 0.9.0 (2005-09-04) ================================================= Modified: trunk/README =================================================================== --- trunk/README 2005-09-19 10:00:26 UTC (rev 99) +++ trunk/README 2005-09-19 16:47:55 UTC (rev 100) @@ -12,7 +12,7 @@ To install this plugin, copy it to some directory (e.g. where gpg lives), make sure that the libgpg-error.dll and gpgme.dll are available in a directory where Windows searches for DLLs (e.g. c:\winnt\system32), -stop Outlook, run the command "regsvr32 outlgpg.dll" and start +stop Outlook, run the command "regsvr32 gpgol.dll" and start Outlook. You should then find a new tab named "GnuPG" in Outlook's option menu. @@ -25,7 +25,7 @@ debugging - any BFD cracks who can lend me a helping hand? (wk). Bug reporting: First click on the logo on the GnuPG options tab to -check whether a neer version has been released - try this first. If +check whether a newer version has been released - try this first. If this does not help, check out the mailing lists and also the bug archive at http://bugs.gnupg.org (use username and password "guest", select "query" and there category "gpgol") if you did not found any Modified: trunk/TODO =================================================================== --- trunk/TODO 2005-09-19 10:00:26 UTC (rev 99) +++ trunk/TODO 2005-09-19 16:47:55 UTC (rev 100) @@ -11,7 +11,9 @@ same holds true for HrSetOneProp. We might want to use OpenProperty for longer texts. -* IMPORTANT: msgcache.c grows without limit - fix it. +* Hook into OnDelivery and rename attachments named like the + Attestation attachment we generate locally. We might also want to + detect whether this is an encrypted message and change the + MessageClass accordingly. -* Hook into OnDelivery and rename attachments named like the - Attestation attachment we generate locally. + Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2005-09-19 10:00:26 UTC (rev 99) +++ trunk/configure.ac 2005-09-19 16:47:55 UTC (rev 100) @@ -15,7 +15,7 @@ # Version number: Remember to change it immediately *after* a release. # Add a "-cvs" prefix for non-released code. -AC_INIT(gpgol, 0.9.0, bug-gpgol@g10code.com) +AC_INIT(gpgol, 0.9.1, bug-gpgol@g10code.com) NEED_GPGME_API=1 NEED_GPGME_VERSION=1.1.0 Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2005-09-19 10:00:26 UTC (rev 99) +++ trunk/src/ChangeLog 2005-09-19 16:47:55 UTC (rev 100) @@ -1,5 +1,14 @@ 2005-09-19 Werner Koch + * msgcache.c (flush_if_needed): New. + (msgcache_put): use it. + + * intern.h (opt): New compatibility flags AUTO_DECRYPT and + NO_ATTESTATION. + * olflange.cpp (InstallCommands): Use watcher stuff only when this + option has been enabled. + * gpgmsg.cpp (decrypt): Take care of NO_ATTESTATION. + * main.c (DllMain): Removed debug output; this should not be used before initialization! Modified: trunk/src/gpgmsg.cpp =================================================================== --- trunk/src/gpgmsg.cpp 2005-09-19 10:00:26 UTC (rev 99) +++ trunk/src/gpgmsg.cpp 2005-09-19 16:47:55 UTC (rev 100) @@ -920,7 +920,7 @@ log_debug ("%s:%s: we already have an attestation\n", __FILE__, __func__); } - else if (!attestation) + else if (!attestation && !opt.compat.no_attestation) gpgme_data_new (&attestation); @@ -1163,7 +1163,7 @@ failed. */ } - set_x_header (message, "GPGol-Version", PACKAGE_VERSION); + set_x_header (message, "Gpgol-Version", PACKAGE_VERSION); /* Now that we successfully processed the attachments, we can save the changes to the body. For unknown reasons we need to set it @@ -1320,7 +1320,7 @@ } } - set_x_header (message, "GPGol-Version", PACKAGE_VERSION); + set_x_header (message, "Gpgol-Version", PACKAGE_VERSION); /* Now that we successfully processed the attachments, we can save the changes to the body. For unknown reasons we need to set it Modified: trunk/src/intern.h =================================================================== --- trunk/src/intern.h 2005-09-19 10:00:26 UTC (rev 99) +++ trunk/src/intern.h 2005-09-19 16:47:55 UTC (rev 100) @@ -108,8 +108,10 @@ unsigned int no_msgcache:1; unsigned int no_pgpmime:1; unsigned int no_oom_write:1; /* Don't write using Outlooks object model. */ - unsigned int preview_decryption:1; + unsigned int preview_decryption:1; /* Decrypt in preview window. */ unsigned int old_reply_hack: 1; /* See gpgmsg.cpp:decrypt. */ + unsigned int auto_decrypt: 1; /* Try to decrypt when clicked. */ + unsigned int no_attestation: 1; /* Don't create an attestation. */ } compat; } opt; Modified: trunk/src/main.c =================================================================== --- trunk/src/main.c 2005-09-19 10:00:26 UTC (rev 99) +++ trunk/src/main.c 2005-09-19 16:47:55 UTC (rev 100) @@ -344,6 +344,8 @@ case 2: opt.compat.no_oom_write = x; break; case 3: opt.compat.preview_decryption = x; break; case 4: opt.compat.old_reply_hack = x; break; + case 5: opt.compat.auto_decrypt = x; break; + case 6: opt.compat.no_attestation = x; break; } } log_debug ("Note: using compatibility flags: %s", val); Modified: trunk/src/msgcache.c =================================================================== --- trunk/src/msgcache.c 2005-09-19 10:00:26 UTC (rev 99) +++ trunk/src/msgcache.c 2005-09-19 16:47:55 UTC (rev 100) @@ -74,6 +74,12 @@ #include "util.h" +/* We limit the size of the cache to this value. The cache might take + up more space temporary if a new message is larger than this values + or if several thereads are currently accessing the cache. */ +#define MAX_CACHESIZE (512*1024) /* 512k */ + + /* A Item to hold a cache message, i.e. the plaintext and a key. */ struct cache_item { @@ -144,7 +150,44 @@ } +/* Flush entries from the cache if it gets too large. NOTE: This + function needs to be called with a locked cache. NEWSIZE is the + size of the message we want to put in the cache later. */ +static void +flush_if_needed (size_t newsize) +{ + cache_item_t item, prev; + size_t total; + + for (total = newsize, item = the_cache; item; item = item->next) + total += item->length; + if (total <= MAX_CACHESIZE) + return; + + /* Our algorithm to remove entries is pretty simple: We remove + entries from the end until we are below the maximum size. */ + again: + for (item = the_cache, prev = NULL; item; prev = item, item = item->next) + if ( !item->next && !item->ref) + { + if (prev) + prev->next = NULL; + else + the_cache = NULL; + if (total > item->length) + total -= item->length; + else + total = 0; + xfree (item->plaintext); + xfree (item); + if (total > MAX_CACHESIZE) + goto again; + break; + } +} + + /* Put the BODY of a message into the cache. BODY should be a malloced string, UTF8 encoded. If TRANSFER is given as true, the ownership of the malloced memory for BODY is transferred to this @@ -226,7 +269,7 @@ if (!lock_cache ()) { - /* FIXME: Decide whether to kick out some entries. */ + flush_if_needed (item->length); item->next = the_cache; the_cache = item; unlock_cache (); @@ -334,8 +377,10 @@ __func__, item); else item->ref--; - /* Fixme: check whether this one has been scheduled for - removal. */ + /* We could here check whether this one has been + scheduled for removal. However, I don't think this + is really required, we just wait for the next new + message which will then remove all pending ones. */ break; } } Modified: trunk/src/olflange.cpp =================================================================== --- trunk/src/olflange.cpp 2005-09-19 10:00:26 UTC (rev 99) +++ trunk/src/olflange.cpp 2005-09-19 16:47:55 UTC (rev 100) @@ -468,7 +468,8 @@ if (!g_initdll) { - watcher_init_hook (); + if (opt.compat.auto_decrypt) + watcher_init_hook (); read_options (); op_init (); g_initdll = TRUE; @@ -922,7 +923,7 @@ } -/* Called by Echange to install commands and toolbar buttons. Returns +/* Called by Exchange to install commands and toolbar buttons. Returns S_FALSE to signal Exchange to continue calling extensions. */ STDMETHODIMP CGPGExchExtCommands::InstallCommands ( @@ -1081,7 +1082,8 @@ HWND hwndToolbar = NULL; CHAR szBuffer[128]; - watcher_set_callback_ctx ((void *)pEECB); + if (opt.compat.auto_decrypt) + watcher_set_callback_ctx ((void *)pEECB); pEECB->GetMenuPos (EECMDID_ToolsCustomizeToolbar, &hMenuTools, NULL, NULL, 0); AppendMenu (hMenuTools, MF_SEPARATOR, 0, NULL); Modified: trunk/src/passcache.c =================================================================== --- trunk/src/passcache.c 2005-09-19 10:00:26 UTC (rev 99) +++ trunk/src/passcache.c 2005-09-19 16:47:55 UTC (rev 100) @@ -103,7 +103,7 @@ /* This is routine is used to remove all deleted entries from the linked list. Deleted entries are marked by a value of NULL. Note, - that this routibne must be called in a locked state. */ + that this routine must be called in a locked state. */ static void remove_deleted_items (void) { From cvs at cvs.gnupg.org Mon Sep 19 19:21:55 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Mon Sep 19 18:54:46 2005 Subject: [svn] GPGol - r101 - tags Message-ID: Author: wk Date: 2005-09-19 19:21:55 +0200 (Mon, 19 Sep 2005) New Revision: 101 Added: tags/gpgol-0.9.1/ Log: Release tag Copied: tags/gpgol-0.9.1 (from rev 100, trunk) From cvs at cvs.gnupg.org Tue Sep 20 05:34:34 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Tue Sep 20 05:07:22 2005 Subject: [svn] GnuPG - r3895 - trunk/g10 Message-ID: Author: dshaw Date: 2005-09-20 05:34:32 +0200 (Tue, 20 Sep 2005) New Revision: 3895 Modified: trunk/g10/ChangeLog trunk/g10/keylist.c trunk/g10/plaintext.c Log: * keylist.c (reorder_keyblock, do_reorder_keyblock): Reorder attribute IDs as well as regular text IDs. * plaintext.c (ask_for_detached_datafile): Use make_filename() on filename so tilde expansion works. Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2005-09-16 12:49:53 UTC (rev 3894) +++ trunk/g10/ChangeLog 2005-09-20 03:34:32 UTC (rev 3895) @@ -1,3 +1,11 @@ +2005-09-19 David Shaw + + * keylist.c (reorder_keyblock, do_reorder_keyblock): Reorder + attribute IDs as well as regular text IDs. + + * plaintext.c (ask_for_detached_datafile): Use make_filename() on + filename so tilde expansion works. + 2005-09-14 David Shaw * main.h, misc.c (parse_options): Add the ability to have help Modified: trunk/g10/keylist.c =================================================================== --- trunk/g10/keylist.c 2005-09-16 12:49:53 UTC (rev 3894) +++ trunk/g10/keylist.c 2005-09-20 03:34:32 UTC (rev 3895) @@ -1379,15 +1379,16 @@ * Reorder the keyblock so that the primary user ID (and not attribute * packet) comes first. Fixme: Replace this by a generic sort * function. */ -void -reorder_keyblock (KBNODE keyblock) +static void +do_reorder_keyblock (KBNODE keyblock,int attr) { KBNODE primary = NULL, primary0 = NULL, primary2 = NULL; KBNODE last, node; for (node=keyblock; node; primary0=node, node = node->next) { if( node->pkt->pkttype == PKT_USER_ID && - !node->pkt->pkt.user_id->attrib_data && + ((attr && node->pkt->pkt.user_id->attrib_data) || + (!attr && !node->pkt->pkt.user_id->attrib_data)) && node->pkt->pkt.user_id->is_primary ) { primary = primary2 = node; for (node=node->next; node; primary2=node, node = node->next ) { @@ -1419,6 +1420,13 @@ } void +reorder_keyblock (KBNODE keyblock) +{ + do_reorder_keyblock(keyblock,1); + do_reorder_keyblock(keyblock,0); +} + +void list_keyblock( KBNODE keyblock, int secret, int fpr, void *opaque ) { reorder_keyblock (keyblock); Modified: trunk/g10/plaintext.c =================================================================== --- trunk/g10/plaintext.c 2005-09-16 12:49:53 UTC (rev 3894) +++ trunk/g10/plaintext.c 2005-09-20 03:34:32 UTC (rev 3895) @@ -446,12 +446,16 @@ int any=0; tty_printf(_("Detached signature.\n")); do { + char *name; xfree(answer); tty_enable_completion(NULL); - answer = cpr_get("detached_signature.filename", + name = cpr_get("detached_signature.filename", _("Please enter name of data file: ")); tty_disable_completion(); cpr_kill_prompt(); + answer=make_filename(name,(void *)NULL); + xfree(name); + if( any && !*answer ) { rc = G10ERR_READ_FILE; goto leave; From cvs at cvs.gnupg.org Tue Sep 20 10:19:51 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue Sep 20 09:52:42 2005 Subject: [svn] GnuPG - r3896 - in trunk: . g10 Message-ID: Author: wk Date: 2005-09-20 10:19:50 +0200 (Tue, 20 Sep 2005) New Revision: 3896 Modified: trunk/TODO trunk/configure.ac trunk/g10/ChangeLog trunk/g10/mainproc.c Log: * mainproc.c (proc_symkey_enc): Take care of a canceled passphrase prompt. Modified: trunk/TODO =================================================================== --- trunk/TODO 2005-09-20 03:34:32 UTC (rev 3895) +++ trunk/TODO 2005-09-20 08:19:50 UTC (rev 3896) @@ -75,4 +75,7 @@ * Delete a card key as well as a wiping. - * Make 2 strings translatable in export.c after releasing 1.4.2. + * passphrase_to_dek does not return NULL after a cancel. There is + no way to issue a cancel when unsing the CLI - this would however + be a Good Thing when used with mixed symkey/pubkey encrypted + messages. See comment in mainproc.c:proc_symkey_enc. Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2005-09-20 03:34:32 UTC (rev 3895) +++ trunk/configure.ac 2005-09-20 08:19:50 UTC (rev 3896) @@ -102,8 +102,8 @@ AC_DEFINE(M_GUARD,1,[Define to use the (obsolete) malloc guarding feature]) fi -# We don't have a test to check whetyer as(1) knows about the -# non executable stackioption. Thus we provide an option to enable +# We don't have a test to check whether as(1) knows about the +# non executable stack option. Thus we provide an option to enable # it. AC_MSG_CHECKING([whether non excutable stack support is requested]) AC_ARG_ENABLE(noexecstack, Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2005-09-20 03:34:32 UTC (rev 3895) +++ trunk/g10/ChangeLog 2005-09-20 08:19:50 UTC (rev 3896) @@ -1,3 +1,8 @@ +2005-09-20 Werner Koch + + * mainproc.c (proc_symkey_enc): Take care of a canceled passphrase + prompt. + 2005-09-19 David Shaw * keylist.c (reorder_keyblock, do_reorder_keyblock): Reorder Modified: trunk/g10/mainproc.c =================================================================== --- trunk/g10/mainproc.c 2005-09-20 03:34:32 UTC (rev 3895) +++ trunk/g10/mainproc.c 2005-09-20 08:19:50 UTC (rev 3896) @@ -327,8 +327,23 @@ } else { - c->dek=passphrase_to_dek(NULL, 0, algo, &enc->s2k, 0, NULL, NULL); + int canceled; + c->dek = passphrase_to_dek (NULL, 0, algo, &enc->s2k, 0, + NULL, &canceled); + if (canceled) + { + /* For unknown reasons passphrase_to_dek does only + return NULL if a new passphrase has been requested + and has not been repeated correctly. Thus even + with a cancel requested (by means of the gpg-agent) + it won't return NULL but an empty passphrase. We + take the most conservative approach for now and + work around it right here. */ + xfree (c->dek); + c->dek = NULL; + } + if(c->dek) { c->dek->symmetric=1; From cvs at cvs.gnupg.org Tue Sep 20 13:35:33 2005 From: cvs at cvs.gnupg.org (svn author twoaday) Date: Wed Sep 21 07:58:07 2005 Subject: [svn] GPGol - r102 - trunk/src Message-ID: Author: twoaday Date: 2005-09-20 13:35:31 +0200 (Tue, 20 Sep 2005) New Revision: 102 Added: trunk/src/attach.cpp trunk/src/attach.h Modified: trunk/src/ChangeLog trunk/src/Makefile.am trunk/src/gpgmsg.cpp trunk/src/intern.h trunk/src/myexchext.h trunk/src/olflange-def.h trunk/src/olflange.cpp trunk/src/olflange.h trunk/src/passphrase-dialog.c trunk/src/recipient-dialog.c trunk/src/rfc822parse.c trunk/src/verify-dialog.c trunk/src/watcher.cpp Log: See ChangeLog. Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2005-09-19 17:21:55 UTC (rev 101) +++ trunk/src/ChangeLog 2005-09-20 11:35:31 UTC (rev 102) @@ -1,3 +1,17 @@ +2005-09-20 Timo Schulz + + * attach.c: New. + * attach.h: New. + * olflange.cpp (CGPGExchExt): Allocate class for + attached file events. + (QueryInterface): Return interface pointer for + attached file events. + * passphrase-dialog.c (load_secbox): Use new GPGME + interface. + (get_pubkey_algo_str): New. + * verify-dialog.c (load_sigbox): Likewise. + * recipient-dialog.c (load_recipbox): Likewise. + 2005-09-19 Werner Koch * msgcache.c (flush_if_needed): New. @@ -2,3 +16,2 @@ (msgcache_put): use it. - * intern.h (opt): New compatibility flags AUTO_DECRYPT and @@ -8,12 +21,9 @@ * olflange.cpp (InstallCommands): Use watcher stuff only when this option has been enabled. * gpgmsg.cpp (decrypt): Take care of NO_ATTESTATION. - * main.c (DllMain): Removed debug output; this should not be used before initialization! - * watcher.cpp: Include config.h. Removed weird line endings. - * gpgmsg.cpp (encrypt_and_sign): Call SaveChanges. 2005-09-15 Timo Schulz Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2005-09-19 17:21:55 UTC (rev 101) +++ trunk/src/Makefile.am 2005-09-20 11:35:31 UTC (rev 102) @@ -43,7 +43,8 @@ verify-dialog.c \ mymapi.h mymapitags.h \ vasprintf.c \ - watcher.cpp + watcher.cpp \ + attach.cpp attach.h gpgol_LDADD = gpgol.def \ $(GPGME_LIBS) mapi32.dll -lshell32 -lgdi32 -lcomdlg32 Added: trunk/src/attach.cpp =================================================================== --- trunk/src/attach.cpp 2005-09-19 17:21:55 UTC (rev 101) +++ trunk/src/attach.cpp 2005-09-20 11:35:31 UTC (rev 102) @@ -0,0 +1,57 @@ +#ifdef HAVE_CONFIG_H +#include +#endif +#include + +#include "mymapi.h" +#include "mymapitags.h" +#include "myexchext.h" +#include "olflange-def.h" +#include "olflange.h" +#include "attach.h" +#include "util.h" + + +STDMETHODIMP +CGPGExchExtAttachedFileEvents::OnReadPattFromSzFile + (LPATTACH att, LPTSTR lpszFile, ULONG ulFlags) +{ + log_debug ("%s: att=%p lpszFile=%s ulFlags=%lx\n", + __func__, att, lpszFile, ulFlags); + return S_FALSE; +} + + +STDMETHODIMP +CGPGExchExtAttachedFileEvents::OnWritePattToSzFile + (LPATTACH att, LPTSTR lpszFile, ULONG ulFlags) +{ + log_debug ("%s: att=%p lpszFile=%s ulFlags=%lx\n", + __func__, att, lpszFile, ulFlags); + return S_FALSE; +} + + +STDMETHODIMP +CGPGExchExtAttachedFileEvents::QueryDisallowOpenPatt (LPATTACH att) +{ + log_debug ("%s: att=%p\n", __func__, att); + return S_FALSE; +} + + +STDMETHODIMP +CGPGExchExtAttachedFileEvents::OnOpenPatt (LPATTACH att) +{ + log_debug ("%s: att=%p\n", __func__, att); + return S_FALSE; +} + + + +STDMETHODIMP +CGPGExchExtAttachedFileEvents::OnOpenSzFile (LPTSTR lpszFile, ULONG ulFlags) +{ + log_debug ("%s: lpszFile=%s ulflags=%lx\n", __func__, lpszFile, ulFlags); + return S_FALSE; +} Added: trunk/src/attach.h =================================================================== --- trunk/src/attach.h 2005-09-19 17:21:55 UTC (rev 101) +++ trunk/src/attach.h 2005-09-20 11:35:31 UTC (rev 102) @@ -0,0 +1,64 @@ + +#ifndef ATTACH_H +#define ATTACH_H + +#include "util.h" + +class CGPGExchExtAttachedFileEvents : public IExchExtAttachedFileEvents +{ +private: + CGPGExchExt *m_pExchExt; + ULONG m_ref; + +public: + CGPGExchExtAttachedFileEvents (CGPGExchExt *pParentInterface) + { + m_pExchExt = pParentInterface; + m_ref = 0; + } + + + inline STDMETHODIMP_(ULONG) AddRef (void) + { + ++m_ref; + return m_ref; + } + + inline STDMETHODIMP_(ULONG) Release (void) + { + ULONG count = --m_ref; + if (!count) + delete this; + return count; + } + + STDMETHODIMP QueryInterface (REFIID riid, LPVOID FAR *ppvObj) + { + *ppvObj = NULL; + if (riid == IID_IExchExtAttachedFileEvents) + { + *ppvObj = (LPVOID)this; + AddRef (); + return S_OK; + } + + if (riid == IID_IUnknown) + { + *ppvObj = (LPVOID)m_pExchExt; + m_pExchExt->AddRef (); + return S_OK; + } + log_debug ("%s: request for unknown interface\n", __func__); + return E_NOINTERFACE; + } + + STDMETHODIMP OnReadPattFromSzFile (LPATTACH att, LPTSTR lpszFile, + ULONG ulFlags); + STDMETHODIMP OnWritePattToSzFile (LPATTACH att, LPTSTR lpszFile, + ULONG ulFlags); + STDMETHODIMP QueryDisallowOpenPatt (LPATTACH att); + STDMETHODIMP OnOpenPatt (LPATTACH att); + STDMETHODIMP OnOpenSzFile (LPTSTR lpszFile, ULONG ulFlags); +}; + +#endif /*ATTACH_H*/ Modified: trunk/src/gpgmsg.cpp =================================================================== --- trunk/src/gpgmsg.cpp 2005-09-19 17:21:55 UTC (rev 101) +++ trunk/src/gpgmsg.cpp 2005-09-20 11:35:31 UTC (rev 102) @@ -1342,7 +1342,6 @@ } } - leave: /* FIXME: What to do with already encrypted attachments if some of the encrypted (or other operations) failed? */ Modified: trunk/src/intern.h =================================================================== --- trunk/src/intern.h 2005-09-19 17:21:55 UTC (rev 101) +++ trunk/src/intern.h 2005-09-20 11:35:31 UTC (rev 102) @@ -139,6 +139,7 @@ const char *pass_info, int prev_was_bad, int fd); void free_decrypt_key (struct decrypt_key_s * ctx); +const char *get_pubkey_algo_str (gpgme_pubkey_algo_t id); /*-- config-dialog.c --*/ void config_dialog_box (HWND parent); Modified: trunk/src/myexchext.h =================================================================== --- trunk/src/myexchext.h 2005-09-19 17:21:55 UTC (rev 101) +++ trunk/src/myexchext.h 2005-09-20 11:35:31 UTC (rev 102) @@ -1,337 +1,365 @@ -/* myexchext.h - Simple replacement for exchext.h - - * This file defines the interface used by Exchange extensions. It - * has been compiled by g10 Code GmbH from several sources describing - * the interface. - * - * Revisions: - * 2005-08-12 Initial version. - * - */ - -#ifndef EXCHEXT_H -#define EXCHEXT_H - -#ifdef __cplusplus -extern "C" { -#if 0 -} -#endif -#endif - -#include -#include -#include "mymapi.h" - - -/* Constants used by Install. */ -#define EECONTEXT_SESSION 0x00000001 -#define EECONTEXT_VIEWER 0x00000002 -#define EECONTEXT_REMOTEVIEWER 0x00000003 -#define EECONTEXT_SEARCHVIEWER 0x00000004 -#define EECONTEXT_ADDRBOOK 0x00000005 -#define EECONTEXT_SENDNOTEMESSAGE 0x00000006 -#define EECONTEXT_READNOTEMESSAGE 0x00000007 -#define EECONTEXT_SENDPOSTMESSAGE 0x00000008 -#define EECONTEXT_READPOSTMESSAGE 0x00000009 -#define EECONTEXT_READREPORTMESSAGE 0x0000000A -#define EECONTEXT_SENDRESENDMESSAGE 0x0000000B -#define EECONTEXT_PROPERTYSHEETS 0x0000000C -#define EECONTEXT_ADVANCEDCRITERIA 0x0000000D -#define EECONTEXT_TASK 0x0000000E - -/* Constants for GetVersion. */ -#define EECBGV_GETBUILDVERSION 0x00000001 -#define EECBGV_GETACTUALVERSION 0x00000002 -#define EECBGV_GETVIRTUALVERSION 0x00000004 -#define EECBGV_BUILDVERSION_MAJOR 0x000d0000 -#define EECBGV_BUILDVERSION_MAJOR_MASK 0xffff0000 -#define EECBGV_BUILDVERSION_MINOR_MASK 0x0000ffff - -/* Some toolbar IDs. */ -#define EETBID_STANDARD 0x00000001 - -/* Constants use for QueryHelpText. */ -#define EECQHT_STATUS 0x00000001 -#define EECQHT_TOOLTIP 0x00000002 - -/* Flags use by the methods of IExchExtPropertySheets. */ -#define EEPS_MESSAGE 0x00000001 -#define EEPS_FOLDER 0x00000002 -#define EEPS_STORE 0x00000003 -#define EEPS_TOOLSOPTIONS 0x00000004 - -/* Flags used by OnFooComplete. */ -#define EEME_FAILED 0x00000001 -#define EEME_COMPLETE_FAILED 0x00000002 - - -/* Command IDs. */ -#define EECMDID_ToolsCustomizeToolbar 134 -#define EECMDID_ToolsOptions 136 - - -/* GUIDs */ -DEFINE_GUID(GUID_NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - -DEFINE_OLEGUID(IID_IUnknown, 0x00000000, 0, 0); -DEFINE_OLEGUID(IID_IDispatch, 0x00020400, 0, 0); - -DEFINE_OLEGUID(IID_IExchExtCallback, 0x00020d10, 0, 0); -DEFINE_OLEGUID(IID_IExchExt, 0x00020d11, 0, 0); -DEFINE_OLEGUID(IID_IExchExtCommands, 0x00020d12, 0, 0); -DEFINE_OLEGUID(IID_IExchExtUserEvents, 0x00020d13, 0, 0); -DEFINE_OLEGUID(IID_IExchExtSessionEvents, 0x00020d14, 0, 0); -DEFINE_OLEGUID(IID_IExchExtMessageEvents, 0x00020d15, 0, 0); -DEFINE_OLEGUID(IID_IExchExtAttachedFileEvents,0x00020d16, 0, 0); -DEFINE_OLEGUID(IID_IExchExtPropertySheets, 0x00020d17, 0, 0); -DEFINE_OLEGUID(IID_IExchExtAdvancedCriteria, 0x00020d18, 0, 0); -DEFINE_OLEGUID(IID_IExchExtModeless, 0x00020d19, 0, 0); -DEFINE_OLEGUID(IID_IExchExtModelessCallback, 0x00020d1a, 0, 0); -DEFINE_OLEGUID(IID_IOutlookExtCallback, 0x0006720d, 0, 0); - - -/* Type definitions. */ - -/* Parameters for the toolbar entries for - IExchExtCommands::InstallCommands. */ -struct TBENTRY -{ - HWND hwnd; - ULONG tbid; - ULONG ulFlags; - UINT itbbBase; -}; -typedef struct TBENTRY TBENTRY; -typedef struct TBENTRY *LPTBENTRY; - - - - - - -/**** Class declarations. ***/ -typedef struct IExchExt IExchExt; -typedef IExchExt *LPEXCHEXT; - -typedef struct IExchExtMessageEvents IExchExtMessageEvents; -typedef IExchExtMessageEvents *LPEXCHEXTMESSAGEEVENTS; - -typedef struct IExchExtCommands IExchExtCommands; -typedef IExchExtCommands *LPEXCHEXTCOMMANDS; - -typedef struct IExchExtPropertySheets IExchExtPropertySheets; -typedef IExchExtPropertySheets *LPEXCHEXTPROPERTYSHEETS; - -typedef struct IExchExtCallback IExchExtCallback; -typedef IExchExtCallback *LPEXCHEXTCALLBACK; - -typedef struct IOutlookExtCallback IOutlookExtCallback; -typedef IOutlookExtCallback *LPOUTLOOKEXTCALLBACK; - -/* The next classes are not yet defined. but if so they should go here. */ -typedef struct IExchExtModeless IExchExtModeless; -typedef IExchExtModeless *LPEXCHEXTMODELESS; -typedef struct IExchExtModelessCallback IExchExtModelessCallback; -typedef IExchExtModelessCallback *LPEXCHEXTMODELESSCALLBACK; - - - - -/*** Class declarations of classes defined elsewhere. ***/ -struct IMAPISession; -typedef struct IMAPISession *LPMAPISESSION; - -struct IAddrBook; -typedef struct IAddrBook *LPADRBOOK; - -struct IMAPIFolder; -typedef struct IMAPIFolder *LPMAPIFOLDER; - -struct IMAPIProp; -typedef struct IMAPIProp *LPMAPIPROP; - -struct IPersistMessage; -typedef struct IPersistMessage *LPPERSISTMESSAGE; - -struct IMAPIMessageSite; -typedef struct IMAPIMessageSite *LPMAPIMESSAGESITE; - -struct IMAPIViewContext; -typedef struct IMAPIViewContext *LPMAPIVIEWCONTEXT; - - - -/*** Types derived from the above class definitions. ***/ - -/* Callback used to load an extension. */ -typedef LPEXCHEXT (CALLBACK *LPFNEXCHEXTENTRY)(void); - -/* Parameters for the IExchExtCallback::ChooseFolder. */ -typedef UINT (STDAPICALLTYPE *LPEECFHOOKPROC)(HWND, UINT, WPARAM, LPARAM); - -struct EXCHEXTCHOOSEFOLDER -{ - UINT cbLength; - HWND hwnd; - LPTSTR szCaption; - LPTSTR szLabel; - LPTSTR szHelpFile; - ULONG ulHelpID; - HINSTANCE hinst; - UINT uiDlgID; - LPEECFHOOKPROC lpeecfhp; - DWORD dwHookData; - ULONG ulFlags; - LPMDB pmdb; - LPMAPIFOLDER pfld; - LPTSTR szName; - DWORD dwReserved1; - DWORD dwReserved2; - DWORD dwReserved3; -}; -typedef struct EXCHEXTCHOOSEFOLDER EXCHEXTCHOOSEFOLDER; -typedef struct EXCHEXTCHOOSEFOLDER *LPEXCHEXTCHOOSEFOLDER; - - - - -/**** Class definitions. ***/ - -EXTERN_C const IID IID_IExchExt; -#undef INTERFACE -#define INTERFACE IExchExt -DECLARE_INTERFACE_(IExchExt, IUnknown) -{ - /*** IUnknown methods. ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE; - STDMETHOD_(ULONG, AddRef)(THIS) PURE; - STDMETHOD_(ULONG, Release)(THIS) PURE; - - /*** IExchExt methods. ***/ - STDMETHOD(Install)(THIS_ LPEXCHEXTCALLBACK, ULONG, ULONG) PURE; -}; - - - -EXTERN_C const IID IID_IExchExtMessageEvents; -#undef INTERFACE -#define INTERFACE IExchExtMessageEvents -DECLARE_INTERFACE_(IExchExtMessageEvents, IUnknown) -{ - /*** IUnknown methods. ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE; - STDMETHOD_(ULONG, AddRef)(THIS) PURE; - STDMETHOD_(ULONG, Release)(THIS) PURE; - - /*** IExchExtMessageEvents methods. ***/ - STDMETHOD(OnRead)(THIS_ LPEXCHEXTCALLBACK) PURE; - STDMETHOD(OnReadComplete)(THIS_ LPEXCHEXTCALLBACK, ULONG) PURE; - STDMETHOD(OnWrite)(THIS_ LPEXCHEXTCALLBACK) PURE; - STDMETHOD(OnWriteComplete)(THIS_ LPEXCHEXTCALLBACK, ULONG) PURE; - STDMETHOD(OnCheckNames)(THIS_ LPEXCHEXTCALLBACK) PURE; - STDMETHOD(OnCheckNamesComplete)(THIS_ LPEXCHEXTCALLBACK, ULONG) PURE; - STDMETHOD(OnSubmit)(THIS_ LPEXCHEXTCALLBACK) PURE; - STDMETHOD_(void, OnSubmitComplete)(THIS_ LPEXCHEXTCALLBACK, ULONG) PURE; -}; - - - -EXTERN_C const IID IID_IExchExtCommands; -#undef INTERFACE -#define INTERFACE IExchExtCommands -DECLARE_INTERFACE_(IExchExtCommands, IUnknown) -{ - /*** IUnknown methods. ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE; - STDMETHOD_(ULONG, AddRef)(THIS) PURE; - STDMETHOD_(ULONG, Release)(THIS) PURE; - - /*** IExchExtCommands methods. ***/ - STDMETHOD(InstallCommands)(THIS_ LPEXCHEXTCALLBACK, HWND, HMENU, - UINT*, LPTBENTRY, UINT, ULONG) PURE; - STDMETHOD_(void, InitMenu)(THIS_ LPEXCHEXTCALLBACK) PURE; - STDMETHOD(DoCommand)(THIS_ LPEXCHEXTCALLBACK, UINT) PURE; - STDMETHOD(Help)(THIS_ LPEXCHEXTCALLBACK, UINT) PURE; - STDMETHOD(QueryHelpText)(THIS_ UINT, ULONG, LPTSTR, UINT) PURE; - STDMETHOD(QueryButtonInfo)(THIS_ ULONG, UINT, LPTBBUTTON, - LPTSTR, UINT, ULONG) PURE; - STDMETHOD(ResetToolbar)(THIS_ ULONG, ULONG) PURE; -}; - - - -EXTERN_C const IID IID_IExchExtPropertySheets; -#undef INTERFACE -#define INTERFACE IExchExtPropertySheets -DECLARE_INTERFACE_(IExchExtPropertySheets, IUnknown) -{ - /*** IUnknown methods. ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE; - STDMETHOD_(ULONG, AddRef)(THIS) PURE; - STDMETHOD_(ULONG, Release)(THIS) PURE; - - /*** IExchExtPropertySheet methods. ***/ - STDMETHOD_(ULONG, GetMaxPageCount)(THIS_ ULONG) PURE; - STDMETHOD(GetPages)(THIS_ LPEXCHEXTCALLBACK, ULONG, - LPPROPSHEETPAGE, ULONG*) PURE; - STDMETHOD_(void, FreePages)(THIS_ LPPROPSHEETPAGE, ULONG, ULONG) PURE; -}; - - - -EXTERN_C const IID IID_IExchExtCallback; -#undef INTERFACE -#define INTERFACE IExchExtCallback -DECLARE_INTERFACE_(IExchExtCallback, IUnknown) -{ - /*** IUnknown methods. ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE; - STDMETHOD_(ULONG, AddRef)(THIS) PURE; - STDMETHOD_(ULONG, Release)(THIS) PURE; - - /*** IExchExtCallback methods. ***/ - STDMETHOD(GetVersion)(THIS_ ULONG*, ULONG) PURE; - STDMETHOD(GetWindow)(THIS_ HWND*) PURE; - STDMETHOD(GetMenu)(THIS_ HMENU*) PURE; - STDMETHOD(GetToolbar)(THIS_ ULONG, HWND*) PURE; - STDMETHOD(GetSession)(THIS_ LPMAPISESSION*, LPADRBOOK*) PURE; - STDMETHOD(GetObject)(THIS_ LPMDB*, LPMAPIPROP*) PURE; - STDMETHOD(GetSelectionCount)(THIS_ ULONG*) PURE; - STDMETHOD(GetSelectionItem)(THIS_ ULONG, ULONG*, LPENTRYID*, ULONG*, - LPTSTR, ULONG, ULONG*, ULONG) PURE; - STDMETHOD(GetMenuPos)(THIS_ ULONG, HMENU*, ULONG*, ULONG*, ULONG) PURE; - STDMETHOD(GetSharedExtsDir)(THIS_ LPTSTR, ULONG, ULONG) PURE; - STDMETHOD(GetRecipients)(THIS_ LPADRLIST*) PURE; - STDMETHOD(SetRecipients)(THIS_ LPADRLIST) PURE; - STDMETHOD(GetNewMessageSite)(THIS_ ULONG, LPMAPIFOLDER, LPPERSISTMESSAGE, - LPMESSAGE*, LPMAPIMESSAGESITE*, - LPMAPIVIEWCONTEXT*, ULONG) PURE; - STDMETHOD(RegisterModeless)(THIS_ LPEXCHEXTMODELESS, - LPEXCHEXTMODELESSCALLBACK*) PURE; - STDMETHOD(ChooseFolder)(THIS_ LPEXCHEXTCHOOSEFOLDER) PURE; -}; - - - -EXTERN_C const IID IID_IOutlookExtCallback; -#undef INTERFACE -#define INTERFACE IOutlookExtCallback -DECLARE_INTERFACE_(IOutlookExtCallback, IUnknown) -{ - /*** IUnknown methods. ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE; - STDMETHOD_(ULONG, AddRef)(THIS) PURE; - STDMETHOD_(ULONG, Release)(THIS) PURE; - - /*** IOutlookExtCallback. **/ - STDMETHOD(GetObject)(LPUNKNOWN *ppunk); - STDMETHOD(GetOfficeCharacter)(void **ppmsotfc); -}; - - - -#ifdef __cplusplus -} -#endif -#endif /*EXCHEXT_H*/ +/* myexchext.h - Simple replacement for exchext.h + + * This file defines the interface used by Exchange extensions. It + * has been compiled by g10 Code GmbH from several sources describing + * the interface. + * + * Revisions: + * 2005-08-12 Initial version. + * 2005-09-18 Add IExchExtAttachedFileEvents. + * + */ + +#ifndef EXCHEXT_H +#define EXCHEXT_H + +#ifdef __cplusplus +extern "C" { +#if 0 +} +#endif +#endif + +#include +#include +#include "mymapi.h" + + +/* Constants used by Install. */ +#define EECONTEXT_SESSION 0x00000001 +#define EECONTEXT_VIEWER 0x00000002 +#define EECONTEXT_REMOTEVIEWER 0x00000003 +#define EECONTEXT_SEARCHVIEWER 0x00000004 +#define EECONTEXT_ADDRBOOK 0x00000005 +#define EECONTEXT_SENDNOTEMESSAGE 0x00000006 +#define EECONTEXT_READNOTEMESSAGE 0x00000007 +#define EECONTEXT_SENDPOSTMESSAGE 0x00000008 +#define EECONTEXT_READPOSTMESSAGE 0x00000009 +#define EECONTEXT_READREPORTMESSAGE 0x0000000A +#define EECONTEXT_SENDRESENDMESSAGE 0x0000000B +#define EECONTEXT_PROPERTYSHEETS 0x0000000C +#define EECONTEXT_ADVANCEDCRITERIA 0x0000000D +#define EECONTEXT_TASK 0x0000000E + +/* Constants for GetVersion. */ +#define EECBGV_GETBUILDVERSION 0x00000001 +#define EECBGV_GETACTUALVERSION 0x00000002 +#define EECBGV_GETVIRTUALVERSION 0x00000004 +#define EECBGV_BUILDVERSION_MAJOR 0x000d0000 +#define EECBGV_BUILDVERSION_MAJOR_MASK 0xffff0000 +#define EECBGV_BUILDVERSION_MINOR_MASK 0x0000ffff + +/* Some toolbar IDs. */ +#define EETBID_STANDARD 0x00000001 + +/* Constants use for QueryHelpText. */ +#define EECQHT_STATUS 0x00000001 +#define EECQHT_TOOLTIP 0x00000002 + +/* Flags use by the methods of IExchExtPropertySheets. */ +#define EEPS_MESSAGE 0x00000001 +#define EEPS_FOLDER 0x00000002 +#define EEPS_STORE 0x00000003 +#define EEPS_TOOLSOPTIONS 0x00000004 + +/* Flags used by OnFooComplete. */ +#define EEME_FAILED 0x00000001 +#define EEME_COMPLETE_FAILED 0x00000002 + + +/* Command IDs. */ +#define EECMDID_ToolsCustomizeToolbar 134 +#define EECMDID_ToolsOptions 136 + + +/* GUIDs */ +DEFINE_GUID(GUID_NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + +DEFINE_OLEGUID(IID_IUnknown, 0x00000000, 0, 0); +DEFINE_OLEGUID(IID_IDispatch, 0x00020400, 0, 0); + +DEFINE_OLEGUID(IID_IExchExtCallback, 0x00020d10, 0, 0); +DEFINE_OLEGUID(IID_IExchExt, 0x00020d11, 0, 0); +DEFINE_OLEGUID(IID_IExchExtCommands, 0x00020d12, 0, 0); +DEFINE_OLEGUID(IID_IExchExtUserEvents, 0x00020d13, 0, 0); +DEFINE_OLEGUID(IID_IExchExtSessionEvents, 0x00020d14, 0, 0); +DEFINE_OLEGUID(IID_IExchExtMessageEvents, 0x00020d15, 0, 0); +DEFINE_OLEGUID(IID_IExchExtAttachedFileEvents,0x00020d16, 0, 0); +DEFINE_OLEGUID(IID_IExchExtPropertySheets, 0x00020d17, 0, 0); +DEFINE_OLEGUID(IID_IExchExtAdvancedCriteria, 0x00020d18, 0, 0); +DEFINE_OLEGUID(IID_IExchExtModeless, 0x00020d19, 0, 0); +DEFINE_OLEGUID(IID_IExchExtModelessCallback, 0x00020d1a, 0, 0); +DEFINE_OLEGUID(IID_IOutlookExtCallback, 0x0006720d, 0, 0); + + +/* Type definitions. */ + +/* Parameters for the toolbar entries for + IExchExtCommands::InstallCommands. */ +struct TBENTRY +{ + HWND hwnd; + ULONG tbid; + ULONG ulFlags; + UINT itbbBase; +}; +typedef struct TBENTRY TBENTRY; +typedef struct TBENTRY *LPTBENTRY; + + + + + + +/**** Class declarations. ***/ +typedef struct IExchExt IExchExt; +typedef IExchExt *LPEXCHEXT; + +typedef struct IExchExtMessageEvents IExchExtMessageEvents; +typedef IExchExtMessageEvents *LPEXCHEXTMESSAGEEVENTS; + +typedef struct IExchExtCommands IExchExtCommands; +typedef IExchExtCommands *LPEXCHEXTCOMMANDS; + +typedef struct IExchExtPropertySheets IExchExtPropertySheets; +typedef IExchExtPropertySheets *LPEXCHEXTPROPERTYSHEETS; + +typedef struct IExchExtCallback IExchExtCallback; +typedef IExchExtCallback *LPEXCHEXTCALLBACK; + +typedef struct IOutlookExtCallback IOutlookExtCallback; +typedef IOutlookExtCallback *LPOUTLOOKEXTCALLBACK; + +/* The next classes are not yet defined. but if so they should go here. */ +typedef struct IExchExtModeless IExchExtModeless; +typedef IExchExtModeless *LPEXCHEXTMODELESS; +typedef struct IExchExtModelessCallback IExchExtModelessCallback; +typedef IExchExtModelessCallback *LPEXCHEXTMODELESSCALLBACK; + + + + +/*** Class declarations of classes defined elsewhere. ***/ +struct IMAPISession; +typedef struct IMAPISession *LPMAPISESSION; + +struct IAddrBook; +typedef struct IAddrBook *LPADRBOOK; + +struct IMAPIFolder; +typedef struct IMAPIFolder *LPMAPIFOLDER; + +struct IMAPIProp; +typedef struct IMAPIProp *LPMAPIPROP; + +struct IPersistMessage; +typedef struct IPersistMessage *LPPERSISTMESSAGE; + +struct IMAPIMessageSite; +typedef struct IMAPIMessageSite *LPMAPIMESSAGESITE; + +struct IMAPIViewContext; +typedef struct IMAPIViewContext *LPMAPIVIEWCONTEXT; + + + +/*** Types derived from the above class definitions. ***/ + +/* Callback used to load an extension. */ +typedef LPEXCHEXT (CALLBACK *LPFNEXCHEXTENTRY)(void); + +/* Parameters for the IExchExtCallback::ChooseFolder. */ +typedef UINT (STDAPICALLTYPE *LPEECFHOOKPROC)(HWND, UINT, WPARAM, LPARAM); + +struct EXCHEXTCHOOSEFOLDER +{ + UINT cbLength; + HWND hwnd; + LPTSTR szCaption; + LPTSTR szLabel; + LPTSTR szHelpFile; + ULONG ulHelpID; + HINSTANCE hinst; + UINT uiDlgID; + LPEECFHOOKPROC lpeecfhp; + DWORD dwHookData; + ULONG ulFlags; + LPMDB pmdb; + LPMAPIFOLDER pfld; + LPTSTR szName; + DWORD dwReserved1; + DWORD dwReserved2; + DWORD dwReserved3; +}; +typedef struct EXCHEXTCHOOSEFOLDER EXCHEXTCHOOSEFOLDER; +typedef struct EXCHEXTCHOOSEFOLDER *LPEXCHEXTCHOOSEFOLDER; + + + + +/**** Class definitions. ***/ + +EXTERN_C const IID IID_IExchExt; +#undef INTERFACE +#define INTERFACE IExchExt +DECLARE_INTERFACE_(IExchExt, IUnknown) +{ + /*** IUnknown methods. ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + /*** IExchExt methods. ***/ + STDMETHOD(Install)(THIS_ LPEXCHEXTCALLBACK, ULONG, ULONG) PURE; +}; + + + +EXTERN_C const IID IID_IExchExtMessageEvents; +#undef INTERFACE +#define INTERFACE IExchExtMessageEvents +DECLARE_INTERFACE_(IExchExtMessageEvents, IUnknown) +{ + /*** IUnknown methods. ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + /*** IExchExtMessageEvents methods. ***/ + STDMETHOD(OnRead)(THIS_ LPEXCHEXTCALLBACK) PURE; + STDMETHOD(OnReadComplete)(THIS_ LPEXCHEXTCALLBACK, ULONG) PURE; + STDMETHOD(OnWrite)(THIS_ LPEXCHEXTCALLBACK) PURE; + STDMETHOD(OnWriteComplete)(THIS_ LPEXCHEXTCALLBACK, ULONG) PURE; + STDMETHOD(OnCheckNames)(THIS_ LPEXCHEXTCALLBACK) PURE; + STDMETHOD(OnCheckNamesComplete)(THIS_ LPEXCHEXTCALLBACK, ULONG) PURE; + STDMETHOD(OnSubmit)(THIS_ LPEXCHEXTCALLBACK) PURE; + STDMETHOD_(void, OnSubmitComplete)(THIS_ LPEXCHEXTCALLBACK, ULONG) PURE; +}; + + + +EXTERN_C const IID IID_IExchExtCommands; +#undef INTERFACE +#define INTERFACE IExchExtCommands +DECLARE_INTERFACE_(IExchExtCommands, IUnknown) +{ + /*** IUnknown methods. ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + /*** IExchExtCommands methods. ***/ + STDMETHOD(InstallCommands)(THIS_ LPEXCHEXTCALLBACK, HWND, HMENU, + UINT*, LPTBENTRY, UINT, ULONG) PURE; + STDMETHOD_(void, InitMenu)(THIS_ LPEXCHEXTCALLBACK) PURE; + STDMETHOD(DoCommand)(THIS_ LPEXCHEXTCALLBACK, UINT) PURE; + STDMETHOD(Help)(THIS_ LPEXCHEXTCALLBACK, UINT) PURE; + STDMETHOD(QueryHelpText)(THIS_ UINT, ULONG, LPTSTR, UINT) PURE; + STDMETHOD(QueryButtonInfo)(THIS_ ULONG, UINT, LPTBBUTTON, + LPTSTR, UINT, ULONG) PURE; + STDMETHOD(ResetToolbar)(THIS_ ULONG, ULONG) PURE; +}; + + + +EXTERN_C const IID IID_IExchExtPropertySheets; +#undef INTERFACE +#define INTERFACE IExchExtPropertySheets +DECLARE_INTERFACE_(IExchExtPropertySheets, IUnknown) +{ + /*** IUnknown methods. ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + /*** IExchExtPropertySheet methods. ***/ + STDMETHOD_(ULONG, GetMaxPageCount)(THIS_ ULONG) PURE; + STDMETHOD(GetPages)(THIS_ LPEXCHEXTCALLBACK, ULONG, + LPPROPSHEETPAGE, ULONG*) PURE; + STDMETHOD_(void, FreePages)(THIS_ LPPROPSHEETPAGE, ULONG, ULONG) PURE; +}; + + + +EXTERN_C const IID IID_IExchExtCallback; +#undef INTERFACE +#define INTERFACE IExchExtCallback +DECLARE_INTERFACE_(IExchExtCallback, IUnknown) +{ + /*** IUnknown methods. ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + /*** IExchExtCallback methods. ***/ + STDMETHOD(GetVersion)(THIS_ ULONG*, ULONG) PURE; + STDMETHOD(GetWindow)(THIS_ HWND*) PURE; + STDMETHOD(GetMenu)(THIS_ HMENU*) PURE; + STDMETHOD(GetToolbar)(THIS_ ULONG, HWND*) PURE; + STDMETHOD(GetSession)(THIS_ LPMAPISESSION*, LPADRBOOK*) PURE; + STDMETHOD(GetObject)(THIS_ LPMDB*, LPMAPIPROP*) PURE; + STDMETHOD(GetSelectionCount)(THIS_ ULONG*) PURE; + STDMETHOD(GetSelectionItem)(THIS_ ULONG, ULONG*, LPENTRYID*, ULONG*, + LPTSTR, ULONG, ULONG*, ULONG) PURE; + STDMETHOD(GetMenuPos)(THIS_ ULONG, HMENU*, ULONG*, ULONG*, ULONG) PURE; + STDMETHOD(GetSharedExtsDir)(THIS_ LPTSTR, ULONG, ULONG) PURE; + STDMETHOD(GetRecipients)(THIS_ LPADRLIST*) PURE; + STDMETHOD(SetRecipients)(THIS_ LPADRLIST) PURE; + STDMETHOD(GetNewMessageSite)(THIS_ ULONG, LPMAPIFOLDER, LPPERSISTMESSAGE, + LPMESSAGE*, LPMAPIMESSAGESITE*, + LPMAPIVIEWCONTEXT*, ULONG) PURE; + STDMETHOD(RegisterModeless)(THIS_ LPEXCHEXTMODELESS, + LPEXCHEXTMODELESSCALLBACK*) PURE; + STDMETHOD(ChooseFolder)(THIS_ LPEXCHEXTCHOOSEFOLDER) PURE; +}; + + + +EXTERN_C const IID IID_IOutlookExtCallback; +#undef INTERFACE +#define INTERFACE IOutlookExtCallback +DECLARE_INTERFACE_(IOutlookExtCallback, IUnknown) +{ + /*** IUnknown methods. ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + /*** IOutlookExtCallback. **/ + STDMETHOD(GetObject)(LPUNKNOWN *ppunk); + STDMETHOD(GetOfficeCharacter)(void **ppmsotfc); +}; + +// Flag values for IExchExtAttachedFileEvents::OpenSzFile +#define EEAFE_OPEN (0x00000001) +#define EEAFE_PRINT (0x00000002) +#define EEAFE_QUICKVIEW (0x00000003) + +#undef INTERFACE +#define INTERFACE IExchExtAttachedFileEvents + +DECLARE_INTERFACE_(IExchExtAttachedFileEvents, IUnknown) +{ + // *** IUnknown methods *** + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * lppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // *** IExchExtAttachedFileEvents methods *** + STDMETHOD(OnReadPattFromSzFile)(THIS_ LPATTACH lpatt, LPTSTR lpszFile, + ULONG ulFlags) PURE; + STDMETHOD(OnWritePattToSzFile)(THIS_ LPATTACH lpatt, LPTSTR lpszFile, + ULONG ulFlags) PURE; + STDMETHOD(QueryDisallowOpenPatt)(THIS_ LPATTACH lpatt) PURE; + STDMETHOD(OnOpenPatt)(THIS_ LPATTACH lpatt) PURE; + STDMETHOD(OnOpenSzFile)(THIS_ LPTSTR lpszFile, ULONG ulFlags) PURE; +}; +typedef IExchExtAttachedFileEvents FAR * LPEXCHEXTATTACHEDFILEEVENTS; + +EXTERN_C const IID IID_IExchExtAttachedFileEvents; + +#ifdef __cplusplus +} +#endif + +#endif /*EXCHEXT.h*/ Modified: trunk/src/olflange-def.h =================================================================== --- trunk/src/olflange-def.h 2005-09-19 17:21:55 UTC (rev 101) +++ trunk/src/olflange-def.h 2005-09-20 11:35:31 UTC (rev 102) @@ -25,7 +25,7 @@ class CGPGExchExtMessageEvents; class CGPGExchExtCommands; class CGPGExchExtPropertySheets; -class CGPGExchApp; +class CGPGExchExtAttachedFileEvents; bool GPGOptionsDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); Modified: trunk/src/olflange.cpp =================================================================== --- trunk/src/olflange.cpp 2005-09-19 17:21:55 UTC (rev 101) +++ trunk/src/olflange.cpp 2005-09-20 11:35:31 UTC (rev 102) @@ -43,6 +43,7 @@ #include "olflange-ids.h" #include "olflange-def.h" #include "olflange.h" +#include "attach.h" #define CLSIDSTR_GPGOL "{42d30988-1a3a-11da-c687-000d6080e735}" DEFINE_GUID(CLSID_GPGOL, 0x42d30988, 0x1a3a, 0x11da, @@ -462,8 +463,9 @@ m_pExchExtMessageEvents = new CGPGExchExtMessageEvents (this); m_pExchExtCommands = new CGPGExchExtCommands (this); m_pExchExtPropertySheets = new CGPGExchExtPropertySheets (this); + m_pExchExtAttachedFileEvents = new CGPGExchExtAttachedFileEvents (this); if (!m_pExchExtMessageEvents || !m_pExchExtCommands - || !m_pExchExtPropertySheets) + || !m_pExchExtPropertySheets || !m_pExchExtAttachedFileEvents) out_of_core (); if (!g_initdll) @@ -506,35 +508,43 @@ STDMETHODIMP CGPGExchExt::QueryInterface(REFIID riid, LPVOID *ppvObj) { - HRESULT hr = S_OK; - - *ppvObj = NULL; - - if ((riid == IID_IUnknown) || (riid == IID_IExchExt)) { - *ppvObj = (LPUNKNOWN) this; + HRESULT hr = S_OK; + + *ppvObj = NULL; + + if ((riid == IID_IUnknown) || (riid == IID_IExchExt)) + { + *ppvObj = (LPUNKNOWN) this; } - else if (riid == IID_IExchExtMessageEvents) { - *ppvObj = (LPUNKNOWN) m_pExchExtMessageEvents; - m_pExchExtMessageEvents->SetContext (m_lContext); + else if (riid == IID_IExchExtMessageEvents) + { + *ppvObj = (LPUNKNOWN) m_pExchExtMessageEvents; + m_pExchExtMessageEvents->SetContext (m_lContext); } - else if (riid == IID_IExchExtCommands) { - *ppvObj = (LPUNKNOWN)m_pExchExtCommands; - m_pExchExtCommands->SetContext (m_lContext); + else if (riid == IID_IExchExtCommands) + { + *ppvObj = (LPUNKNOWN)m_pExchExtCommands; + m_pExchExtCommands->SetContext (m_lContext); } - else if (riid == IID_IExchExtPropertySheets) { - if (m_lContext != EECONTEXT_PROPERTYSHEETS) - return E_NOINTERFACE; - *ppvObj = (LPUNKNOWN) m_pExchExtPropertySheets; + else if (riid == IID_IExchExtPropertySheets) + { + if (m_lContext != EECONTEXT_PROPERTYSHEETS) + return E_NOINTERFACE; + *ppvObj = (LPUNKNOWN) m_pExchExtPropertySheets; } - else - hr = E_NOINTERFACE; - - /* On success we need to bump up the reference counter for the - requested object. */ - if (*ppvObj) - ((LPUNKNOWN)*ppvObj)->AddRef(); - - /*log_debug("QueryInterface %d\n", __LINE__);*/ + else if (riid == IID_IExchExtAttachedFileEvents) + { + *ppvObj = (LPUNKNOWN)m_pExchExtAttachedFileEvents; + } + else + hr = E_NOINTERFACE; + + /* On success we need to bump up the reference counter for the + requested object. */ + if (*ppvObj) + ((LPUNKNOWN)*ppvObj)->AddRef(); + + /*log_debug("QueryInterface %d\n", __LINE__);*/ return hr; } Modified: trunk/src/olflange.h =================================================================== --- trunk/src/olflange.h 2005-09-19 17:21:55 UTC (rev 101) +++ trunk/src/olflange.h 2005-09-20 11:35:31 UTC (rev 102) @@ -33,35 +33,36 @@ class CGPGExchExt : public IExchExt { public: - CGPGExchExt(); - virtual ~CGPGExchExt(); + CGPGExchExt(); + virtual ~CGPGExchExt(); public: - HWND m_hWndExchange; /* Handle of the exchange window. */ - /* parameter for sending mails */ - BOOL m_gpgEncrypt; - BOOL m_gpgSign; - + HWND m_hWndExchange; /* Handle of the exchange window. */ + /* parameter for sending mails */ + BOOL m_gpgEncrypt; + BOOL m_gpgSign; + private: - ULONG m_lRef; - ULONG m_lContext; + ULONG m_lRef; + ULONG m_lContext; + + /* pointer to the other extension objects */ + CGPGExchExtMessageEvents* m_pExchExtMessageEvents; + CGPGExchExtCommands* m_pExchExtCommands; + CGPGExchExtPropertySheets* m_pExchExtPropertySheets; + CGPGExchExtAttachedFileEvents *m_pExchExtAttachedFileEvents; - /* pointer to the other extension objects */ - CGPGExchExtMessageEvents* m_pExchExtMessageEvents; - CGPGExchExtCommands* m_pExchExtCommands; - CGPGExchExtPropertySheets* m_pExchExtPropertySheets; - public: - STDMETHODIMP QueryInterface(REFIID riid, LPVOID* ppvObj); - inline STDMETHODIMP_(ULONG) AddRef() { ++m_lRef; return m_lRef; }; - inline STDMETHODIMP_(ULONG) Release() + STDMETHODIMP QueryInterface(REFIID riid, LPVOID* ppvObj); + inline STDMETHODIMP_(ULONG) AddRef() { ++m_lRef; return m_lRef; }; + inline STDMETHODIMP_(ULONG) Release() { - ULONG lCount = --m_lRef; - if (!lCount) - delete this; - return lCount; + ULONG lCount = --m_lRef; + if (!lCount) + delete this; + return lCount; }; - STDMETHODIMP Install(LPEXCHEXTCALLBACK pEECB, ULONG lContext, ULONG lFlags); + STDMETHODIMP Install(LPEXCHEXTCALLBACK pEECB, ULONG lContext, ULONG lFlags); }; /* Modified: trunk/src/passphrase-dialog.c =================================================================== --- trunk/src/passphrase-dialog.c 2005-09-19 17:21:55 UTC (rev 101) +++ trunk/src/passphrase-dialog.c 2005-09-20 11:35:31 UTC (rev 102) @@ -114,14 +114,13 @@ r = rset; for (;;) { - const char *uid; err = gpgme_op_keylist_next (keyctx, &key); if (err) break; - uid = gpgme_key_get_string_attr (key, GPGME_ATTR_USERID, NULL, 0); - if (uid != NULL) + + if (key && key->uids != NULL) SendDlgItemMessage (dlg, ctlid, LB_ADDSTRING, 0, - (LPARAM)(const char *)uid); + (LPARAM)(const char *)key->uids->uid); gpgme_key_release (key); key = NULL; r = r->next; @@ -134,58 +133,80 @@ } +const char* +get_pubkey_algo_str (gpgme_pubkey_algo_t alg) +{ + + switch (alg) + { + case GPGME_PK_RSA: + case GPGME_PK_RSA_E: + case GPGME_PK_RSA_S: + return "RSA"; + + case GPGME_PK_ELG_E: + return "ELG"; + + default: + break; + } + + return "???"; +} + + static void load_secbox (HWND dlg, int ctlid) { - gpgme_key_t sk; - size_t n=0, doloop=1; - void *ctx=NULL; + gpgme_key_t sk; + size_t n=0, doloop=1; + void *ctx=NULL; + + enum_gpg_seckeys (NULL, &ctx); + while (doloop) + { + const char *name, *email, *keyid, *algo; + char *p; + + if (enum_gpg_seckeys (&sk, &ctx)) + doloop = 0; + + if (sk->revoked || sk->expired || sk->disabled || sk->invalid) + continue; + if (!sk->uids) + continue; - enum_gpg_seckeys (NULL, &ctx); - while (doloop) { - const char *name, *email, *keyid, *algo; - char *p; - - if (enum_gpg_seckeys (&sk, &ctx)) - doloop = 0; - - if (gpgme_key_get_ulong_attr (sk, GPGME_ATTR_KEY_REVOKED, NULL, 0) || - gpgme_key_get_ulong_attr (sk, GPGME_ATTR_KEY_EXPIRED, NULL, 0) || - gpgme_key_get_ulong_attr (sk, GPGME_ATTR_KEY_INVALID, NULL, 0)) - continue; - - name = gpgme_key_get_string_attr (sk, GPGME_ATTR_NAME, NULL, 0); - email = gpgme_key_get_string_attr (sk, GPGME_ATTR_EMAIL, NULL, 0); - keyid = gpgme_key_get_string_attr (sk, GPGME_ATTR_KEYID, NULL, 0); - algo = gpgme_key_get_string_attr (sk, GPGME_ATTR_ALGO, NULL, 0); - if (!email) - email = ""; - p = (char *)xcalloc (1, strlen (name) + strlen (email) + 17 + 32); - if (email && strlen (email)) - sprintf (p, "%s <%s> (0x%s, %s)", name, email, keyid+8, algo); - else - sprintf (p, "%s (0x%s, %s)", name, keyid+8, algo); - SendDlgItemMessage (dlg, ctlid, CB_ADDSTRING, 0, - (LPARAM)(const char *) p); - xfree (p); + name = sk->uids->name; + email = sk->uids->email; + keyid = sk->subkeys->keyid; + algo = get_pubkey_algo_str (sk->subkeys->pubkey_algo); + if (!email) + email = ""; + p = (char *)xcalloc (1, strlen (name) + strlen (email) + 17 + 32); + if (email && strlen (email)) + sprintf (p, "%s <%s> (0x%s, %s)", name, email, keyid+8, algo); + else + sprintf (p, "%s (0x%s, %s)", name, keyid+8, algo); + SendDlgItemMessage (dlg, ctlid, CB_ADDSTRING, 0, + (LPARAM)(const char *) p); + xfree (p); } - - ctx = NULL; - reset_gpg_seckeys (&ctx); - doloop = 1; - n = 0; - while (doloop) { - if (enum_gpg_seckeys (&sk, &ctx)) - doloop = 0; - if (gpgme_key_get_ulong_attr (sk, GPGME_ATTR_KEY_REVOKED, NULL, 0) || - gpgme_key_get_ulong_attr (sk, GPGME_ATTR_KEY_EXPIRED, NULL, 0) || - gpgme_key_get_ulong_attr (sk, GPGME_ATTR_KEY_INVALID, NULL, 0)) - continue; - SendDlgItemMessage (dlg, ctlid, CB_SETITEMDATA, n, (LPARAM)(DWORD)sk); - n++; + + ctx = NULL; + reset_gpg_seckeys (&ctx); + doloop = 1; + n = 0; + while (doloop) + { + if (enum_gpg_seckeys (&sk, &ctx)) + doloop = 0; + if (sk->revoked || sk->expired || sk->invalid || sk->disabled) + continue; + SendDlgItemMessage (dlg, ctlid, CB_SETITEMDATA, n, (LPARAM)(DWORD)sk); + n++; } - SendDlgItemMessage (dlg, ctlid, CB_SETCURSEL, 0, 0); - reset_gpg_seckeys (&ctx); + SendDlgItemMessage (dlg, ctlid, CB_SETCURSEL, 0, 0); + reset_gpg_seckeys (&ctx); } Modified: trunk/src/recipient-dialog.c =================================================================== --- trunk/src/recipient-dialog.c 2005-09-19 17:21:55 UTC (rev 101) +++ trunk/src/recipient-dialog.c 2005-09-20 11:35:31 UTC (rev 102) @@ -27,6 +27,7 @@ #include "gpgol-ids.h" #include "keycache.h" #include "intern.h" +#include "util.h" struct recipient_cb_s { char **unknown_keys; @@ -84,65 +85,69 @@ static void load_rsetbox (HWND hwnd) { - - LVITEM lvi; - DWORD val; - char keybuf[128]; - const char * s; - const char * trust_items[] = { - "UNKNOWN", + LVITEM lvi; + gpgme_key_t key = NULL; + void *ctx = NULL; + char keybuf[128], *s; + const char * trust_items[] = + { + "UNKNOWN", "UNDEFINED", "NEVER", "MARGINAL", "FULL", - "ULTIMATE" + "ULTIMATE" }; - void *ctx=NULL; - size_t doloop=1; - gpgme_key_t key=NULL; + enum {COL_NAME, COL_EMAIL, COL_KEYINF, COL_KEYID, COL_TRUST}; + DWORD val; + size_t doloop=1; - memset (&lvi, 0, sizeof (lvi)); - cleanup_keycache_objects (); /*XXX: rewrite the entire key cache! */ - enum_gpg_keys (NULL, &ctx); - while (doloop) { - if (enum_gpg_keys(&key, &ctx)) - doloop = 0; - if (!gpgme_key_get_ulong_attr (key, GPGME_ATTR_CAN_ENCRYPT, NULL, 0)) - continue; - /* check that the primary key is *not* revoked, expired or invalid */ - if (gpgme_key_get_ulong_attr (key, GPGME_ATTR_KEY_REVOKED, NULL, 0) - || gpgme_key_get_ulong_attr (key, GPGME_ATTR_KEY_EXPIRED, NULL, 0) - || gpgme_key_get_ulong_attr (key, GPGME_ATTR_KEY_INVALID, NULL, 0)) - continue; - ListView_InsertItem (hwnd, &lvi); + memset (&lvi, 0, sizeof (lvi)); + cleanup_keycache_objects (); /*XXX: rewrite the entire key cache! */ + enum_gpg_keys (NULL, &ctx); + while (doloop) + { + if (enum_gpg_keys(&key, &ctx)) + doloop = 0; + if (!key->subkeys->can_encrypt) + continue; + + /* check that the primary key is *not* revoked, expired or invalid */ + if (key->revoked || key->expired || key->invalid || key->disabled) + continue; + if (!key->uids) + continue; + ListView_InsertItem (hwnd, &lvi); + + s = key->uids->name; + ListView_SetItemText (hwnd, 0, COL_NAME, s); + + s = key->uids->email; + ListView_SetItemText (hwnd, 0, COL_EMAIL, s); + + s = (char*)get_pubkey_algo_str (key->subkeys->pubkey_algo); + sprintf (keybuf, "%s", s); + if (key->subkeys->next) + { + s = (char*)get_pubkey_algo_str (key->subkeys->next->pubkey_algo); + sprintf (keybuf+strlen (keybuf), "/%s", s); + } + strcat (keybuf, " "); + if (key->subkeys->next) + sprintf (keybuf+strlen (keybuf), "%d", key->subkeys->next->length); + else + sprintf (keybuf+strlen (keybuf), "%d", key->subkeys->length); - s = gpgme_key_get_string_attr( key, GPGME_ATTR_NAME, NULL, 0 ); - ListView_SetItemText( hwnd, 0, 0, (char *)s ); - - s = gpgme_key_get_string_attr( key, GPGME_ATTR_EMAIL, NULL, 0 ); - ListView_SetItemText( hwnd, 0, 1, (char *)s ); - - s = gpgme_key_get_string_attr( key, GPGME_ATTR_ALGO, NULL, 0 ); - sprintf( keybuf, "%s", s ); - if( (s = gpgme_key_get_string_attr( key, GPGME_ATTR_ALGO, NULL, 1 )) ) - sprintf( keybuf+strlen( keybuf ), "/%s", s ); - strcat( keybuf, " " ); - if( (val = gpgme_key_get_ulong_attr( key, GPGME_ATTR_LEN, NULL, 1 )) ) - sprintf( keybuf+strlen( keybuf ), "%ld", val ); - else { - val = gpgme_key_get_ulong_attr( key, GPGME_ATTR_LEN, NULL, 0 ); - sprintf( keybuf+strlen( keybuf ), "%ld", val ); - } - s = keybuf; - ListView_SetItemText( hwnd, 0, 2, (char *) s ); - - s = gpgme_key_get_string_attr( key, GPGME_ATTR_KEYID, NULL, 0 ) + 8; - ListView_SetItemText( hwnd, 0, 3, (char *)s ); - - val = gpgme_key_get_ulong_attr (key, GPGME_ATTR_VALIDITY, NULL, 0); - if (val < 0 || val > 5) val = 0; - s = (char *)trust_items[val]; - ListView_SetItemText (hwnd, 0, 4, (char *)s); + s = keybuf; + ListView_SetItemText (hwnd, 0, COL_KEYINF, s); + + ListView_SetItemText( hwnd, 0, COL_KEYID, key->subkeys->keyid+8); + + val = key->uids->validity; + if (val < 0 || val > 5) + val = 0; + s = (char *)trust_items[val]; + ListView_SetItemText (hwnd, 0, COL_TRUST, s); } } @@ -365,39 +370,43 @@ recipient_dialog_box2 (gpgme_key_t *fnd, char **unknown, size_t n, gpgme_key_t **ret_rset, int *ret_opts) { - struct recipient_cb_s *cb; - int i; - - cb = xcalloc (1, sizeof (struct recipient_cb_s)); - cb->n = n; - cb->fnd_keys = xcalloc (n+1, sizeof (char*)); - for (i = 0; i < (int)n; i++) { - const char *name; - if (fnd[i] == NULL) { - cb->fnd_keys[i] = xstrdup ("User-ID not found"); - continue; - } - name = gpgme_key_get_string_attr (fnd[i], GPGME_ATTR_NAME, NULL, 0); - if (!name) - name = "User-ID not found"; - cb->fnd_keys[i] = xstrdup (name); + struct recipient_cb_s *cb; + int i; + + cb = xcalloc (1, sizeof (struct recipient_cb_s)); + cb->n = n; + cb->fnd_keys = xcalloc (n+1, sizeof (char*)); + for (i = 0; i < (int)n; i++) + { + const char *name; + if (fnd[i] == NULL) { + cb->fnd_keys[i] = xstrdup (_("User-ID not found")); + continue; + } + name = fnd[i]->uids->uid; + if (!name) + name = _("User-ID not found"); + cb->fnd_keys[i] = xstrdup (name); } - cb->unknown_keys = unknown; - DialogBoxParam (glob_hinst, (LPCTSTR)IDD_ENC, GetDesktopWindow (), - recipient_dlg_proc, (LPARAM)cb); - if (cb->opts & OPT_FLAG_CANCEL) { - *ret_opts = cb->opts; - *ret_rset = NULL; + cb->unknown_keys = unknown; + DialogBoxParam (glob_hinst, (LPCTSTR)IDD_ENC, GetDesktopWindow (), + recipient_dlg_proc, (LPARAM)cb); + if (cb->opts & OPT_FLAG_CANCEL) + { + *ret_opts = cb->opts; + *ret_rset = NULL; } - else { - *ret_rset = keycache_to_key_array (cb->rset); - keycache_free (cb->rset); + else + { + *ret_rset = keycache_to_key_array (cb->rset); + keycache_free (cb->rset); } - for (i = 0; i < (int)n; i++) { - xfree (cb->fnd_keys[i]); - cb->fnd_keys[i] = NULL; + for (i = 0; i < (int)n; i++) + { + xfree (cb->fnd_keys[i]); + cb->fnd_keys[i] = NULL; } - xfree (cb->fnd_keys); - xfree (cb); - return 0; + xfree (cb->fnd_keys); + xfree (cb); + return 0; } Modified: trunk/src/rfc822parse.c =================================================================== --- trunk/src/rfc822parse.c 2005-09-19 17:21:55 UTC (rev 101) +++ trunk/src/rfc822parse.c 2005-09-20 11:35:31 UTC (rev 102) @@ -155,7 +155,6 @@ *name = *name - 'A' + 'a'; } - static char * stpcpy (char *a,const char *b) { @@ -166,7 +165,6 @@ return (char*)a; } - /* If a callback has been registerd, call it for the event of type EVENT. */ static int Modified: trunk/src/verify-dialog.c =================================================================== --- trunk/src/verify-dialog.c 2005-09-19 17:21:55 UTC (rev 101) +++ trunk/src/verify-dialog.c 2005-09-20 11:35:31 UTC (rev 102) @@ -28,6 +28,7 @@ #include "gpgol-ids.h" #include "keycache.h" #include "intern.h" +#include "util.h" struct dialog_context { @@ -76,95 +77,96 @@ static void load_sigbox (HWND dlg, gpgme_verify_result_t ctx) { - gpgme_key_t key; - char *s, buf[2+16+1]; - char *p; - int stat; - int valid, no_key = 0, n = 0; - - s = get_timestamp (ctx->signatures->timestamp); - SetDlgItemText (dlg, IDC_VRY_TIME, s); - - s = ctx->signatures->fpr; - if (strlen (s) == 40) - strncpy (buf+2, s+40-8, 8); - else if (strlen (s) == 32) /* MD5:RSAv3 */ - strncpy (buf+2, s+32-8, 8); - else - strncpy (buf+2, s+8, 8); - buf[10] = 0; - buf[0] = '0'; - buf[1] = 'x'; - SetDlgItemText (dlg, IDC_VRY_KEYID, buf); - /*key = find_gpg_key (buf+2, 0);*/ - key = get_gpg_key (buf+2); - - stat = ctx->signatures->summary; - if (stat & GPGME_SIGSUM_GREEN) - s = "Good signature"; - else if (stat & GPGME_SIGSUM_RED) - s = "BAD signature!"; - else if (stat & GPGME_SIGSUM_KEY_REVOKED) - s = "Good signature from revoked key"; - else if (stat & GPGME_SIGSUM_KEY_EXPIRED) - s = "Good signature from expired key"; - else if (stat & GPGME_SIGSUM_SIG_EXPIRED) - s = "Good expired signature"; - else if (stat & GPGME_SIGSUM_KEY_MISSING) { - s = "Could not check signature: missing key"; - no_key = 1; + gpgme_key_t key; + char *s, buf[2+16+1]; + char *p; + int stat; + int valid, no_key = 0, n = 0; + + s = get_timestamp (ctx->signatures->timestamp); + SetDlgItemText (dlg, IDC_VRY_TIME, s); + + s = ctx->signatures->fpr; + if (strlen (s) == 40) + strncpy (buf+2, s+40-8, 8); + else if (strlen (s) == 32) /* MD5:RSAv3 */ + strncpy (buf+2, s+32-8, 8); + else + strncpy (buf+2, s+8, 8); + buf[10] = 0; + buf[0] = '0'; + buf[1] = 'x'; + SetDlgItemText (dlg, IDC_VRY_KEYID, buf); + key = get_gpg_key (buf+2); + + stat = ctx->signatures->summary; + if (stat & GPGME_SIGSUM_GREEN) + s = _("Good signature"); + else if (stat & GPGME_SIGSUM_RED) + s = _("BAD signature!"); + else if (stat & GPGME_SIGSUM_KEY_REVOKED) + s = _("Good signature from revoked key"); + else if (stat & GPGME_SIGSUM_KEY_EXPIRED) + s = _("Good signature from expired key"); + else if (stat & GPGME_SIGSUM_SIG_EXPIRED) + s = _("Good expired signature"); + else if (stat & GPGME_SIGSUM_KEY_MISSING) + { + s = _("Could not check signature: missing key"); + no_key = 1; } - else - s = "Verification error"; - /* XXX: if we have a key we do _NOT_ trust, stat is 'wrong' */ - SetDlgItemText (dlg, IDC_VRY_STATUS, s); - - if (key) { - s = (char*)gpgme_key_get_string_attr (key, GPGME_ATTR_USERID, NULL, 0); - SetDlgItemText (dlg, IDC_VRY_ISSUER, s); - - n = load_akalist (dlg, key); - gpgme_key_release (key); - if (n == 0) - EnableWindow (GetDlgItem (dlg, IDC_VRY_AKALIST), FALSE); + else + s = _("Verification error"); + /* XXX: if we have a key we do _NOT_ trust, stat is 'wrong' */ + SetDlgItemText (dlg, IDC_VRY_STATUS, s); + + if (key && key->uids) + { + s = key->uids->uid; + SetDlgItemText (dlg, IDC_VRY_ISSUER, s); + + n = load_akalist (dlg, key); + gpgme_key_release (key); + if (n == 0) + EnableWindow (GetDlgItem (dlg, IDC_VRY_AKALIST), FALSE); } - else { - s = "User-ID not found"; - SetDlgItemText (dlg, IDC_VRY_ISSUER, s); + else + { + s = _("User-ID not found"); + SetDlgItemText (dlg, IDC_VRY_ISSUER, s); } - - switch (ctx->signatures->pubkey_algo) { - case GPGME_PK_RSA: s = "RSA"; break; - case GPGME_PK_DSA: s = "DSA"; break; - default: s = "???"; break; + + s = (char *)get_pubkey_algo_str (ctx->signatures->pubkey_algo); + SetDlgItemText (dlg, IDC_VRY_PKALGO, s); + + valid = ctx->signatures->validity; + if (stat & GPGME_SIGSUM_SIG_EXPIRED) + { + char *fmt; + + fmt = "Signature expired on %s"; + s = get_timestamp (ctx->signatures->exp_timestamp); + p = xmalloc (strlen (s)+1+strlen (fmt)+2); + sprintf (p, fmt, s); + SetDlgItemText (dlg, IDC_VRY_HINT, s); + xfree (p); } - SetDlgItemText (dlg, IDC_VRY_PKALGO, s); - - valid = ctx->signatures->validity; - if (stat & GPGME_SIGSUM_SIG_EXPIRED) { - char *fmt; - - fmt = "Signature expired on %s"; - s = get_timestamp (ctx->signatures->exp_timestamp); - p = xmalloc (strlen (s)+1+strlen (fmt)+2); - sprintf (p, fmt, s); - SetDlgItemText (dlg, IDC_VRY_HINT, s); - xfree (p); - } - else if (valid < GPGME_VALIDITY_MARGINAL) { - switch (valid) { + else if (valid < GPGME_VALIDITY_MARGINAL) + { + switch (valid) + { case GPGME_VALIDITY_NEVER: - s = "Signature issued by a key we do NOT trust."; - break; - + s = "Signature issued by a key we do NOT trust."; + break; + default: - if (no_key) - s = ""; - else - s = "Signature issued by a non-valid key."; - break; + if (no_key) + s = ""; + else + s = "Signature issued by a non-valid key."; + break; } - SetDlgItemText (dlg, IDC_VRY_HINT, s); + SetDlgItemText (dlg, IDC_VRY_HINT, s); } } Modified: trunk/src/watcher.cpp =================================================================== --- trunk/src/watcher.cpp 2005-09-19 17:21:55 UTC (rev 101) +++ trunk/src/watcher.cpp 2005-09-20 11:35:31 UTC (rev 102) @@ -20,7 +20,6 @@ */ #include - #include #include #include @@ -81,6 +80,7 @@ } +/* Decrypt a single message. */ static void decrypt_message (HWND hwnd, LPMESSAGE msg) { @@ -92,9 +92,19 @@ msg = NULL; } - -/* XXX: describe what we are doing here! */ - +/* This hook procedure allows to monitor all windows which are created + * and/or activated. + * We use it to find the new opened message window and start automatically + * the decryption code. The pre-condition is, that the new window has the + * proper window class and a child window with valid OpenPGP data. + * + * We cannot use the HCBT_CREATEWND alone because at the point the hook + * procedure is called, the window is only about to be created but the + * procedure has not finished yet. Plus the child windows are not yet + * created. Thus we check if the new window has the proper class. If + * this window is then activated, we call the decryption code and reset + * the window handle so the decryption is only called once. + */ static LRESULT CALLBACK cbt_proc (int code, WPARAM w, LPARAM l) { From cvs at cvs.gnupg.org Wed Sep 21 08:40:52 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed Sep 21 08:13:33 2005 Subject: [svn] GPGol - r103 - trunk/src Message-ID: Author: wk Date: 2005-09-21 08:40:51 +0200 (Wed, 21 Sep 2005) New Revision: 103 Modified: trunk/src/attach.h trunk/src/display.h trunk/src/gpgmsg.hh trunk/src/msgcache.h trunk/src/myexchext.h trunk/src/mymapi.h trunk/src/mymapitags.h trunk/src/olflange-def.h trunk/src/passcache.h trunk/src/pgpmime.h trunk/src/rfc822parse.h trunk/src/util.h Log: Fixed line ending issues. Property changes on: trunk/src/attach.h ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/src/display.h ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/src/gpgmsg.hh ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/src/msgcache.h ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/src/myexchext.h =================================================================== --- trunk/src/myexchext.h 2005-09-20 11:35:31 UTC (rev 102) +++ trunk/src/myexchext.h 2005-09-21 06:40:51 UTC (rev 103) @@ -1,365 +1,365 @@ -/* myexchext.h - Simple replacement for exchext.h - - * This file defines the interface used by Exchange extensions. It - * has been compiled by g10 Code GmbH from several sources describing - * the interface. - * - * Revisions: - * 2005-08-12 Initial version. - * 2005-09-18 Add IExchExtAttachedFileEvents. - * - */ - -#ifndef EXCHEXT_H -#define EXCHEXT_H - -#ifdef __cplusplus -extern "C" { -#if 0 -} -#endif -#endif - -#include -#include -#include "mymapi.h" - - -/* Constants used by Install. */ -#define EECONTEXT_SESSION 0x00000001 -#define EECONTEXT_VIEWER 0x00000002 -#define EECONTEXT_REMOTEVIEWER 0x00000003 -#define EECONTEXT_SEARCHVIEWER 0x00000004 -#define EECONTEXT_ADDRBOOK 0x00000005 -#define EECONTEXT_SENDNOTEMESSAGE 0x00000006 -#define EECONTEXT_READNOTEMESSAGE 0x00000007 -#define EECONTEXT_SENDPOSTMESSAGE 0x00000008 -#define EECONTEXT_READPOSTMESSAGE 0x00000009 -#define EECONTEXT_READREPORTMESSAGE 0x0000000A -#define EECONTEXT_SENDRESENDMESSAGE 0x0000000B -#define EECONTEXT_PROPERTYSHEETS 0x0000000C -#define EECONTEXT_ADVANCEDCRITERIA 0x0000000D -#define EECONTEXT_TASK 0x0000000E - -/* Constants for GetVersion. */ -#define EECBGV_GETBUILDVERSION 0x00000001 -#define EECBGV_GETACTUALVERSION 0x00000002 -#define EECBGV_GETVIRTUALVERSION 0x00000004 -#define EECBGV_BUILDVERSION_MAJOR 0x000d0000 -#define EECBGV_BUILDVERSION_MAJOR_MASK 0xffff0000 -#define EECBGV_BUILDVERSION_MINOR_MASK 0x0000ffff - -/* Some toolbar IDs. */ -#define EETBID_STANDARD 0x00000001 - -/* Constants use for QueryHelpText. */ -#define EECQHT_STATUS 0x00000001 -#define EECQHT_TOOLTIP 0x00000002 - -/* Flags use by the methods of IExchExtPropertySheets. */ -#define EEPS_MESSAGE 0x00000001 -#define EEPS_FOLDER 0x00000002 -#define EEPS_STORE 0x00000003 -#define EEPS_TOOLSOPTIONS 0x00000004 - -/* Flags used by OnFooComplete. */ -#define EEME_FAILED 0x00000001 -#define EEME_COMPLETE_FAILED 0x00000002 - - -/* Command IDs. */ -#define EECMDID_ToolsCustomizeToolbar 134 -#define EECMDID_ToolsOptions 136 - - -/* GUIDs */ -DEFINE_GUID(GUID_NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - -DEFINE_OLEGUID(IID_IUnknown, 0x00000000, 0, 0); -DEFINE_OLEGUID(IID_IDispatch, 0x00020400, 0, 0); - -DEFINE_OLEGUID(IID_IExchExtCallback, 0x00020d10, 0, 0); -DEFINE_OLEGUID(IID_IExchExt, 0x00020d11, 0, 0); -DEFINE_OLEGUID(IID_IExchExtCommands, 0x00020d12, 0, 0); -DEFINE_OLEGUID(IID_IExchExtUserEvents, 0x00020d13, 0, 0); -DEFINE_OLEGUID(IID_IExchExtSessionEvents, 0x00020d14, 0, 0); -DEFINE_OLEGUID(IID_IExchExtMessageEvents, 0x00020d15, 0, 0); -DEFINE_OLEGUID(IID_IExchExtAttachedFileEvents,0x00020d16, 0, 0); -DEFINE_OLEGUID(IID_IExchExtPropertySheets, 0x00020d17, 0, 0); -DEFINE_OLEGUID(IID_IExchExtAdvancedCriteria, 0x00020d18, 0, 0); -DEFINE_OLEGUID(IID_IExchExtModeless, 0x00020d19, 0, 0); -DEFINE_OLEGUID(IID_IExchExtModelessCallback, 0x00020d1a, 0, 0); -DEFINE_OLEGUID(IID_IOutlookExtCallback, 0x0006720d, 0, 0); - - -/* Type definitions. */ - -/* Parameters for the toolbar entries for - IExchExtCommands::InstallCommands. */ -struct TBENTRY -{ - HWND hwnd; - ULONG tbid; - ULONG ulFlags; - UINT itbbBase; -}; -typedef struct TBENTRY TBENTRY; -typedef struct TBENTRY *LPTBENTRY; - - - - - - -/**** Class declarations. ***/ -typedef struct IExchExt IExchExt; -typedef IExchExt *LPEXCHEXT; - -typedef struct IExchExtMessageEvents IExchExtMessageEvents; -typedef IExchExtMessageEvents *LPEXCHEXTMESSAGEEVENTS; - -typedef struct IExchExtCommands IExchExtCommands; -typedef IExchExtCommands *LPEXCHEXTCOMMANDS; - -typedef struct IExchExtPropertySheets IExchExtPropertySheets; -typedef IExchExtPropertySheets *LPEXCHEXTPROPERTYSHEETS; - -typedef struct IExchExtCallback IExchExtCallback; -typedef IExchExtCallback *LPEXCHEXTCALLBACK; - -typedef struct IOutlookExtCallback IOutlookExtCallback; -typedef IOutlookExtCallback *LPOUTLOOKEXTCALLBACK; - -/* The next classes are not yet defined. but if so they should go here. */ -typedef struct IExchExtModeless IExchExtModeless; -typedef IExchExtModeless *LPEXCHEXTMODELESS; -typedef struct IExchExtModelessCallback IExchExtModelessCallback; -typedef IExchExtModelessCallback *LPEXCHEXTMODELESSCALLBACK; - - - - -/*** Class declarations of classes defined elsewhere. ***/ -struct IMAPISession; -typedef struct IMAPISession *LPMAPISESSION; - -struct IAddrBook; -typedef struct IAddrBook *LPADRBOOK; - -struct IMAPIFolder; -typedef struct IMAPIFolder *LPMAPIFOLDER; - -struct IMAPIProp; -typedef struct IMAPIProp *LPMAPIPROP; - -struct IPersistMessage; -typedef struct IPersistMessage *LPPERSISTMESSAGE; - -struct IMAPIMessageSite; -typedef struct IMAPIMessageSite *LPMAPIMESSAGESITE; - -struct IMAPIViewContext; -typedef struct IMAPIViewContext *LPMAPIVIEWCONTEXT; - - - -/*** Types derived from the above class definitions. ***/ - -/* Callback used to load an extension. */ -typedef LPEXCHEXT (CALLBACK *LPFNEXCHEXTENTRY)(void); - -/* Parameters for the IExchExtCallback::ChooseFolder. */ -typedef UINT (STDAPICALLTYPE *LPEECFHOOKPROC)(HWND, UINT, WPARAM, LPARAM); - -struct EXCHEXTCHOOSEFOLDER -{ - UINT cbLength; - HWND hwnd; - LPTSTR szCaption; - LPTSTR szLabel; - LPTSTR szHelpFile; - ULONG ulHelpID; - HINSTANCE hinst; - UINT uiDlgID; - LPEECFHOOKPROC lpeecfhp; - DWORD dwHookData; - ULONG ulFlags; - LPMDB pmdb; - LPMAPIFOLDER pfld; - LPTSTR szName; - DWORD dwReserved1; - DWORD dwReserved2; - DWORD dwReserved3; -}; -typedef struct EXCHEXTCHOOSEFOLDER EXCHEXTCHOOSEFOLDER; -typedef struct EXCHEXTCHOOSEFOLDER *LPEXCHEXTCHOOSEFOLDER; - - - - -/**** Class definitions. ***/ - -EXTERN_C const IID IID_IExchExt; -#undef INTERFACE -#define INTERFACE IExchExt -DECLARE_INTERFACE_(IExchExt, IUnknown) -{ - /*** IUnknown methods. ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE; - STDMETHOD_(ULONG, AddRef)(THIS) PURE; - STDMETHOD_(ULONG, Release)(THIS) PURE; - - /*** IExchExt methods. ***/ - STDMETHOD(Install)(THIS_ LPEXCHEXTCALLBACK, ULONG, ULONG) PURE; -}; - - - -EXTERN_C const IID IID_IExchExtMessageEvents; -#undef INTERFACE -#define INTERFACE IExchExtMessageEvents -DECLARE_INTERFACE_(IExchExtMessageEvents, IUnknown) -{ - /*** IUnknown methods. ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE; - STDMETHOD_(ULONG, AddRef)(THIS) PURE; - STDMETHOD_(ULONG, Release)(THIS) PURE; - - /*** IExchExtMessageEvents methods. ***/ - STDMETHOD(OnRead)(THIS_ LPEXCHEXTCALLBACK) PURE; - STDMETHOD(OnReadComplete)(THIS_ LPEXCHEXTCALLBACK, ULONG) PURE; - STDMETHOD(OnWrite)(THIS_ LPEXCHEXTCALLBACK) PURE; - STDMETHOD(OnWriteComplete)(THIS_ LPEXCHEXTCALLBACK, ULONG) PURE; - STDMETHOD(OnCheckNames)(THIS_ LPEXCHEXTCALLBACK) PURE; - STDMETHOD(OnCheckNamesComplete)(THIS_ LPEXCHEXTCALLBACK, ULONG) PURE; - STDMETHOD(OnSubmit)(THIS_ LPEXCHEXTCALLBACK) PURE; - STDMETHOD_(void, OnSubmitComplete)(THIS_ LPEXCHEXTCALLBACK, ULONG) PURE; -}; - - - -EXTERN_C const IID IID_IExchExtCommands; -#undef INTERFACE -#define INTERFACE IExchExtCommands -DECLARE_INTERFACE_(IExchExtCommands, IUnknown) -{ - /*** IUnknown methods. ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE; - STDMETHOD_(ULONG, AddRef)(THIS) PURE; - STDMETHOD_(ULONG, Release)(THIS) PURE; - - /*** IExchExtCommands methods. ***/ - STDMETHOD(InstallCommands)(THIS_ LPEXCHEXTCALLBACK, HWND, HMENU, - UINT*, LPTBENTRY, UINT, ULONG) PURE; - STDMETHOD_(void, InitMenu)(THIS_ LPEXCHEXTCALLBACK) PURE; - STDMETHOD(DoCommand)(THIS_ LPEXCHEXTCALLBACK, UINT) PURE; - STDMETHOD(Help)(THIS_ LPEXCHEXTCALLBACK, UINT) PURE; - STDMETHOD(QueryHelpText)(THIS_ UINT, ULONG, LPTSTR, UINT) PURE; - STDMETHOD(QueryButtonInfo)(THIS_ ULONG, UINT, LPTBBUTTON, - LPTSTR, UINT, ULONG) PURE; - STDMETHOD(ResetToolbar)(THIS_ ULONG, ULONG) PURE; -}; - - - -EXTERN_C const IID IID_IExchExtPropertySheets; -#undef INTERFACE -#define INTERFACE IExchExtPropertySheets -DECLARE_INTERFACE_(IExchExtPropertySheets, IUnknown) -{ - /*** IUnknown methods. ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE; - STDMETHOD_(ULONG, AddRef)(THIS) PURE; - STDMETHOD_(ULONG, Release)(THIS) PURE; - - /*** IExchExtPropertySheet methods. ***/ - STDMETHOD_(ULONG, GetMaxPageCount)(THIS_ ULONG) PURE; - STDMETHOD(GetPages)(THIS_ LPEXCHEXTCALLBACK, ULONG, - LPPROPSHEETPAGE, ULONG*) PURE; - STDMETHOD_(void, FreePages)(THIS_ LPPROPSHEETPAGE, ULONG, ULONG) PURE; -}; - - - -EXTERN_C const IID IID_IExchExtCallback; -#undef INTERFACE -#define INTERFACE IExchExtCallback -DECLARE_INTERFACE_(IExchExtCallback, IUnknown) -{ - /*** IUnknown methods. ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE; - STDMETHOD_(ULONG, AddRef)(THIS) PURE; - STDMETHOD_(ULONG, Release)(THIS) PURE; - - /*** IExchExtCallback methods. ***/ - STDMETHOD(GetVersion)(THIS_ ULONG*, ULONG) PURE; - STDMETHOD(GetWindow)(THIS_ HWND*) PURE; - STDMETHOD(GetMenu)(THIS_ HMENU*) PURE; - STDMETHOD(GetToolbar)(THIS_ ULONG, HWND*) PURE; - STDMETHOD(GetSession)(THIS_ LPMAPISESSION*, LPADRBOOK*) PURE; - STDMETHOD(GetObject)(THIS_ LPMDB*, LPMAPIPROP*) PURE; - STDMETHOD(GetSelectionCount)(THIS_ ULONG*) PURE; - STDMETHOD(GetSelectionItem)(THIS_ ULONG, ULONG*, LPENTRYID*, ULONG*, - LPTSTR, ULONG, ULONG*, ULONG) PURE; - STDMETHOD(GetMenuPos)(THIS_ ULONG, HMENU*, ULONG*, ULONG*, ULONG) PURE; - STDMETHOD(GetSharedExtsDir)(THIS_ LPTSTR, ULONG, ULONG) PURE; - STDMETHOD(GetRecipients)(THIS_ LPADRLIST*) PURE; - STDMETHOD(SetRecipients)(THIS_ LPADRLIST) PURE; - STDMETHOD(GetNewMessageSite)(THIS_ ULONG, LPMAPIFOLDER, LPPERSISTMESSAGE, - LPMESSAGE*, LPMAPIMESSAGESITE*, - LPMAPIVIEWCONTEXT*, ULONG) PURE; - STDMETHOD(RegisterModeless)(THIS_ LPEXCHEXTMODELESS, - LPEXCHEXTMODELESSCALLBACK*) PURE; - STDMETHOD(ChooseFolder)(THIS_ LPEXCHEXTCHOOSEFOLDER) PURE; -}; - - - -EXTERN_C const IID IID_IOutlookExtCallback; -#undef INTERFACE -#define INTERFACE IOutlookExtCallback -DECLARE_INTERFACE_(IOutlookExtCallback, IUnknown) -{ - /*** IUnknown methods. ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE; - STDMETHOD_(ULONG, AddRef)(THIS) PURE; - STDMETHOD_(ULONG, Release)(THIS) PURE; - - /*** IOutlookExtCallback. **/ - STDMETHOD(GetObject)(LPUNKNOWN *ppunk); - STDMETHOD(GetOfficeCharacter)(void **ppmsotfc); -}; - -// Flag values for IExchExtAttachedFileEvents::OpenSzFile -#define EEAFE_OPEN (0x00000001) -#define EEAFE_PRINT (0x00000002) -#define EEAFE_QUICKVIEW (0x00000003) - -#undef INTERFACE -#define INTERFACE IExchExtAttachedFileEvents - -DECLARE_INTERFACE_(IExchExtAttachedFileEvents, IUnknown) -{ - // *** IUnknown methods *** - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * lppvObj) PURE; - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - STDMETHOD_(ULONG,Release) (THIS) PURE; - - // *** IExchExtAttachedFileEvents methods *** - STDMETHOD(OnReadPattFromSzFile)(THIS_ LPATTACH lpatt, LPTSTR lpszFile, - ULONG ulFlags) PURE; - STDMETHOD(OnWritePattToSzFile)(THIS_ LPATTACH lpatt, LPTSTR lpszFile, - ULONG ulFlags) PURE; - STDMETHOD(QueryDisallowOpenPatt)(THIS_ LPATTACH lpatt) PURE; - STDMETHOD(OnOpenPatt)(THIS_ LPATTACH lpatt) PURE; - STDMETHOD(OnOpenSzFile)(THIS_ LPTSTR lpszFile, ULONG ulFlags) PURE; -}; -typedef IExchExtAttachedFileEvents FAR * LPEXCHEXTATTACHEDFILEEVENTS; - -EXTERN_C const IID IID_IExchExtAttachedFileEvents; - -#ifdef __cplusplus -} -#endif - -#endif /*EXCHEXT.h*/ +/* myexchext.h - Simple replacement for exchext.h + + * This file defines the interface used by Exchange extensions. It + * has been compiled by g10 Code GmbH from several sources describing + * the interface. + * + * Revisions: + * 2005-08-12 Initial version. + * 2005-09-18 Add IExchExtAttachedFileEvents. + * + */ + +#ifndef EXCHEXT_H +#define EXCHEXT_H + +#ifdef __cplusplus +extern "C" { +#if 0 +} +#endif +#endif + +#include +#include +#include "mymapi.h" + + +/* Constants used by Install. */ +#define EECONTEXT_SESSION 0x00000001 +#define EECONTEXT_VIEWER 0x00000002 +#define EECONTEXT_REMOTEVIEWER 0x00000003 +#define EECONTEXT_SEARCHVIEWER 0x00000004 +#define EECONTEXT_ADDRBOOK 0x00000005 +#define EECONTEXT_SENDNOTEMESSAGE 0x00000006 +#define EECONTEXT_READNOTEMESSAGE 0x00000007 +#define EECONTEXT_SENDPOSTMESSAGE 0x00000008 +#define EECONTEXT_READPOSTMESSAGE 0x00000009 +#define EECONTEXT_READREPORTMESSAGE 0x0000000A +#define EECONTEXT_SENDRESENDMESSAGE 0x0000000B +#define EECONTEXT_PROPERTYSHEETS 0x0000000C +#define EECONTEXT_ADVANCEDCRITERIA 0x0000000D +#define EECONTEXT_TASK 0x0000000E + +/* Constants for GetVersion. */ +#define EECBGV_GETBUILDVERSION 0x00000001 +#define EECBGV_GETACTUALVERSION 0x00000002 +#define EECBGV_GETVIRTUALVERSION 0x00000004 +#define EECBGV_BUILDVERSION_MAJOR 0x000d0000 +#define EECBGV_BUILDVERSION_MAJOR_MASK 0xffff0000 +#define EECBGV_BUILDVERSION_MINOR_MASK 0x0000ffff + +/* Some toolbar IDs. */ +#define EETBID_STANDARD 0x00000001 + +/* Constants use for QueryHelpText. */ +#define EECQHT_STATUS 0x00000001 +#define EECQHT_TOOLTIP 0x00000002 + +/* Flags use by the methods of IExchExtPropertySheets. */ +#define EEPS_MESSAGE 0x00000001 +#define EEPS_FOLDER 0x00000002 +#define EEPS_STORE 0x00000003 +#define EEPS_TOOLSOPTIONS 0x00000004 + +/* Flags used by OnFooComplete. */ +#define EEME_FAILED 0x00000001 +#define EEME_COMPLETE_FAILED 0x00000002 + + +/* Command IDs. */ +#define EECMDID_ToolsCustomizeToolbar 134 +#define EECMDID_ToolsOptions 136 + + +/* GUIDs */ +DEFINE_GUID(GUID_NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + +DEFINE_OLEGUID(IID_IUnknown, 0x00000000, 0, 0); +DEFINE_OLEGUID(IID_IDispatch, 0x00020400, 0, 0); + +DEFINE_OLEGUID(IID_IExchExtCallback, 0x00020d10, 0, 0); +DEFINE_OLEGUID(IID_IExchExt, 0x00020d11, 0, 0); +DEFINE_OLEGUID(IID_IExchExtCommands, 0x00020d12, 0, 0); +DEFINE_OLEGUID(IID_IExchExtUserEvents, 0x00020d13, 0, 0); +DEFINE_OLEGUID(IID_IExchExtSessionEvents, 0x00020d14, 0, 0); +DEFINE_OLEGUID(IID_IExchExtMessageEvents, 0x00020d15, 0, 0); +DEFINE_OLEGUID(IID_IExchExtAttachedFileEvents,0x00020d16, 0, 0); +DEFINE_OLEGUID(IID_IExchExtPropertySheets, 0x00020d17, 0, 0); +DEFINE_OLEGUID(IID_IExchExtAdvancedCriteria, 0x00020d18, 0, 0); +DEFINE_OLEGUID(IID_IExchExtModeless, 0x00020d19, 0, 0); +DEFINE_OLEGUID(IID_IExchExtModelessCallback, 0x00020d1a, 0, 0); +DEFINE_OLEGUID(IID_IOutlookExtCallback, 0x0006720d, 0, 0); + + +/* Type definitions. */ + +/* Parameters for the toolbar entries for + IExchExtCommands::InstallCommands. */ +struct TBENTRY +{ + HWND hwnd; + ULONG tbid; + ULONG ulFlags; + UINT itbbBase; +}; +typedef struct TBENTRY TBENTRY; +typedef struct TBENTRY *LPTBENTRY; + + + + + + +/**** Class declarations. ***/ +typedef struct IExchExt IExchExt; +typedef IExchExt *LPEXCHEXT; + +typedef struct IExchExtMessageEvents IExchExtMessageEvents; +typedef IExchExtMessageEvents *LPEXCHEXTMESSAGEEVENTS; + +typedef struct IExchExtCommands IExchExtCommands; +typedef IExchExtCommands *LPEXCHEXTCOMMANDS; + +typedef struct IExchExtPropertySheets IExchExtPropertySheets; +typedef IExchExtPropertySheets *LPEXCHEXTPROPERTYSHEETS; + +typedef struct IExchExtCallback IExchExtCallback; +typedef IExchExtCallback *LPEXCHEXTCALLBACK; + +typedef struct IOutlookExtCallback IOutlookExtCallback; +typedef IOutlookExtCallback *LPOUTLOOKEXTCALLBACK; + +/* The next classes are not yet defined. but if so they should go here. */ +typedef struct IExchExtModeless IExchExtModeless; +typedef IExchExtModeless *LPEXCHEXTMODELESS; +typedef struct IExchExtModelessCallback IExchExtModelessCallback; +typedef IExchExtModelessCallback *LPEXCHEXTMODELESSCALLBACK; + + + + +/*** Class declarations of classes defined elsewhere. ***/ +struct IMAPISession; +typedef struct IMAPISession *LPMAPISESSION; + +struct IAddrBook; +typedef struct IAddrBook *LPADRBOOK; + +struct IMAPIFolder; +typedef struct IMAPIFolder *LPMAPIFOLDER; + +struct IMAPIProp; +typedef struct IMAPIProp *LPMAPIPROP; + +struct IPersistMessage; +typedef struct IPersistMessage *LPPERSISTMESSAGE; + +struct IMAPIMessageSite; +typedef struct IMAPIMessageSite *LPMAPIMESSAGESITE; + +struct IMAPIViewContext; +typedef struct IMAPIViewContext *LPMAPIVIEWCONTEXT; + + + +/*** Types derived from the above class definitions. ***/ + +/* Callback used to load an extension. */ +typedef LPEXCHEXT (CALLBACK *LPFNEXCHEXTENTRY)(void); + +/* Parameters for the IExchExtCallback::ChooseFolder. */ +typedef UINT (STDAPICALLTYPE *LPEECFHOOKPROC)(HWND, UINT, WPARAM, LPARAM); + +struct EXCHEXTCHOOSEFOLDER +{ + UINT cbLength; + HWND hwnd; + LPTSTR szCaption; + LPTSTR szLabel; + LPTSTR szHelpFile; + ULONG ulHelpID; + HINSTANCE hinst; + UINT uiDlgID; + LPEECFHOOKPROC lpeecfhp; + DWORD dwHookData; + ULONG ulFlags; + LPMDB pmdb; + LPMAPIFOLDER pfld; + LPTSTR szName; + DWORD dwReserved1; + DWORD dwReserved2; + DWORD dwReserved3; +}; +typedef struct EXCHEXTCHOOSEFOLDER EXCHEXTCHOOSEFOLDER; +typedef struct EXCHEXTCHOOSEFOLDER *LPEXCHEXTCHOOSEFOLDER; + + + + +/**** Class definitions. ***/ + +EXTERN_C const IID IID_IExchExt; +#undef INTERFACE +#define INTERFACE IExchExt +DECLARE_INTERFACE_(IExchExt, IUnknown) +{ + /*** IUnknown methods. ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + /*** IExchExt methods. ***/ + STDMETHOD(Install)(THIS_ LPEXCHEXTCALLBACK, ULONG, ULONG) PURE; +}; + + + +EXTERN_C const IID IID_IExchExtMessageEvents; +#undef INTERFACE +#define INTERFACE IExchExtMessageEvents +DECLARE_INTERFACE_(IExchExtMessageEvents, IUnknown) +{ + /*** IUnknown methods. ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + /*** IExchExtMessageEvents methods. ***/ + STDMETHOD(OnRead)(THIS_ LPEXCHEXTCALLBACK) PURE; + STDMETHOD(OnReadComplete)(THIS_ LPEXCHEXTCALLBACK, ULONG) PURE; + STDMETHOD(OnWrite)(THIS_ LPEXCHEXTCALLBACK) PURE; + STDMETHOD(OnWriteComplete)(THIS_ LPEXCHEXTCALLBACK, ULONG) PURE; + STDMETHOD(OnCheckNames)(THIS_ LPEXCHEXTCALLBACK) PURE; + STDMETHOD(OnCheckNamesComplete)(THIS_ LPEXCHEXTCALLBACK, ULONG) PURE; + STDMETHOD(OnSubmit)(THIS_ LPEXCHEXTCALLBACK) PURE; + STDMETHOD_(void, OnSubmitComplete)(THIS_ LPEXCHEXTCALLBACK, ULONG) PURE; +}; + + + +EXTERN_C const IID IID_IExchExtCommands; +#undef INTERFACE +#define INTERFACE IExchExtCommands +DECLARE_INTERFACE_(IExchExtCommands, IUnknown) +{ + /*** IUnknown methods. ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + /*** IExchExtCommands methods. ***/ + STDMETHOD(InstallCommands)(THIS_ LPEXCHEXTCALLBACK, HWND, HMENU, + UINT*, LPTBENTRY, UINT, ULONG) PURE; + STDMETHOD_(void, InitMenu)(THIS_ LPEXCHEXTCALLBACK) PURE; + STDMETHOD(DoCommand)(THIS_ LPEXCHEXTCALLBACK, UINT) PURE; + STDMETHOD(Help)(THIS_ LPEXCHEXTCALLBACK, UINT) PURE; + STDMETHOD(QueryHelpText)(THIS_ UINT, ULONG, LPTSTR, UINT) PURE; + STDMETHOD(QueryButtonInfo)(THIS_ ULONG, UINT, LPTBBUTTON, + LPTSTR, UINT, ULONG) PURE; + STDMETHOD(ResetToolbar)(THIS_ ULONG, ULONG) PURE; +}; + + + +EXTERN_C const IID IID_IExchExtPropertySheets; +#undef INTERFACE +#define INTERFACE IExchExtPropertySheets +DECLARE_INTERFACE_(IExchExtPropertySheets, IUnknown) +{ + /*** IUnknown methods. ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + /*** IExchExtPropertySheet methods. ***/ + STDMETHOD_(ULONG, GetMaxPageCount)(THIS_ ULONG) PURE; + STDMETHOD(GetPages)(THIS_ LPEXCHEXTCALLBACK, ULONG, + LPPROPSHEETPAGE, ULONG*) PURE; + STDMETHOD_(void, FreePages)(THIS_ LPPROPSHEETPAGE, ULONG, ULONG) PURE; +}; + + + +EXTERN_C const IID IID_IExchExtCallback; +#undef INTERFACE +#define INTERFACE IExchExtCallback +DECLARE_INTERFACE_(IExchExtCallback, IUnknown) +{ + /*** IUnknown methods. ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + /*** IExchExtCallback methods. ***/ + STDMETHOD(GetVersion)(THIS_ ULONG*, ULONG) PURE; + STDMETHOD(GetWindow)(THIS_ HWND*) PURE; + STDMETHOD(GetMenu)(THIS_ HMENU*) PURE; + STDMETHOD(GetToolbar)(THIS_ ULONG, HWND*) PURE; + STDMETHOD(GetSession)(THIS_ LPMAPISESSION*, LPADRBOOK*) PURE; + STDMETHOD(GetObject)(THIS_ LPMDB*, LPMAPIPROP*) PURE; + STDMETHOD(GetSelectionCount)(THIS_ ULONG*) PURE; + STDMETHOD(GetSelectionItem)(THIS_ ULONG, ULONG*, LPENTRYID*, ULONG*, + LPTSTR, ULONG, ULONG*, ULONG) PURE; + STDMETHOD(GetMenuPos)(THIS_ ULONG, HMENU*, ULONG*, ULONG*, ULONG) PURE; + STDMETHOD(GetSharedExtsDir)(THIS_ LPTSTR, ULONG, ULONG) PURE; + STDMETHOD(GetRecipients)(THIS_ LPADRLIST*) PURE; + STDMETHOD(SetRecipients)(THIS_ LPADRLIST) PURE; + STDMETHOD(GetNewMessageSite)(THIS_ ULONG, LPMAPIFOLDER, LPPERSISTMESSAGE, + LPMESSAGE*, LPMAPIMESSAGESITE*, + LPMAPIVIEWCONTEXT*, ULONG) PURE; + STDMETHOD(RegisterModeless)(THIS_ LPEXCHEXTMODELESS, + LPEXCHEXTMODELESSCALLBACK*) PURE; + STDMETHOD(ChooseFolder)(THIS_ LPEXCHEXTCHOOSEFOLDER) PURE; +}; + + + +EXTERN_C const IID IID_IOutlookExtCallback; +#undef INTERFACE +#define INTERFACE IOutlookExtCallback +DECLARE_INTERFACE_(IOutlookExtCallback, IUnknown) +{ + /*** IUnknown methods. ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + /*** IOutlookExtCallback. **/ + STDMETHOD(GetObject)(LPUNKNOWN *ppunk); + STDMETHOD(GetOfficeCharacter)(void **ppmsotfc); +}; + +// Flag values for IExchExtAttachedFileEvents::OpenSzFile +#define EEAFE_OPEN (0x00000001) +#define EEAFE_PRINT (0x00000002) +#define EEAFE_QUICKVIEW (0x00000003) + +#undef INTERFACE +#define INTERFACE IExchExtAttachedFileEvents + +DECLARE_INTERFACE_(IExchExtAttachedFileEvents, IUnknown) +{ + // *** IUnknown methods *** + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * lppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // *** IExchExtAttachedFileEvents methods *** + STDMETHOD(OnReadPattFromSzFile)(THIS_ LPATTACH lpatt, LPTSTR lpszFile, + ULONG ulFlags) PURE; + STDMETHOD(OnWritePattToSzFile)(THIS_ LPATTACH lpatt, LPTSTR lpszFile, + ULONG ulFlags) PURE; + STDMETHOD(QueryDisallowOpenPatt)(THIS_ LPATTACH lpatt) PURE; + STDMETHOD(OnOpenPatt)(THIS_ LPATTACH lpatt) PURE; + STDMETHOD(OnOpenSzFile)(THIS_ LPTSTR lpszFile, ULONG ulFlags) PURE; +}; +typedef IExchExtAttachedFileEvents FAR * LPEXCHEXTATTACHEDFILEEVENTS; + +EXTERN_C const IID IID_IExchExtAttachedFileEvents; + +#ifdef __cplusplus +} +#endif + +#endif /*EXCHEXT.h*/ Property changes on: trunk/src/myexchext.h ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/src/mymapi.h ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/src/mymapitags.h ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/src/olflange-def.h ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/src/passcache.h ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/src/pgpmime.h ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/src/rfc822parse.h ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/src/util.h ___________________________________________________________________ Name: svn:eol-style + native From cvs at cvs.gnupg.org Thu Sep 22 05:09:44 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Thu Sep 22 04:42:20 2005 Subject: [svn] GnuPG - r3897 - trunk/doc Message-ID: Author: dshaw Date: 2005-09-22 05:09:38 +0200 (Thu, 22 Sep 2005) New Revision: 3897 Modified: trunk/doc/ChangeLog trunk/doc/gpg.sgml Log: * gpg.sgml: Note that --display-charset is just for display and doesn't recode data. Note that --search-keys can use the standard search syntax now (<, =, *, @). Document the @-address mode. Modified: trunk/doc/ChangeLog =================================================================== --- trunk/doc/ChangeLog 2005-09-20 08:19:50 UTC (rev 3896) +++ trunk/doc/ChangeLog 2005-09-22 03:09:38 UTC (rev 3897) @@ -1,3 +1,9 @@ +2005-09-21 David Shaw + + * gpg.sgml: Note that --display-charset is just for display and + doesn't recode data. Note that --search-keys can use the standard + search syntax now (<, =, *, @). Document the @-address mode. + 2005-08-23 David Shaw * gpg.sgml: Fix documentation for setpref/updpref, document Modified: trunk/doc/gpg.sgml =================================================================== --- trunk/doc/gpg.sgml 2005-09-20 08:19:50 UTC (rev 3896) +++ trunk/doc/gpg.sgml 2005-09-22 03:09:38 UTC (rev 3897) @@ -749,6 +749,10 @@ Search the keyserver for the given names. Multiple names given here will be joined together to create the search string for the keyserver. Option --keyserver must be used to give the name of this keyserver. +Keyservers that support different search methods allow using the +syntax specified in "How to specify a user ID" below. Note that +different keyserver types support different search methods. Currently +only LDAP supports them all. @@ -1470,8 +1474,8 @@ When using the "--export-secret-subkeys" command, this option resets the passphrases for all exported subkeys to empty. This is useful -when the exported subkey is to be used on an unattended amchine where -a passphrase won't make sense. Defaults to no. +when the exported subkey is to be used on an unattended machine where +a passphrase doesn't necessarily make sense. Defaults to no. @@ -1756,10 +1760,12 @@ --display-charset &ParmName; Set the name of the native character set. This is used to convert -some informational strings like user IDs to the proper UTF-8 -encoding. If this option is not used, the default character set is -determined from the current locale. A verbosity level of 3 shows the -chosen set. Valid values for &ParmName; are: +some informational strings like user IDs to the proper UTF-8 encoding. +Note that this has nothing to do with the character set of data to be +encrypted or signed; GnuPG does not recode user supplied data. If +this option is not used, the default character set is determined from +the current locale. A verbosity level of 3 shows the chosen set. +Valid values for &ParmName; are: iso-8859-1This is the Latin 1 set. @@ -2943,6 +2949,14 @@ + +@heinrichh + +Match within the <email.address> part of a user ID. The at sign +indicates this email address mode. + + +