[svn] GPGol - r109 - in trunk: . src

svn author wk cvs at cvs.gnupg.org
Thu Sep 29 12:47:07 CEST 2005


Author: wk
Date: 2005-09-29 12:47:06 +0200 (Thu, 29 Sep 2005)
New Revision: 109

Modified:
   trunk/ChangeLog
   trunk/NEWS
   trunk/configure.ac
   trunk/src/ChangeLog
   trunk/src/engine-gpgme.c
   trunk/src/gpgmsg.cpp
   trunk/src/intern.h
   trunk/src/passphrase-dialog.c
Log:
Released 0.9.3


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2005-09-28 19:20:00 UTC (rev 108)
+++ trunk/ChangeLog	2005-09-29 10:47:06 UTC (rev 109)
@@ -1,3 +1,7 @@
+2005-09-29  Werner Koch  <wk at g10code.com>
+
+	Released 0.9.3.
+
 2005-09-22  Werner Koch  <wk at g10code.com>
 
 	Released 0.9.2.

Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2005-09-28 19:20:00 UTC (rev 108)
+++ trunk/NEWS	2005-09-29 10:47:06 UTC (rev 109)
@@ -1,3 +1,16 @@
+Noteworthy changes for version 0.9.3 (2005-09-29)
+=================================================
+
+* Fixed bugs introduced with the last release.
+
+* PGP/MIME decryption works now correctly with Latin-1 and utf-8.
+
+* No more pop-ups to ask whether to save changes after just decrypting
+  a message.
+
+* Fixed a couple of bugs possibly leading to crashes.
+
+
 Noteworthy changes for version 0.9.2 (2005-09-22)
 =================================================
 

Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac	2005-09-28 19:20:00 UTC (rev 108)
+++ trunk/configure.ac	2005-09-29 10:47:06 UTC (rev 109)
@@ -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.3-cvs, bug-gpgol at g10code.com)
+AC_INIT(gpgol, 0.9.3, bug-gpgol at g10code.com)
 
 NEED_GPGME_API=1
 NEED_GPGME_VERSION=1.1.0

Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2005-09-28 19:20:00 UTC (rev 108)
+++ trunk/src/ChangeLog	2005-09-29 10:47:06 UTC (rev 109)
@@ -1,3 +1,14 @@
+2005-09-29  Werner Koch  <wk at g10code.com>
+
+	* gpgmsg.cpp (encrypt_and_sign): Pass signing key to encryption
+	function.
+
+	* passphrase-dialog.c (signer_dialog_box): New arg encrypting. 
+
+	* gpgmsg.cpp (encrypt_and_sign): Set content type.
+
+	* engine-gpgme.c (op_lookup_keys): Fixed multiple key detection.
+
 2005-09-28  Werner Koch  <wk at g10code.com>
 
 	* olflange.cpp (DoCommand): Catch close command and resend to

Modified: trunk/src/engine-gpgme.c
===================================================================
--- trunk/src/engine-gpgme.c	2005-09-28 19:20:00 UTC (rev 108)
+++ trunk/src/engine-gpgme.c	2005-09-29 10:47:06 UTC (rev 109)
@@ -1181,8 +1181,8 @@
 
 
 
-/* Try to find a key for each item in array NAMES. Item not found are
-   stored as malloced strings in tghe newly allocated array UNKNOWN.
+/* Try to find a key for each item in array NAMES. Items not found are
+   stored as malloced strings in the newly allocated array UNKNOWN.
    Found keys are stored in the newly allocated array KEYS.  Both
    arrays are terminated by a NULL entry.  Caller needs to releade
    KEYS and UNKNOWN.
@@ -1219,7 +1219,7 @@
       if (!err)
         {
           err = gpgme_op_keylist_next (ctx, &k);
-          if (!err && gpgme_op_keylist_next (ctx, &k2))
+          if (!err && !gpgme_op_keylist_next (ctx, &k2))
             {
               /* More than one matching key available.  Take this one
                  as unknown. */

Modified: trunk/src/gpgmsg.cpp
===================================================================
--- trunk/src/gpgmsg.cpp	2005-09-28 19:20:00 UTC (rev 108)
+++ trunk/src/gpgmsg.cpp	2005-09-29 10:47:06 UTC (rev 109)
@@ -1144,7 +1144,7 @@
     }
 
   /* Pop up a dialog box to ask for the signer of the message. */
-  if (signer_dialog_box (&sign_key, NULL) == -1)
+  if (signer_dialog_box (&sign_key, NULL, 0) == -1)
     {
       log_debug ("%s.%s: leave (dialog failed)\n", __FILE__, __func__);
       return gpg_error (GPG_ERR_CANCELED);  
@@ -1214,6 +1214,7 @@
   char **unknown = NULL;
   int err = 0;
   size_t n_keys, n_unknown, n_recp;
+  SPropValue prop;
     
   
   if (!*(plaintext = getOrigText ()) && !hasAttachments ()) 
@@ -1225,7 +1226,7 @@
   /* Pop up a dialog box to ask for the signer of the message. */
   if (sign_flag)
     {
-      if (signer_dialog_box (&sign_key, NULL) == -1)
+      if (signer_dialog_box (&sign_key, NULL, 1) == -1)
         {
           log_debug ("%s.%s: leave (dialog failed)\n", __FILE__, __func__);
           return gpg_error (GPG_ERR_CANCELED);  
@@ -1279,7 +1280,8 @@
     {
       is_html = is_html_body (plaintext);
 
-      err = op_encrypt (plaintext, &ciphertext, keys, NULL, 0);
+      err = op_encrypt (plaintext, &ciphertext, 
+                        keys, sign_key, opt.passwd_ttl);
       if (err)
         {
           MessageBox (hwnd, op_strerror (err),
@@ -1296,7 +1298,6 @@
 
 //       {
 //         SPropValue prop;
-
 //         prop.ulPropTag=PR_MESSAGE_CLASS_A;
 //         prop.Value.lpszA="IPM.Note.OPENPGP";
 //         hr = HrSetOneProp (message, &prop);
@@ -1305,15 +1306,6 @@
 //             log_error ("%s:%s: can't set message class: hr=%#lx\n",
 //                        __FILE__, __func__, hr); 
 //           }
-
-//         prop.ulPropTag=PR_CONTENT_TYPE_A;
-//         prop.Value.lpszA="application/encrypted;foo=bar;type=mytype";
-//         hr = HrSetOneProp (message, &prop);
-//         if (hr != S_OK)
-//           {
-//             log_error ("%s:%s: can't set content type: hr=%#lx\n",
-//                        __FILE__, __func__, hr); 
-//           }
 //       }
 
     }
@@ -1334,7 +1326,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
@@ -1346,6 +1338,20 @@
         err = set_message_body (message, ciphertext);
       if (err)
         goto leave;
+
+      /* In case we don't have attachments, Outlook will really insert
+         the following content type into the header.  We use this to
+         declare that the encrypted content of the message is utf-8
+         encoded. */
+      prop.ulPropTag=PR_CONTENT_TYPE_A;
+      prop.Value.lpszA="text/plain; charset=utf-8"; 
+      hr = HrSetOneProp (message, &prop);
+      if (hr != S_OK)
+        {
+          log_error ("%s:%s: can't set content type: hr=%#lx\n",
+                     __FILE__, __func__, hr);
+        }
+
       hr = message->SaveChanges (KEEP_OPEN_READWRITE|FORCE_SAVE);
       if (hr != S_OK)
         {

Modified: trunk/src/intern.h
===================================================================
--- trunk/src/intern.h	2005-09-28 19:20:00 UTC (rev 108)
+++ trunk/src/intern.h	2005-09-29 10:47:06 UTC (rev 109)
@@ -133,7 +133,7 @@
                                     gpgme_key_t **ret_rset);
 
 /*-- passphrase-dialog.c --*/
-int signer_dialog_box (gpgme_key_t *r_key, char **r_passwd);
+int signer_dialog_box (gpgme_key_t *r_key, char **r_passwd, int encrypting);
 gpgme_error_t passphrase_callback_box (void *opaque, const char *uid_hint, 
 			     const char *pass_info,
 			     int prev_was_bad, int fd);

Modified: trunk/src/passphrase-dialog.c
===================================================================
--- trunk/src/passphrase-dialog.c	2005-09-28 19:20:00 UTC (rev 108)
+++ trunk/src/passphrase-dialog.c	2005-09-29 10:47:06 UTC (rev 109)
@@ -45,6 +45,8 @@
   int hide_state;            /* Flag indicating that some stuff is hidden. */
 
   unsigned int use_as_cb;    /* This is used by the passphrase callback. */
+
+  int no_encrypt_warning;    /* Print a warning after cancel. */
 };
 
 
@@ -227,6 +229,7 @@
     {
       const char *name, *email, *keyid, *algo;
       char *p;
+      long idx;
       
       if (key->revoked || key->expired || key->disabled || key->invalid)
         {
@@ -258,12 +261,17 @@
 	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, 
+      idx = SendDlgItemMessage (dlg, ctlid, CB_ADDSTRING, 0, 
 			  (LPARAM)(const char *) p);
       xfree (p);
+      if (idx < 0) /* Error. */
+        {
+          gpgme_key_release (key);
+          continue;
+        }
+      
+      SendDlgItemMessage (dlg, ctlid, CB_SETITEMDATA, idx, (LPARAM)pos);
 
-      SendDlgItemMessage (dlg, ctlid, CB_SETITEMDATA, pos, (LPARAM)pos);
-
       if (pos >= keyarray_size)
         {
           gpgme_key_t *tmparr;
@@ -278,6 +286,7 @@
         }
       keyarray[pos++] = key;
     }
+  SendDlgItemMessage (dlg, ctlid, CB_SETCURSEL, 0, 0);
 
   gpgme_op_keylist_end (ctx);
   gpgme_release (ctx);
@@ -293,6 +302,7 @@
   static struct dialog_context_s *context; 
   struct decrypt_key_s *dec;
   size_t n;
+  const char *warn;
 
   if (msg == WM_INITDIALOG)
     {
@@ -389,11 +399,23 @@
           break;
           
 	case IDCANCEL:
-          if (dec && context->use_as_cb && (dec->flags & 0x01)) 
+          if (context->no_encrypt_warning)
             {
-              const char *warn = _("If you cancel this dialog, the message"
-                                   " will be sent without signing.\n\n"
-                                   "Do you really want to cancel?");
+              warn = _("If you cancel this dialog, the message will be sent"
+                       " in cleartext!\n\n"
+                       "Do you really want to cancel?");
+            }
+          else if (dec && context->use_as_cb && (dec->flags & 0x01)) 
+            {
+              warn = _("If you cancel this dialog, the message"
+                       " will be sent without signing.\n\n"
+                       "Do you really want to cancel?");
+            }
+          else
+            warn = NULL;
+
+          if (warn)
+            {
               n = MessageBox (dlg, warn, "Secret Key Dialog",
                               MB_ICONWARNING|MB_YESNO);
               if (n == IDNO)
@@ -422,6 +444,7 @@
   static struct dialog_context_s *context; 
   struct decrypt_key_s * dec;
   size_t n;
+  const char *warn;
 
   if (msg == WM_INITDIALOG)
     {
@@ -495,11 +518,23 @@
           break;
 
 	case IDCANCEL:
-          if (dec && context->use_as_cb && (dec->flags & 0x01)) 
+          if (context->no_encrypt_warning)
             {
-              const char *warn = _("If you cancel this dialog, the message"
-                                   " will be sent without signing.\n"
-				   "Do you really want to cancel?");
+              warn = _("If you cancel this dialog, the message will be sent"
+                       " in cleartext!\n\n"
+                       "Do you really want to cancel?");
+            }
+          else if (dec && context->use_as_cb && (dec->flags & 0x01)) 
+            {
+              warn = _("If you cancel this dialog, the message"
+                       " will be sent without signing.\n"
+                       "Do you really want to cancel?");
+            }
+          else
+            warn = NULL;
+
+          if (warn)
+            {
               n = MessageBox (dlg, warn, "Secret Key Dialog",
                               MB_ICONWARNING|MB_YESNO);
               if (n == IDNO)
@@ -521,9 +556,10 @@
 
 /* Display a signer dialog which contains all secret keys, useable for
    signing data.  The key is returned in R_KEY.  The passprase in
-   r_passwd. */
+   r_passwd.  IF Encrypting is true, the message will get encrypted
+   later. */
 int 
-signer_dialog_box (gpgme_key_t *r_key, char **r_passwd)
+signer_dialog_box (gpgme_key_t *r_key, char **r_passwd, int encrypting)
 {
   struct dialog_context_s context; 
   struct decrypt_key_s dec;
@@ -532,7 +568,8 @@
   memset (&dec, 0, sizeof dec);
   dec.hide_pwd = 1;
   context.dec = &dec;
-  
+  context.no_encrypt_warning = encrypting;
+
   DialogBoxParam (glob_hinst, (LPCTSTR)IDD_DEC, GetDesktopWindow (),
                   decrypt_key_dlg_proc, (LPARAM)&context);
 




More information about the Gnupg-commits mailing list