[git] GpgOL - branch, master, updated. gpgol-2.0.3-19-g6f7b068

by Andre Heinecke cvs at cvs.gnupg.org
Thu Nov 30 14:02:28 CET 2017


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  6f7b068a4aaa7aa92c710c0d0b4e3393ad5299c4 (commit)
       via  13b36b906fd5f5970fdbff70e8ca7f378103441a (commit)
      from  a03d8906e44141d6c34a3e7f0367d1073b5729a4 (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 6f7b068a4aaa7aa92c710c0d0b4e3393ad5299c4
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Nov 30 13:59:59 2017 +0100

    Add warnings about unsupported G Sync actions
    
    * src/mail.cpp (Mail::update_oom_data): Save if account
    is gsync account.
    (Mail::encrypt_sign): Warn / Block actions for GSync accounts.
    * src/mimemaker.cpp (count_usable_attachments): Expose so that
    it can be used in Mail.
    
    --
    It's better to fail early and loudly instead of creating
    broken mails.
    
    GnuPG-Bug-Id: T3545

diff --git a/src/mail.cpp b/src/mail.cpp
index 29caeca..7621494 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -27,6 +27,7 @@
 #include "eventsinks.h"
 #include "attachment.h"
 #include "mapihelp.h"
+#include "mimemaker.h"
 #include "message.h"
 #include "revert.h"
 #include "gpgoladdin.h"
@@ -983,7 +984,55 @@ Mail::encrypt_sign ()
 
   const auto window = get_active_hwnd ();
 
-  m_do_inline = opt.inline_pgp;
+  if (m_is_gsuite)
+    {
+      auto att_table = mapi_create_attach_table (message, 0);
+      int n_att_usable = count_usable_attachments (att_table);
+      mapi_release_attach_table (att_table);
+      /* Check for attachments if we have some abort. */
+      if (n_att_usable)
+        {
+          MessageBox (window,
+                      _("G Suite Sync breaks outgoing crypto mails "
+                        "with attachments.\nUsing crypto and attachments "
+                        "with G Suite Sync is not supported.\n\n"
+                        "See: https://dev.gnupg.org/T3545 for details."),
+                      _("GpgOL: Oops, G Suite Sync account detected"),
+                      MB_ICONINFORMATION|MB_OK);
+          return -1;
+        }
+      if (flags == 2)
+        {
+          MessageBox (window,
+                      _("G Suite Sync breaks outgoing signed mails.\n"
+                        "Ensuring mail integrity (signing) with G Suite Sync "
+                        "is not supported.\n\n"
+                        "See: https://dev.gnupg.org/T3545 for details."),
+                      _("GpgOL: Oops, G Suite Sync account detected"),
+                      MB_ICONINFORMATION|MB_OK);
+          return -1;
+        }
+      if (flags == 3)
+        {
+          if(MessageBox (window,
+                        _("G Suite Sync breaks outgoing signed mails.\n"
+                          "Ensuring mail integrity (signing) with G Suite Sync "
+                          "is not supported.\n\n"
+                          "See: https://dev.gnupg.org/T3545 for details.\n\n"
+                          "Do you want to only encrypt the message?"),
+                        _("GpgOL: Oops, G Suite Sync account detected"),
+                        MB_ICONINFORMATION|MB_YESNO) != IDYES)
+            {
+              return -1;
+            }
+          else
+            {
+              flags = 1;
+            }
+        }
+    }
+
+  m_do_inline = m_is_gsuite ? true : opt.inline_pgp;
 
   EnableWindow (window, FALSE);
   if (flags == 3)
@@ -1107,7 +1156,15 @@ Mail::update_oom_data ()
   if (sender)
     {
       char *buf = get_oom_string (sender, "SmtpAddress");
+      char *dispName = get_oom_string (sender, "DisplayName");
       gpgol_release (sender);
+
+      /* Check for G Suite account */
+      if (dispName && !strcmp ("G Suite", dispName))
+        {
+          m_is_gsuite = true;
+        }
+      xfree (dispName);
       if (buf && strlen (buf))
         {
           log_debug ("%s:%s Sender fallback 1", SRCNAME, __func__);
diff --git a/src/mail.h b/src/mail.h
index 2ea7834..d26f477 100644
--- a/src/mail.h
+++ b/src/mail.h
@@ -359,5 +359,6 @@ private:
   std::string m_uuid;
   std::string m_orig_body;
   bool m_do_inline;
+  bool m_is_gsuite; /* Are we on a gsuite account */
 };
 #endif // MAIL_H
diff --git a/src/mimemaker.cpp b/src/mimemaker.cpp
index 50d2485..ba9bddd 100644
--- a/src/mimemaker.cpp
+++ b/src/mimemaker.cpp
@@ -962,7 +962,7 @@ write_part (sink_t sink, const char *data, size_t datalen,
 
 /* Return the number of attachments in TABLE to be put into the MIME
    message.  */
-static int
+int
 count_usable_attachments (mapi_attach_item_t *table)
 {
   int idx, count = 0;
diff --git a/src/mimemaker.h b/src/mimemaker.h
index 101f750..c89a495 100644
--- a/src/mimemaker.h
+++ b/src/mimemaker.h
@@ -71,6 +71,8 @@ int write_buffer (sink_t sink, const void *data, size_t datalen);
 int restore_msg_from_moss (LPMESSAGE message, LPDISPATCH moss_att,
                            msgtype_t type, char *msgcls);
 
+int count_usable_attachments (mapi_attach_item_t *table);
+
 #ifdef __cplusplus
 }
 #endif

commit 13b36b906fd5f5970fdbff70e8ca7f378103441a
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Nov 30 13:58:57 2017 +0100

    Fix logic error in two options
    
    * src/main.c (read_options): Fix reading autoresolve and
    replyCrypt.

diff --git a/src/main.c b/src/main.c
index 631d438..69e06ef 100644
--- a/src/main.c
+++ b/src/main.c
@@ -419,10 +419,10 @@ read_options (void)
   opt.inline_pgp = val == NULL || *val != '1'? 0 : 1;
   xfree (val); val = NULL;
   load_extension_value ("autoresolve", &val);
-  opt.autoresolve = val == NULL || *val != '1'? 0 : 1;
+  opt.autoresolve = val == NULL ? 1 : *val != '1' ? 0 : 1;
   xfree (val); val = NULL;
   load_extension_value ("replyCrypt", &val);
-  opt.reply_crypt = val == NULL || *val != '1'? 1 : 0;
+  opt.reply_crypt = val == NULL ? 1 : *val != '1' ? 0 : 1;
   xfree (val); val = NULL;
   load_extension_value ("deprecationShown", &val);
   opt.deprecation_shown = val == NULL || *val != '1'? 0 : 1;

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

Summary of changes:
 src/mail.cpp      | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 src/mail.h        |  1 +
 src/main.c        |  4 ++--
 src/mimemaker.cpp |  2 +-
 src/mimemaker.h   |  2 ++
 5 files changed, 64 insertions(+), 4 deletions(-)


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




More information about the Gnupg-commits mailing list