[git] GpgOL - branch, master, updated. gpgol-2.2.0-27-gfb09b26

by Andre Heinecke cvs at cvs.gnupg.org
Tue Jun 26 11:19:04 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  fb09b2671359ce56b5c17afb8c7315cd0c63e088 (commit)
       via  63047f81e06b1becbead7e361691999063d1dfee (commit)
       via  3c04640f8cc815aa49b373cc2545652afe194fcf (commit)
       via  74a6555e2e5ddce8ad64a406e15427935a38a99a (commit)
       via  60eb684fa67777ab07c10fc791328794017c97d0 (commit)
      from  1b9eb2a608ea5053575298655ddb9c12837d2b1a (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 fb09b2671359ce56b5c17afb8c7315cd0c63e088
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Jun 26 11:17:24 2018 +0200

    Improve state handling of WKS Mails
    
    * src/wks-helper.cpp: Add new PublishInProgress state. This
    avoids the possibility of multiple notifications due to the
    late advancement out of the needspublish state.

diff --git a/src/wks-helper.cpp b/src/wks-helper.cpp
index b11d7cb..7edb0ea 100644
--- a/src/wks-helper.cpp
+++ b/src/wks-helper.cpp
@@ -324,8 +324,14 @@ WKSHelper::load () const
         }
 
       WKSState state = (WKSState) strtol (states[0].c_str (), nullptr, 10);
-      time_t update_time = (time_t) strtol (states[1].c_str (), nullptr, 10);
+      if (state == PublishInProgress)
+        {
+          /* Probably an error during the last publish. Let's start again. */
+          update_state (mbox, NotChecked, false);
+          continue;
+        }
 
+      time_t update_time = (time_t) strtol (states[1].c_str (), nullptr, 10);
       update_state (mbox, state, false);
       update_last_checked (mbox, update_time, false);
     }
@@ -437,6 +443,7 @@ WKSHelper::start_publish (const std::string &mbox) const
   log_debug ("%s:%s: Start publish for '%s'",
              SRCNAME, __func__, mbox.c_str ());
 
+  update_state (mbox, PublishInProgress);
   const auto key = GpgME::Key::locate (mbox.c_str ());
 
   if (key.isNull ())
@@ -509,6 +516,8 @@ WKSHelper::start_publish (const std::string &mbox) const
                            "your provider to finish the registration."),
                          _("GpgOL: Registration request sent!"), MB_OK);
     }
+
+  update_state (mbox, RequestSent);
   return;
 }
 
diff --git a/src/wks-helper.h b/src/wks-helper.h
index be3ae7b..db4a776 100644
--- a/src/wks-helper.h
+++ b/src/wks-helper.h
@@ -52,6 +52,7 @@ public:
         IsPublished, /* <-- WKS is supported for this address and published */
         ConfirmationSeen, /* A confirmation request was seen for this mail addres. */
         NeedsUpdate, /* <-- Not yet implemeted. */
+        PublishInProgress, /* <-- Publishing is currently in progress. */
         RequestSent, /* <-- A publishing request has been sent. */
         PublishDenied, /* <-- A user denied publishing. */
         ConfirmationSent, /* <-- The confirmation response was sent. */

commit 63047f81e06b1becbead7e361691999063d1dfee
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Jun 26 11:17:00 2018 +0200

    Minor improvement to german string
    
    --

diff --git a/po/de.po b/po/de.po
index 83391a4..05e6c66 100644
--- a/po/de.po
+++ b/po/de.po
@@ -718,7 +718,7 @@ msgid ""
 "You might receive a confirmation challenge from\n"
 "your provider to finish the registration."
 msgstr ""
-"Es ist möglich das ihnen ihr Mailprovider noch eine Bestätigungs-\n"
+"Es ist möglich das ihnen ihr Mailprovider noch eine Bestätigungs-"
 "Anfrage sendet um die Eintragung abzuschließen."
 
 #: src/wks-helper.cpp:506

commit 3c04640f8cc815aa49b373cc2545652afe194fcf
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Jun 26 11:15:28 2018 +0200

    Ignore propchanges on custom mails
    
    * src/mail.h (Mail::hasOverrideMimeData): New.
    * src/mailitem-events.cpp (PropertyChange): Ignore changes
    for mails with override mime data.
    * src/wks-helper.cpp (WKSHelper::send_mail): Set override
    MIME data earlier.
    
    --
    This removes auto key locates for our custom WKS Mails.

diff --git a/src/mail.h b/src/mail.h
index 4e6bb92..c5ea011 100644
--- a/src/mail.h
+++ b/src/mail.h
@@ -510,6 +510,7 @@ public:
 
   /** Get the mime data that should be used when sending. */
   std::string get_override_mime_data () const { return m_mime_data; }
+  bool hasOverrideMimeData() const { return !m_mime_data.empty(); }
 
   /** Set if this is a forward of a crypto mail. */
   void setIsForwardedCryptoMail (bool value) { m_is_forwarded_crypto_mail = value; }
diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp
index 41c1376..375a251 100644
--- a/src/mailitem-events.cpp
+++ b/src/mailitem-events.cpp
@@ -232,6 +232,11 @@ EVENT_SINK_INVOKE(MailItemEvents)
                 {
                   break;
                 }
+              if (m_mail->hasOverrideMimeData())
+                {
+                  /* This is a mail created by us. Ignore propchanges. */
+                  break;
+                }
               if (!wcscmp (prop_name, L"To") /* ||
                   !wcscmp (prop_name, L"BCC") ||
                   !wcscmp (prop_name, L"CC")
diff --git a/src/wks-helper.cpp b/src/wks-helper.cpp
index 79d2de2..b11d7cb 100644
--- a/src/wks-helper.cpp
+++ b/src/wks-helper.cpp
@@ -598,6 +598,23 @@ WKSHelper::send_mail (const std::string &mimeData) const
       return -1;
     }
 
+  /* Now we have a problem. The created LPDISPATCH pointer has
+     a different value then the one with which we saw the ItemLoad
+     event. But we want to get the mail object. So,.. surpise
+     a Hack! :-) */
+  auto last_mail = Mail::getLastMail ();
+
+  if (!Mail::isValidPtr (last_mail))
+    {
+      log_error ("%s:%s: Invalid last mail %p.",
+                 SRCNAME, __func__, last_mail);
+      return -1;
+    }
+  /* Adding to / Subject etc already leads to changes and events so
+     we set up the state before this. */
+  last_mail->setOverrideMIMEData (mimeData);
+  last_mail->setCryptState (Mail::NeedsSecondAfterWrite);
+
   if (put_oom_string (mail, "Subject", subject.c_str ()))
     {
       TRACEPOINT;
@@ -621,21 +638,6 @@ WKSHelper::send_mail (const std::string &mimeData) const
     }
   gpgol_release (account);
 
-  /* Now we have a problem. The created LPDISPATCH pointer has
-     a different value then the one with which we saw the ItemLoad
-     event. But we want to get the mail object. So,.. surpise
-     a Hack! :-) */
-  auto last_mail = Mail::getLastMail ();
-
-  if (!Mail::isValidPtr (last_mail))
-    {
-      log_error ("%s:%s: Invalid last mail %p.",
-                 SRCNAME, __func__, last_mail);
-      return -1;
-    }
-  last_mail->setOverrideMIMEData (mimeData);
-  last_mail->setCryptState (Mail::NeedsSecondAfterWrite);
-
   if (invoke_oom_method (mail, "Save", nullptr))
     {
       // Should not happen.

commit 74a6555e2e5ddce8ad64a406e15427935a38a99a
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Jun 26 11:05:34 2018 +0200

    Improve handling of UID origin
    
    * src/mail.cpp (Mail::getCryptoDetails_o, Mail::updateSigstate):
    Treat WKD origin as "shortcut to level 2.
    
    --
    As described on https://wiki.gnupg.org/AutomatedEncryption we
    treat WKD already as a shortcut to level 2 as we have an
    HTTPS secure indication from the provider that the key matches
    the mail address.
    
    This sets the green bar "verified sender" already for such mails,
    because the senders address was verified through the provider.
    
    To protect against phishing attacks this does not help but for
    these Level 3 and 4 are required.

diff --git a/src/mail.cpp b/src/mail.cpp
index 556d7eb..2418544 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -1931,7 +1931,16 @@ Mail::updateSigstate ()
     {
       m_is_signed = true;
       m_uid = get_uid_for_sender (sig.key(), sender.c_str());
-      if (m_uid.isNull() || (sig.validity() != Signature::Validity::Marginal &&
+
+      if (m_uid.origin() == GpgME::Key::OriginWKD &&
+          (sig.validity() == Signature::Validity::Unknown ||
+           sig.validity() == Signature::Validity::Marginal))
+        {
+          // WKD is a shortcut to Level 2 trust.
+          log_debug ("%s:%s: Unknown or marginal from WKD -> Level 2",
+                     SRCNAME, __func__);
+         }
+      else if (m_uid.isNull() || (sig.validity() != Signature::Validity::Marginal &&
           sig.validity() != Signature::Validity::Full &&
           sig.validity() != Signature::Validity::Ultimate))
         {
@@ -1939,7 +1948,7 @@ Mail::updateSigstate ()
           the UID needs to match.*/
           continue;
         }
-      if (sig.validity() == Signature::Validity::Marginal)
+      else if (sig.validity() == Signature::Validity::Marginal)
         {
           const auto tofu = m_uid.tofuInfo();
           if (!tofu.isNull() &&
@@ -1954,8 +1963,8 @@ Mail::updateSigstate ()
               continue;
             }
         }
-      log_debug ("%s:%s: Classified sender as verified uid validity: %i",
-                 SRCNAME, __func__, m_uid.validity());
+      log_debug ("%s:%s: Classified sender as verified uid validity: %i origin: %i",
+                 SRCNAME, __func__, m_uid.validity(), m_uid.origin());
       m_sig = sig;
       m_is_valid = true;
       return;
@@ -2391,6 +2400,10 @@ Mail::getCryptoDetails_o ()
       message = buf;
       xfree (buf);
     }
+  else if (level == 2 && m_uid.origin () == GpgME::Key::OriginWKD)
+    {
+      message = _("The mail provider of the recipient served this key.");
+    }
   else if (level == 2 && m_uid.tofuInfo ().isNull ())
     {
       /* Marginal trust through pgp only */

commit 60eb684fa67777ab07c10fc791328794017c97d0
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Jun 26 11:03:18 2018 +0200

    Fix potential crash in do autosecure
    
    * src/mail.cpp (Mail::setDoAutosecure_m): Return if msg
    is not found.
    
    --
    This happens for example if we programatically created a
    mail and then set the "to"

diff --git a/src/mail.cpp b/src/mail.cpp
index 0e94871..556d7eb 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -3279,6 +3279,7 @@ Mail::setDoAutosecure_m (bool value)
   if (!msg)
     {
       TRACEPOINT;
+      return;
     }
   /* We need to set a uuid so that autosecure can
      be disabled manually */

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

Summary of changes:
 po/de.po                |  2 +-
 src/mail.cpp            | 22 ++++++++++++++++++----
 src/mail.h              |  1 +
 src/mailitem-events.cpp |  5 +++++
 src/wks-helper.cpp      | 43 +++++++++++++++++++++++++++----------------
 src/wks-helper.h        |  1 +
 6 files changed, 53 insertions(+), 21 deletions(-)


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




More information about the Gnupg-commits mailing list