[git] GpgOL - branch, master, updated. gpgol-1.4.0-260-gc196eb9

by Andre Heinecke cvs at cvs.gnupg.org
Thu Mar 23 11:35:45 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  c196eb96af3eaa4be611b706739ae66ddcab1831 (commit)
      from  3442972cba2ddf88a88ff3d10421debf0fc07c06 (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 c196eb96af3eaa4be611b706739ae66ddcab1831
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Mar 23 11:33:52 2017 +0100

    Set the sender on verify / decrypt
    
    * src/mail.cpp (Mail::decrypt_verify): Set sender on parser.
    * src/parsecontroller.cpp (ParseController::setSender): Add API
    
    --
    This allows gnupg to use locate-key to locate a key not published
    on keyserver and also enables proper tofu handling.

diff --git a/src/mail.cpp b/src/mail.cpp
index 89219eb..5e0a167 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -690,6 +690,7 @@ Mail::decrypt_verify()
     }
 
   m_parser = std::shared_ptr <ParseController> (new ParseController (cipherstream, m_type));
+  m_parser->setSender(GpgME::UserID::addrSpecFromString(get_sender().c_str()));
   gpgol_release (cipherstream);
 
   HANDLE parser_thread = CreateThread (NULL, 0, do_parsing, (LPVOID) this, 0,
diff --git a/src/parsecontroller.cpp b/src/parsecontroller.cpp
index 3342371..f15e741 100644
--- a/src/parsecontroller.cpp
+++ b/src/parsecontroller.cpp
@@ -210,6 +210,11 @@ format_error(GpgME::DecryptionResult result, Protocol protocol)
   return msg;
 }
 
+void
+ParseController::setSender(const std::string &sender)
+{
+  m_sender = sender;
+}
 
 void
 ParseController::parse()
@@ -264,12 +269,18 @@ ParseController::parse()
     }
   ctx->setArmor(true);
 
+  if (!m_sender.empty())
+    {
+      ctx->setSender(m_sender.c_str());
+    }
+
   Data output (m_outputprovider);
-  log_debug ("%s:%s: decrypt: %i verify: %i with protocol: %s",
+  log_debug ("%s:%s: decrypt: %i verify: %i with protocol: %s sender: %s",
              SRCNAME, __func__,
              decrypt, verify,
              protocol == OpenPGP ? "OpenPGP" :
-             protocol == CMS ? "CMS" : "Unknown");
+             protocol == CMS ? "CMS" : "Unknown",
+             m_sender.empty() ? "none" : m_sender.c_str());
   if (decrypt)
     {
       input.seek (0, SEEK_SET);
diff --git a/src/parsecontroller.h b/src/parsecontroller.h
index ec45982..14a4878 100644
--- a/src/parsecontroller.h
+++ b/src/parsecontroller.h
@@ -99,6 +99,8 @@ public:
   const std::string get_formatted_error() const
   { return m_error; }
 
+  void setSender(const std::string &sender);
+
 private:
   /* State variables */
   MimeDataProvider *m_inputprovider;
@@ -107,6 +109,7 @@ private:
   std::string m_error;
   GpgME::DecryptionResult m_decrypt_result;
   GpgME::VerificationResult m_verify_result;
+  std::string m_sender;
 };
 
 #endif /* PARSECONTROLLER_H */

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

Summary of changes:
 src/mail.cpp            |  1 +
 src/parsecontroller.cpp | 15 +++++++++++++--
 src/parsecontroller.h   |  3 +++
 3 files changed, 17 insertions(+), 2 deletions(-)


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




More information about the Gnupg-commits mailing list