[git] GpgOL - branch, master, updated. gpgol-1.2.0-84-gb942f73

by Andre Heinecke cvs at cvs.gnupg.org
Mon Nov 2 17:54:20 CET 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG extension for MS Outlook".

The branch, master has been updated
       via  b942f73f7961fd277cbafab9d2a5ed08038f00db (commit)
      from  452477949fe2f1d8ca36ebbad31c6f3c6607e30e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b942f73f7961fd277cbafab9d2a5ed08038f00db
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Nov 2 17:46:55 2015 +0100

    Wipe all decrypted mails on disconnect.
    
    * src/mail.cpp (wipe_all_mails): New.
    * src/gpgoladdin.cpp (~GpgOLAddin): Add more debug output.
      (OnDisconnection): Call wipe all mails.
    
    --
    This should cover the case that we decrypted a message and
    are deactivated before the write / save event that removes
    the plaintext in that message again.
    
    nuPG-Bug-Id: 2138

diff --git a/src/gpgoladdin.cpp b/src/gpgoladdin.cpp
index 5ba8a72..6f4c4a4 100644
--- a/src/gpgoladdin.cpp
+++ b/src/gpgoladdin.cpp
@@ -48,6 +48,7 @@
 #include "eventsinks.h"
 #include "eventsink.h"
 #include "windowmessages.h"
+#include "mail.h"
 
 #define ICON_SIZE_LARGE  32
 #define ICON_SIZE_NORMAL 16
@@ -163,11 +164,13 @@ GpgolAddin::GpgolAddin (void) : m_lRef(0), m_application(0),
 
 GpgolAddin::~GpgolAddin (void)
 {
-  log_debug ("%s:%s: cleaning up GpgolAddin object;",
+  log_debug ("%s:%s: Releasing Extender;",
              SRCNAME, __func__);
-
   m_ribbonExtender->Release ();
-  m_applicationEventSink->Release() ;
+
+  log_debug ("%s:%s: Releasing Application Event Sink;",
+             SRCNAME, __func__);
+  m_applicationEventSink->Release();
 
   if (!m_disabled)
     {
@@ -264,6 +267,23 @@ GpgolAddin::OnDisconnection (ext_DisconnectMode RemoveMode,
 {
   (void)custom;
   (void)RemoveMode;
+  log_debug ("%s:%s: cleaning up GpgolAddin object;",
+             SRCNAME, __func__);
+
+  /* Doing the wipe in the dtor is too late. Outlook
+     does not allow us any OOM calls then and only returns
+     "Unexpected error" in that case. Weird. */
+
+  if (Mail::wipe_all_mails ())
+    {
+      MessageBox (NULL,
+                  _("Failed to remove plaintext from at least one message.\n\n"
+                    "Until GpgOL is activated again it is possible that the "
+                    "plaintext of messages decrypted in this Session is saved "
+                    "or transfered back to your mailserver."),
+                  _("GpgOL"),
+                  MB_ICONINFORMATION|MB_OK);
+    }
 
   write_options();
   return S_OK;
diff --git a/src/mail.cpp b/src/mail.cpp
index c5ea30a..9e81e13 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -337,3 +337,20 @@ Mail::get_sender ()
     }
   return m_sender;
 }
+
+
+int
+Mail::wipe_all_mails ()
+{
+  int err = 0;
+  std::map<LPDISPATCH, Mail *>::iterator it;
+  for (it = g_mail_map.begin(); it != g_mail_map.end(); ++it)
+    {
+      if (it->second->wipe ())
+        {
+          log_error ("Failed to wipe mail: %p ", it->first);
+          err++;
+        }
+    }
+  return err;
+}
diff --git a/src/mail.h b/src/mail.h
index 81547cd..0d7084d 100644
--- a/src/mail.h
+++ b/src/mail.h
@@ -54,6 +54,16 @@ public:
   */
   static Mail* get_mail_for_item (LPDISPATCH mailitem);
 
+  /** @brief wipe the plaintext from all known Mail objects.
+    *
+    * This is intended as a "cleanup" call to be done on unload
+    * to avoid leaking plaintext in case we are deactivated while
+    * some mails still have their plaintext inserted.
+    *
+    * @returns the number of errors that occured.
+    */
+  static int wipe_all_mails ();
+
   /** @brief Reference to the mailitem. Do not Release! */
   LPDISPATCH item () { return m_mailitem; }
 

-----------------------------------------------------------------------

Summary of changes:
 src/gpgoladdin.cpp | 26 +++++++++++++++++++++++---
 src/mail.cpp       | 17 +++++++++++++++++
 src/mail.h         | 10 ++++++++++
 3 files changed, 50 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
GnuPG extension for MS Outlook
http://git.gnupg.org




More information about the Gnupg-commits mailing list