[git] GpgOL - branch, mime-addin, updated. gpgol-1.2.0-48-g383cb09

by Andre Heinecke cvs at cvs.gnupg.org
Tue Oct 13 15:51:08 CEST 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, mime-addin has been updated
       via  383cb09127d268a9e49e80c013e7db29cea8ff65 (commit)
       via  364f116578c37ad97ba6ff27c5e6e688fc20e21d (commit)
       via  b4529483bfe8aa7d633bc9e1f69342ef5eae489c (commit)
       via  aeec015b64fa3440fae8c70d84fd3a9666ccc1be (commit)
       via  7df5ec613b717aaefa3249342bc6f92f6d7f19e7 (commit)
       via  c25fec2b0e18fcf954d048e2ddb71b4186f4db49 (commit)
       via  869bedfffb4aa4be8ea042e1b84e1841de24f483 (commit)
       via  a8d772736473ce8153827c335c35aff589e63d06 (commit)
      from  8afa4a3780c8e6da5ea9549b48b7369a41851164 (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 383cb09127d268a9e49e80c013e7db29cea8ff65
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Oct 13 15:49:08 2015 +0200

    Fix various warnings
    
    * src/mapihelp.cpp (get_msgcls_from_pgp_lines): Add braces.
    * src/message.cpp (message_decrypt): Add braces.
    * src/oomhelp.cpp (dump_excepinfo): Remove additional format params.

diff --git a/src/mapihelp.cpp b/src/mapihelp.cpp
index 8460bcc..361f24a 100644
--- a/src/mapihelp.cpp
+++ b/src/mapihelp.cpp
@@ -620,7 +620,7 @@ get_msgcls_from_pgp_lines (LPMESSAGE message)
 
   /* The first ~1k of the body of the message is now available in the
      utf-8 string BODY.  Walk over it to figure out its type.  */
-  for (p=body; p && *p; p = (p=strchr (p+1, '\n')? (p+1):NULL))
+  for (p=body; p && *p; p = ((p=strchr (p+1, '\n')) ? (p+1) : NULL))
     {
       if (!strncmp (p, "-----BEGIN PGP ", 15))
         {
diff --git a/src/message.cpp b/src/message.cpp
index db3e1ff..c36e7fc 100644
--- a/src/message.cpp
+++ b/src/message.cpp
@@ -1012,7 +1012,7 @@ message_decrypt (LPMESSAGE message, msgtype_t msgtype, int force, HWND hwnd)
             }
 
 
-          if (part1_idx == -1 || part2_idx == -1 
+          if ((part1_idx == -1 || part2_idx == -1)
               && !table[0].end_of_table && table[1].end_of_table
               && table[0].attach_type == ATTACHTYPE_MOSS
               && table[0].filename 
diff --git a/src/oomhelp.cpp b/src/oomhelp.cpp
index ad50ec9..dd12002 100644
--- a/src/oomhelp.cpp
+++ b/src/oomhelp.cpp
@@ -123,8 +123,7 @@ dump_excepinfo (EXCEPINFO err)
              err.bstrSource, err.bstrDescription, err.bstrHelpFile,
              (unsigned int) err.dwHelpContext,
              (unsigned int) err.pfnDeferredFillIn,
-             (unsigned int) err.scode,
-             SRCNAME, __func__);
+             (unsigned int) err.scode);
 }
 
 /* Return the OOM object's IDispatch interface described by FULLNAME.

commit 364f116578c37ad97ba6ff27c5e6e688fc20e21d
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Oct 13 15:46:51 2015 +0200

    Release application event sink instead of deleting
    
    * src/gpgoladdin.cpp (GpgolAddin::~GpgolAddin): Release instead
      of delete.
    
    --
    delete for IDispatch results in undefined behavior.

diff --git a/src/gpgoladdin.cpp b/src/gpgoladdin.cpp
index 0a0e89d..e154285 100644
--- a/src/gpgoladdin.cpp
+++ b/src/gpgoladdin.cpp
@@ -167,7 +167,7 @@ GpgolAddin::~GpgolAddin (void)
              SRCNAME, __func__);
 
   delete m_ribbonExtender;
-  delete m_applicationEventSink;
+  m_applicationEventSink->Release ();
 
   if (!m_disabled)
     {

commit b4529483bfe8aa7d633bc9e1f69342ef5eae489c
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Oct 13 15:42:57 2015 +0200

    Fix unused variable warnings
    
    * src/eventsink.h (USE_INVOKE_ARGS): Also add dispid.
    * src/gpgoladdin.cpp (GpgolAddinFactory::CreateInstance): Unused punk.
     (GpgolAddin::Invoke, GpgolRibbonExtender::Invoke): Use invoke args.
    * src/mailitem.cpp (GpgolItemEvents::Write): Remove want_html var.
    * src/ribbon-callbacks.cpp (message_flag_status): Remove window param.
      (mark_mime_action): Update call accordingly.

diff --git a/src/eventsink.h b/src/eventsink.h
index 4886d65..83e6772 100644
--- a/src/eventsink.h
+++ b/src/eventsink.h
@@ -85,8 +85,8 @@ STDMETHODIMP subcls::Invoke (DISPID dispid, REFIID riid, LCID lcid,      \
 /* End of macro EVENT_SINK_INVOKE.  */
 
 #define USE_INVOKE_ARGS                                                  \
-  (void)riid; (void)lcid; (void) flags; (void)parms; (void)result;       \
-  (void)exepinfo; (void)argerr;
+  (void)riid; (void)lcid; (void)flags; (void)parms; (void)result;       \
+  (void)exepinfo; (void)argerr; (void)dispid;
 /* End of macro USE_INVOKE_ARGS. */
 
 #define EVENT_SINK_DEFAULT_DTOR_CODE(subcls)                             \
diff --git a/src/gpgoladdin.cpp b/src/gpgoladdin.cpp
index c7da01d..0a0e89d 100644
--- a/src/gpgoladdin.cpp
+++ b/src/gpgoladdin.cpp
@@ -46,6 +46,7 @@
 #include "gpgol-ids.h"
 #include "ribbon-callbacks.h"
 #include "eventsinks.h"
+#include "eventsink.h"
 #include "windowmessages.h"
 
 #define TRACEPOINT() do { log_debug ("%s:%s:%d: tracepoint\n", \
@@ -120,6 +121,7 @@ STDMETHODIMP GpgolAddinFactory::QueryInterface (REFIID riid, LPVOID* ppvObj)
 STDMETHODIMP GpgolAddinFactory::CreateInstance (LPUNKNOWN punk, REFIID riid,
                                                 LPVOID* ppvObj)
 {
+  (void)punk;
   *ppvObj = NULL;
 
   GpgolAddin* obj = new GpgolAddin();
@@ -341,6 +343,7 @@ GpgolAddin::Invoke (DISPID dispid, REFIID riid, LCID lcid,
                     WORD flags, DISPPARAMS *parms, VARIANT *result,
                     EXCEPINFO *exepinfo, UINT *argerr)
 {
+  USE_INVOKE_ARGS
   TRACEPOINT(); /* Should not happen */
   return DISP_E_MEMBERNOTFOUND;
 }
@@ -483,6 +486,7 @@ GpgolRibbonExtender::Invoke (DISPID dispid, REFIID riid, LCID lcid,
                              WORD flags, DISPPARAMS *parms, VARIANT *result,
                              EXCEPINFO *exepinfo, UINT *argerr)
 {
+  USE_INVOKE_ARGS
   log_debug ("%s:%s: enter with dispid: %x",
              SRCNAME, __func__, (int)dispid);
 
diff --git a/src/mailitem.cpp b/src/mailitem.cpp
index 9cdc2a5..b1ad383 100644
--- a/src/mailitem.cpp
+++ b/src/mailitem.cpp
@@ -118,7 +118,7 @@ GpgolItemEvents::Read (void)
 STDMETHODIMP
 GpgolItemEvents::Write (PBOOL cancel_default)
 {
-  bool sign, encrypt, need_crypto, want_html;
+  bool sign, encrypt, need_crypto;
   HWND hwnd = NULL;  /* Fixme.  */
  
   log_debug ("%s:%s: Called (this=%p) (send_seen=%d)",
@@ -153,11 +153,7 @@ GpgolItemEvents::Write (PBOOL cancel_default)
 
       bodyfmt = get_oom_int (m_object, "BodyFormat");
 
-      if (bodyfmt == 1)
-        want_html = 0;
-      else if (bodyfmt == 2)
-        want_html = 1;
-      else
+      if (bodyfmt != 1 && bodyfmt != 2)
         {
           log_debug ("%s:%s: BodyFormat is %d", SRCNAME, __func__, bodyfmt);
           MessageBox (hwnd,
diff --git a/src/ribbon-callbacks.cpp b/src/ribbon-callbacks.cpp
index 882240e..5802153 100644
--- a/src/ribbon-callbacks.cpp
+++ b/src/ribbon-callbacks.cpp
@@ -1234,7 +1234,7 @@ HRESULT verifyBody (LPDISPATCH ctrl)
 }
 
 static void
-message_flag_status (HWND window, int flags)
+message_flag_status (int flags)
 {
   const char * message;
   if (flags & OP_ENCRYPT && flags & OP_SIGN)
@@ -1264,7 +1264,6 @@ mark_mime_action (LPDISPATCH ctrl, int flags)
 {
   HRESULT hr;
   HRESULT rc = E_FAIL;
-  HWND cur_window;
   LPDISPATCH context = NULL,
              mailitem = NULL;
   LPMESSAGE message = NULL;
@@ -1275,7 +1274,6 @@ mark_mime_action (LPDISPATCH ctrl, int flags)
   hr = getContext (ctrl, &context);
   if (FAILED(hr))
       return hr;
-  cur_window = get_oom_context_window (context);
 
   mailitem = get_oom_object (context, "CurrentItem");
 
@@ -1305,7 +1303,7 @@ mark_mime_action (LPDISPATCH ctrl, int flags)
                  SRCNAME, __func__);
     }
 
-  message_flag_status (cur_window, newflags);
+  message_flag_status (newflags);
 
   rc = S_OK;
 

commit aeec015b64fa3440fae8c70d84fd3a9666ccc1be
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Oct 13 15:38:52 2015 +0200

    Don't check for stpcpy.
    
    * configure.ac: Don't check for stpcpy.
    * src/rfc822parse.c (my_stpcpy): Define our own stpcpy
      unconditionally.
    
    --
    Windows does not have stpcpy and It's not part of mingw. The
    function check failed accordingly but GCC still warned about
    shadowing a builtin function.
    
    Just avoid this trouble and always define our own function.

diff --git a/configure.ac b/configure.ac
index b8b16b6..d11744d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -183,8 +183,6 @@ USE_NLS=yes
 AC_HEADER_STDC
 AC_CHECK_HEADERS(string.h unistd.h langinfo.h termio.h locale.h)
 
-AC_CHECK_FUNCS(stpcpy)
-
 # Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
 AC_C_INLINE
diff --git a/src/rfc822parse.c b/src/rfc822parse.c
index 760e8f7..d1e3bf2 100644
--- a/src/rfc822parse.c
+++ b/src/rfc822parse.c
@@ -154,9 +154,8 @@ capitalize_header_name (unsigned char *name)
 }
 
 
-#ifndef HAVE_STPCPY
 static char *
-stpcpy (char *a,const char *b)
+my_stpcpy (char *a,const char *b)
 {
   while (*b)
     *a++ = *b++;
@@ -164,7 +163,6 @@ stpcpy (char *a,const char *b)
 
   return (char*)a;
 }
-#endif
 
 /* If a callback has been registerd, call it for the event of type
    EVENT. */
@@ -548,11 +546,11 @@ rfc822parse_get_field (rfc822parse_t msg, const char *name, int which,
   buf = p = malloc (n);
   if (buf)
     {
-      p = stpcpy (p, h->line);
+      p = my_stpcpy (p, h->line);
       *p++ = '\n';
       for (h2 = h->next; h2 && h2->cont; h2 = h2->next)
         {
-          p = stpcpy (p, h2->line);
+          p = my_stpcpy (p, h2->line);
           *p++ = '\n';
         }
       p[-1] = 0;

commit 7df5ec613b717aaefa3249342bc6f92f6d7f19e7
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Oct 13 15:27:42 2015 +0200

    Fix write-string warnings.
    
    * src/gpgolstr.cpp, src/gpgolstr.h: New. Small string wrapper.
    * src/Makefile.am: Add to sources.
    * src/display.cpp (open_inspector),
     src/mapihelp.cpp (create_gpgol_tag, get_internetcharsetbody_tag),
     src/ribbon-callbacks.cpp (do_composer_action, do_reader_action),
     src/message.cpp (pgp_body_to_attachment): Use it.
    
    --
    If MS wants mutable strings, MS get's mutable strings.

diff --git a/src/Makefile.am b/src/Makefile.am
index 93312cd..ef859bf 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -91,7 +91,8 @@ gpgol_SOURCES = \
 	eventsinks.h application-events.cpp \
 	mailitem-events.cpp \
 	attachment.h attachment.cpp \
-	windowmessages.h windowmessages.cpp
+	windowmessages.h windowmessages.cpp \
+	gpgolstr.h gpgolstr.cpp
 
 
 #treeview_SOURCES = treeview.c
diff --git a/src/display.cpp b/src/display.cpp
index c81d78c..bd10921 100644
--- a/src/display.cpp
+++ b/src/display.cpp
@@ -31,6 +31,7 @@
 #include "mapihelp.h"
 #include "olflange-def.h"
 #include "display.h"
+#include "gpgolstr.h"
 
 
 /* Check wether the string BODY is HTML formatted. */
@@ -456,12 +457,12 @@ open_inspector (LPEXCHEXTCALLBACK peecb, LPMESSAGE message)
   message2->Release(); message2 = NULL;
 
   hr = session->ShowForm (0,
-                          mdb, mfolder, 
+                          mdb, mfolder,
                           NULL,  token,
-                          NULL,  
+                          NULL,
                           0,
                           0,  0,
-                          0,  "IPM.Note");
+                          0, GpgOLStr("IPM.Note"));
   log_debug ("%s:%s: ShowForm result: hr=%#lx\n", 
              SRCNAME, __func__, hr);
   
diff --git a/src/gpgolstr.cpp b/src/gpgolstr.cpp
new file mode 100644
index 0000000..d24dd35
--- /dev/null
+++ b/src/gpgolstr.cpp
@@ -0,0 +1,60 @@
+/* gpgolstr.cpp - String helper class for Outlook API.
+ *    Copyright (C) 2015 Intevation 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.1 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, see <http://www.gnu.org/licenses/>.
+ */
+#include "gpgolstr.h"
+#include "util.h"
+
+GpgOLStr::GpgOLStr(const char *str) :
+  m_utf8str(NULL), m_widestr(NULL)
+{
+  if (!str)
+    return;
+  m_utf8str = strdup (str);
+}
+
+GpgOLStr::GpgOLStr(const wchar_t *str) :
+  m_utf8str(NULL), m_widestr(NULL)
+{
+  if (!str)
+    return;
+  m_widestr = wcsdup (str);
+}
+
+GpgOLStr::~GpgOLStr()
+{
+  xfree (m_utf8str);
+  xfree (m_widestr);
+}
+
+GpgOLStr::operator char*()
+{
+  if (!m_utf8str && m_widestr)
+    {
+      m_utf8str = wchar_to_utf8_2 (m_widestr, wcslen (m_widestr));
+    }
+  return m_utf8str;
+}
+
+GpgOLStr::operator wchar_t*()
+{
+  if (!m_widestr && m_utf8str)
+    {
+      m_widestr = utf8_to_wchar2 (m_utf8str, strlen (m_utf8str));
+    }
+  return m_widestr;
+}
diff --git a/src/gpgolstr.h b/src/gpgolstr.h
new file mode 100644
index 0000000..5bd6d26
--- /dev/null
+++ b/src/gpgolstr.h
@@ -0,0 +1,44 @@
+/* gpgolstr.h - String helper class for Outlook API.
+ *    Copyright (C) 2015 Intevation 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.1 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stddef.h>
+
+/* Small string wrapper that handles wchar / utf8 conversion and
+   can be used as a temporary object for an allocated string.
+   Modifying the char or wchar_t pointer directly results in
+   undefined behavior.
+   They are intended to be used for API calls that expect a
+   mutable string but are actually a constant.
+   */
+class GpgOLStr
+{
+public:
+  GpgOLStr() : m_utf8str(NULL), m_widestr(NULL) {}
+
+  GpgOLStr(const char *str);
+  GpgOLStr(const wchar_t *widestr);
+  ~GpgOLStr();
+
+  operator char* ();
+  operator wchar_t* ();
+
+private:
+  char *m_utf8str;
+  wchar_t *m_widestr;
+};
diff --git a/src/mapihelp.cpp b/src/mapihelp.cpp
index 049f784..8460bcc 100644
--- a/src/mapihelp.cpp
+++ b/src/mapihelp.cpp
@@ -31,6 +31,7 @@
 #include "serpent.h"
 #include "mapihelp.h"
 #include "parsetlv.h"
+#include "gpgolstr.h"
 
 #ifndef CRYPT_E_STREAM_INSUFFICIENT_DATA
 #define CRYPT_E_STREAM_INSUFFICIENT_DATA 0x80091011
@@ -110,11 +111,12 @@ log_mapi_property (LPMESSAGE message, ULONG prop, const char *propname)
 
 /* Helper to create a named property. */
 static ULONG 
-create_gpgol_tag (LPMESSAGE message, wchar_t *name, const char *func)
+create_gpgol_tag (LPMESSAGE message, const wchar_t *name, const char *func)
 {
   HRESULT hr;
   LPSPropTagArray proparr = NULL;
-  MAPINAMEID mnid, *pmnid;	
+  MAPINAMEID mnid, *pmnid;
+  GpgOLStr propname(name);
   /* {31805ab8-3e92-11dc-879c-00061b031004}: GpgOL custom properties.  */
   GUID guid = {0x31805ab8, 0x3e92, 0x11dc, {0x87, 0x9c, 0x00, 0x06,
                                             0x1b, 0x03, 0x10, 0x04}};
@@ -123,7 +125,7 @@ create_gpgol_tag (LPMESSAGE message, wchar_t *name, const char *func)
   memset (&mnid, 0, sizeof mnid);
   mnid.lpguid = &guid;
   mnid.ulKind = MNID_STRING;
-  mnid.Kind.lpwstrName = name;
+  mnid.Kind.lpwstrName = propname;
   pmnid = &mnid;
   hr = message->GetIDsFromNames (1, &pmnid, MAPI_CREATE, &proparr);
   if (FAILED (hr))
@@ -254,12 +256,13 @@ get_internetcharsetbody_tag (LPMESSAGE message, ULONG *r_tag)
   /* {4E3A7680-B77A-11D0-9DA5-00C04FD65685} */
   GUID guid = {0x4E3A7680, 0xB77A, 0x11D0, {0x9D, 0xA5, 0x00, 0xC0,
                                             0x4F, 0xD6, 0x56, 0x85}};
+  GpgOLStr propname (L"Internet Charset Body");
   int result;
 
   memset (&mnid, 0, sizeof mnid);
   mnid.lpguid = &guid;
   mnid.ulKind = MNID_STRING;
-  mnid.Kind.lpwstrName = L"Internet Charset Body";
+  mnid.Kind.lpwstrName = propname;
   pmnid = &mnid;
   hr = message->GetIDsFromNames (1, &pmnid, 0, &proparr);
   if (FAILED (hr))
diff --git a/src/message.cpp b/src/message.cpp
index 38b095e..db3e1ff 100644
--- a/src/message.cpp
+++ b/src/message.cpp
@@ -31,6 +31,7 @@
 #include "mimemaker.h"
 #include "display.h"
 #include "message.h"
+#include "gpgolstr.h"
 
 #define TRACEPOINT() do { log_debug ("%s:%s:%d: tracepoint\n", \
                                      SRCNAME, __func__, __LINE__); \
@@ -687,6 +688,7 @@ pgp_body_to_attachment (LPMESSAGE message)
   SPropValue prop;
   LPSTREAM outstream = NULL;
   LPUNKNOWN punk;
+  GpgOLStr body_filename (PGPBODYFILENAME);
 
   instream = mapi_get_body_as_stream (message);
   if (!instream)
@@ -733,7 +735,7 @@ pgp_body_to_attachment (LPMESSAGE message)
     }
 
   prop.ulPropTag = PR_ATTACH_FILENAME_A;
-  prop.Value.lpszA = PGPBODYFILENAME;
+  prop.Value.lpszA = body_filename;
   hr = HrSetOneProp ((LPMAPIPROP)newatt, &prop);
   if (hr)
     {
diff --git a/src/ribbon-callbacks.cpp b/src/ribbon-callbacks.cpp
index ade0330..882240e 100644
--- a/src/ribbon-callbacks.cpp
+++ b/src/ribbon-callbacks.cpp
@@ -45,6 +45,7 @@
 #include "mapihelp.h"
 #include "mimemaker.h"
 #include "filetype.h"
+#include "gpgolstr.h"
 
 /* Gets the context of a ribbon control. And prints some
    useful debug output */
@@ -265,7 +266,7 @@ do_composer_action (LPDISPATCH ctrl, int flags)
   hr = OpenStreamOnFile (MAPIAllocateBuffer, MAPIFreeBuffer,
                          (SOF_UNIQUEFILENAME | STGM_DELETEONRELEASE
                           | STGM_CREATE | STGM_READWRITE),
-                         NULL, "GPG", &tmpstream);
+                         NULL, GpgOLStr("GPG"), &tmpstream);
 
   if (FAILED (hr))
     {
@@ -714,7 +715,7 @@ do_reader_action (LPDISPATCH ctrl, int flags)
   hr = OpenStreamOnFile (MAPIAllocateBuffer, MAPIFreeBuffer,
                          (SOF_UNIQUEFILENAME | STGM_DELETEONRELEASE
                           | STGM_CREATE | STGM_READWRITE),
-                         NULL, "GPG", &tmpstream);
+                         NULL, GpgOLStr("GPG"), &tmpstream);
 
   if (FAILED (hr))
     {

commit c25fec2b0e18fcf954d048e2ddb71b4186f4db49
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Oct 13 11:20:56 2015 +0200

    Fix compiler warnings in engine-assuan
    
    * src/engine-assuan.c: Don't redefine WINVER. Include windows.h
      after assuan.h (because of winsock)
      (async_worker_thread): Return 0 on success.
      (start_command): Cast status callback to correct type.

diff --git a/src/engine-assuan.c b/src/engine-assuan.c
index c7f3312..2cf1837 100644
--- a/src/engine-assuan.c
+++ b/src/engine-assuan.c
@@ -25,11 +25,9 @@
 #include <time.h>
 #include <errno.h>
 #include <assert.h>
-#define WIN32_LEAN_AND_MEAN 
-#define WINVER 0x0500  /* Required for AllowSetForegroundWindow.  */
-#include <windows.h>
 
 #include <assuan.h>
+#include <windows.h>
 #include "common.h"
 #include "engine.h"
 #include "engine-assuan.h"
@@ -1230,6 +1228,7 @@ async_worker_thread (void *dummy)
 
       LeaveCriticalSection (&work_queue_lock);
     }
+  return 0;
 }
 
 
@@ -1502,7 +1501,7 @@ start_command (assuan_context_t ctx, closure_data_t cld,
     return gpg_error (GPG_ERR_GENERAL);	/* Ooops.  */
 
   cld->cmdid = cmdid;
-  cld->status_cbs.write = status_in_cb;
+  cld->status_cbs.write = (gpgme_data_write_cb_t) status_in_cb;
   cld->assctx = ctx;
   /* Fixme: We might want to have reference counting for CLD to cope
      with the problem that the gpgme data object uses CLD which might

commit 869bedfffb4aa4be8ea042e1b84e1841de24f483
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Oct 13 10:33:58 2015 +0200

    Log error in mimemaker write_attachments.
    
    * src/mimemaker.c (write_attachments): Log error.
    --
    
    Fixes an unused variable warning and makes sense.

diff --git a/src/mimemaker.c b/src/mimemaker.c
index 93450db..55e5782 100644
--- a/src/mimemaker.c
+++ b/src/mimemaker.c
@@ -942,6 +942,10 @@ write_attachments (sink_t sink,
             return -1;
           rc = write_part (sink, buffer, buflen, boundary,
                            table[idx].filename, 0);
+          if (rc)
+            {
+              log_error ("Write part returned err: %i", rc);
+            }
           xfree (buffer);
         }
   return 0;

commit a8d772736473ce8153827c335c35aff589e63d06
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Oct 13 10:27:18 2015 +0200

    Fix body handling of sent mails.
    
    * src/mailitem-events.cpp (handle_read): Work on the base message.
    
    --
    Outlook somehow is confused about the attachment
    table of our sent mails. The securemessage interface
    gives us access to the real attach table but the attachment
    table of the message itself is broken.
    
    So unprotect attachments does not work for sent mails
    as the attachment table of the mapiitem is invalid.
    We need to somehow get outlook to use the attachment table
    of the base message and and then decrypt those.
    This will probably mean removing all attachments for the
    message and adding the attachments from the base message then
    we can call unprotect_attachments as usual.
    
    For now this works only for the body.

diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp
index dab2c99..e4f6044 100644
--- a/src/mailitem-events.cpp
+++ b/src/mailitem-events.cpp
@@ -107,21 +107,24 @@ MailItemEvents::handle_read()
   int err;
   int is_html, was_protected = 0;
   char *body = NULL;
-  LPMESSAGE message = get_oom_message (m_object);
-  if (!message)
+  /* Outlook somehow is confused about the attachment
+     table of our sent mails. The securemessage interface
+     gives us access to the real attach table but the attachment
+     table of the message itself is broken. */
+  LPMESSAGE base_message = get_oom_base_message (m_object);
+  if (!base_message)
     {
-      log_error ("%s:%s: Failed to get message \n",
+      log_error ("%s:%s: Failed to get base message \n",
                  SRCNAME, __func__);
       return S_OK;
     }
-  err = mapi_get_gpgol_body_attachment (message, &body, NULL,
+  err = mapi_get_gpgol_body_attachment (base_message, &body, NULL,
                                         &is_html, &was_protected);
-  message->Release ();
   if (err || !body)
     {
       log_error ("%s:%s: Failed to get body attachment of \n",
                  SRCNAME, __func__);
-      return S_OK;
+      goto done;
     }
   if (put_oom_string (m_object, is_html ? "HTMLBody" : "Body", body))
     {
@@ -130,13 +133,21 @@ MailItemEvents::handle_read()
     }
 
   xfree (body);
-
+  /* TODO: unprotect attachments does not work for sent mails
+     as the attachment table of the mapiitem is invalid.
+     We need to somehow get outlook to use the attachment table
+     of the base message and and then decrypt those.
+     This will probably mean removing all attachments for the
+     message and adding the attachments from the base message then
+     we can call unprotect_attachments as usual. */
   if (unprotect_attachments (m_object))
     {
       log_error ("%s:%s: Failed to unprotect attachments. \n",
                  SRCNAME, __func__);
     }
 
+done:
+  RELDISP (base_message);
   return S_OK;
 }
 

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

Summary of changes:
 configure.ac                     |  2 --
 src/Makefile.am                  |  3 +-
 src/display.cpp                  |  7 +++--
 src/engine-assuan.c              |  7 ++---
 src/eventsink.h                  |  4 +--
 src/gpgoladdin.cpp               |  6 +++-
 src/gpgolstr.cpp                 | 60 ++++++++++++++++++++++++++++++++++++++++
 src/{eventsinks.h => gpgolstr.h} | 34 +++++++++++++++++------
 src/mailitem-events.cpp          | 25 ++++++++++++-----
 src/mailitem.cpp                 |  8 ++----
 src/mapihelp.cpp                 | 13 +++++----
 src/message.cpp                  |  6 ++--
 src/mimemaker.c                  |  4 +++
 src/oomhelp.cpp                  |  3 +-
 src/rfc822parse.c                |  8 ++----
 src/ribbon-callbacks.cpp         | 11 ++++----
 16 files changed, 146 insertions(+), 55 deletions(-)
 create mode 100644 src/gpgolstr.cpp
 copy src/{eventsinks.h => gpgolstr.h} (52%)


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




More information about the Gnupg-commits mailing list