[git] GpgOL - branch, master, updated. gpgol-2.2.0-51-g7e76531

by Andre Heinecke cvs at cvs.gnupg.org
Wed Jul 11 08:35:44 CEST 2018


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  7e76531304ec9fbd5227ed511cea0f0df68fa9e0 (commit)
       via  df2699ee2678466fbf5799a385f9a9c8d9bb66ee (commit)
      from  42a0424b7cf2b7d3ebb80c8d70eadb21c67b620d (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 7e76531304ec9fbd5227ed511cea0f0df68fa9e0
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Jul 11 08:32:57 2018 +0200

    Abort attachment process chain in case of error
    
    * src/mail.cpp (add_attachments_o): Don't continue with attachment
    processing if something failed.
    
    --
    This should make the errors clearer and avoid undefined behavior
    in case e.g. obtaining an attachment tmp name fails.
    
    GnuPG-Bug-Id: T4063

diff --git a/src/mail.cpp b/src/mail.cpp
index aaa15c5..6c74633 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -647,9 +647,10 @@ static int
 add_attachments_o(LPDISPATCH mail,
                 std::vector<std::shared_ptr<Attachment> > attachments)
 {
-  int err = 0;
+  bool anyError = false;
   for (auto att: attachments)
     {
+      int err = 0;
       if (att->get_display_name().empty())
         {
           log_error ("%s:%s: Ignoring attachment without display name.",
@@ -660,13 +661,19 @@ add_attachments_o(LPDISPATCH mail,
       HANDLE hFile;
       wchar_t* wchar_file = get_tmp_outfile (wchar_name,
                                              &hFile);
-      if (copy_attachment_to_file (att, hFile))
+      if (!wchar_file)
+        {
+          log_error ("%s:%s: Failed to obtain a tmp filename for: %s",
+                     SRCNAME, __func__, att->get_display_name().c_str());
+          err = 1;
+        }
+      if (!err && copy_attachment_to_file (att, hFile))
         {
           log_error ("%s:%s: Failed to copy attachment %s to temp file",
                      SRCNAME, __func__, att->get_display_name().c_str());
           err = 1;
         }
-      if (add_oom_attachment (mail, wchar_file, wchar_name))
+      if (!err && add_oom_attachment (mail, wchar_file, wchar_name))
         {
           log_error ("%s:%s: Failed to add attachment: %s",
                      SRCNAME, __func__, att->get_display_name().c_str());
@@ -682,9 +689,16 @@ add_attachments_o(LPDISPATCH mail,
       xfree (wchar_file);
       xfree (wchar_name);
 
-      err = fixup_last_attachment_o (mail, att);
+      if (!err)
+        {
+          err = fixup_last_attachment_o (mail, att);
+        }
+      if (err)
+        {
+          anyError = true;
+        }
     }
-  return err;
+  return anyError;
 }
 
 GPGRT_LOCK_DEFINE(parser_lock);

commit df2699ee2678466fbf5799a385f9a9c8d9bb66ee
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Jul 11 08:31:54 2018 +0200

    Log w32 error and tried filename for tmp attach
    
    * src/common.cpp (get_tmp_outfile): Log error and tried filename.
    
    --
    This will help analyse issues like:
    GnuPG-Bug-Id: T4063

diff --git a/src/common.cpp b/src/common.cpp
index 629690d..feb68ff 100644
--- a/src/common.cpp
+++ b/src/common.cpp
@@ -405,10 +405,6 @@ get_tmp_outfile (wchar_t *name, HANDLE *outHandle)
       return NULL;
     }
 
-  /* We should probably use the unicode variants here
-     but this would mean adding OpenStreamOnFileW to
-     out mapi */
-
   if (!GetTempPathW (MAX_PATH, tmpPath))
     {
       log_error ("%s:%s: Could not get tmp path.",
@@ -429,6 +425,8 @@ get_tmp_outfile (wchar_t *name, HANDLE *outHandle)
                                     FILE_ATTRIBUTE_TEMPORARY,
                                     NULL)) == INVALID_HANDLE_VALUE)
     {
+      log_debug_w32 (-1, "%s:%s: Failed to open candidate %S.",
+                     SRCNAME, __func__, outName);
       wchar_t fnameBuf[MAX_PATH + 1];
       wchar_t origName[MAX_PATH + 1];
       memset (fnameBuf, 0, MAX_PATH + 1);

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

Summary of changes:
 src/common.cpp |  6 ++----
 src/mail.cpp   | 24 +++++++++++++++++++-----
 2 files changed, 21 insertions(+), 9 deletions(-)


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




More information about the Gnupg-commits mailing list