[git] GpgOL - branch, master, updated. gpgol-2.2.0-42-gdb282a5

by Andre Heinecke cvs at cvs.gnupg.org
Mon Jul 9 16:25: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  db282a59ab661e0060e244d55f7bc1d807f76102 (commit)
       via  2053f1a18e3c52c6a5ce78ff464924cf4278b54d (commit)
       via  5d5f49bb68289cc063f6c95124751ebe0800ad73 (commit)
      from  c30b7ee64a1a84210301fe6619a586b4e8b507df (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 db282a59ab661e0060e244d55f7bc1d807f76102
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Jul 9 16:24:32 2018 +0200

    Clarify logging for empty UID emails
    
    * src/mail.cpp (get_uid_for_sender): Check that email is
    not empty.

diff --git a/src/mail.cpp b/src/mail.cpp
index cb0c9e3..6850c69 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -1888,7 +1888,7 @@ get_uid_for_sender (const Key &k, const char *sender)
 
   for (const auto uid: k.userIDs())
     {
-      if (!uid.email())
+      if (!uid.email() || !*(uid.email()))
         {
           log_error ("%s:%s: skipping uid without email.",
                      SRCNAME, __func__);

commit 2053f1a18e3c52c6a5ce78ff464924cf4278b54d
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Jul 9 16:22:34 2018 +0200

    Implement "prefer-smime" option
    
    * src/cryptcontroller.cpp (CryptController::resolve_keys_cached):
    Respect prefer smime setting.
    
    --
    Some prefer SM.
    
    GnuPG-Bug-Id: T3961

diff --git a/src/cryptcontroller.cpp b/src/cryptcontroller.cpp
index dd36831..025a47d 100644
--- a/src/cryptcontroller.cpp
+++ b/src/cryptcontroller.cpp
@@ -316,15 +316,30 @@ CryptController::resolve_keys_cached()
       auto recps = cArray_to_vector ((const char**) m_recipient_addrs);
       recps.push_back (cached_sender);
 
-      m_recipients = cache->getEncryptionKeys(recps, GpgME::OpenPGP);
-      m_proto = GpgME::OpenPGP;
+      m_recipients.clear();
+      if (opt.enable_smime && opt.prefer_smime)
+        {
+          m_recipients = cache->getEncryptionKeys(recps, GpgME::CMS);
+          if (!m_recipients.empty())
+            {
+              fallbackToSMIME = true;
+              m_proto = GpgME::CMS;
+            }
+        }
 
-      if (m_recipients.empty() && opt.enable_smime)
+      if (m_recipients.empty())
+        {
+          m_recipients = cache->getEncryptionKeys(recps, GpgME::OpenPGP);
+          m_proto = GpgME::OpenPGP;
+        }
+
+      if (m_recipients.empty() && (opt.enable_smime && !opt.prefer_smime))
         {
           m_recipients = cache->getEncryptionKeys(recps, GpgME::CMS);
           fallbackToSMIME = true;
           m_proto = GpgME::CMS;
         }
+
       if (m_recipients.empty())
         {
           log_debug ("%s:%s: Failed to resolve keys through cache",

commit 5d5f49bb68289cc063f6c95124751ebe0800ad73
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Jul 9 16:19:35 2018 +0200

    More options / config cleanup
    
    * src/main.cpp (write_options): Remove most options now
    controlled by the external dialog.
    (get_conf_bool): New helper.
    (read_options): Use it.
    * src/common_indep.c (set_default_key): Removed.
    * src/common_indep.h (opt): Remove obsolete values and
    add some new ones.
    
    --
    Most of the removed options were already obsolete for
    ages.
    
    GnuPG-Bug-Id: T3944

diff --git a/src/common_indep.c b/src/common_indep.c
index 7f4415f..046def8 100644
--- a/src/common_indep.c
+++ b/src/common_indep.c
@@ -749,22 +749,4 @@ log_window_hierarchy (HWND window, const char *fmt, ...)
     }
 }
 
-void
-set_default_key (const char *name)
-{
-  if (!lock_log ())
-    {
-      if (!name || *name == '\"' || !*name)
-        {
-          xfree (opt.default_key);
-          opt.default_key = NULL;
-        }
-      else
-        {
-          xfree (opt.default_key);
-          opt.default_key = xstrdup (name);;
-        }
-      unlock_log ();
-    }
-}
 #endif
diff --git a/src/common_indep.h b/src/common_indep.h
index 285ab42..00921e6 100644
--- a/src/common_indep.h
+++ b/src/common_indep.h
@@ -188,40 +188,19 @@ struct
   int enable_smime;	     /* Enable S/MIME support. */
   int encrypt_default;       /* Encrypt by default. */
   int sign_default;          /* Sign by default. */
-  char *default_key;         /* The key we want to always encrypt to. */
   int prefer_html;           /* Prefer html in html/text alternatives. */
   int inline_pgp;            /* Only for Addin. Use Inline PGP by default. */
   int autoresolve;           /* Autresolve keys with --locate-keys. */
   int autosecure;             /* Autmatically encrypt if locate returns enough validity. */
   int reply_crypt;           /* Only for Addin. Encrypt / Sign based on cryptostatus. */
+  int automation;            /* General automation */
+  int autotrust;             /* TOFU configured for GpgOL */
+  int prefer_smime;          /* S/MIME prefered when autoresolving */
   int smime_html_warn_shown; /* Flag to save if unsigned smime warning was shown */
 
-  /* The compatibility flags. */
-  struct
-  {
-    unsigned int no_msgcache:1;
-    unsigned int no_pgpmime:1;
-    unsigned int no_oom_write:1; /* Don't write using Outlooks object model. */
-    unsigned int no_preview_info:1; /* No preview info about PGP/MIME. */
-    unsigned int old_reply_hack: 1; /* See gpgmsg.cpp:decrypt. */
-    unsigned int auto_decrypt: 1;   /* Try to decrypt when clicked. */
-    unsigned int no_attestation: 1; /* Don't create an attestation. */
-    unsigned int use_mwfmo: 1;      /* Use MsgWaitForMultipleObjects.  */
-  } compat;
-
-  /* The current git commit id.  */
-  unsigned int git_commit;
-
   /* The forms revision number of the binary.  */
   int forms_revision;
 
-  /* The stored number of the binary which showed the last announcement.  */
-  int announce_number;
-
-  /* Disable message processing until restart.  This is required to
-     implement message reverting as a perparation to remove GpgOL.  */
-  int disable_gpgol;
-
 } opt;
 
 
diff --git a/src/main.c b/src/main.c
index e0d553d..12754fb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -212,6 +212,17 @@ drop_locale_dir (char *locale_dir)
 }
 
 
+static int
+get_conf_bool (const char *name, int defaultVal)
+{
+  char *val = NULL;
+  int ret;
+  load_extension_value (name, &val);
+  ret = val == NULL ? defaultVal : *val != '1' ? 0 : 1;
+  xfree (val);
+  return ret;
+}
+
 /* Read option settings from the Registry. */
 void
 read_options (void)
@@ -288,50 +299,26 @@ read_options (void)
                (opt.enable_debug & DBG_OOM_EXTRA)? " oom-extra":""
                );
 
-
-  load_extension_value ("enableSmime", &val);
-  opt.enable_smime = !val ? 0 : atoi (val);
-  xfree (val); val = NULL;
-
-  load_extension_value ("encryptDefault", &val);
-  opt.encrypt_default = val == NULL || *val != '1'? 0 : 1;
-  xfree (val); val = NULL;
-
-  load_extension_value ("signDefault", &val);
-  opt.sign_default = val == NULL || *val != '1'? 0 : 1;
-  xfree (val); val = NULL;
-
-  load_extension_value ("defaultKey", &val);
-  set_default_key (val);
-  xfree (val); val = NULL;
-
-  load_extension_value ("gitCommit", &val);
-  opt.git_commit = val? strtoul (val, NULL, 16) : 0;
-  xfree (val); val = NULL;
-
-  load_extension_value ("formsRevision", &val);
-  opt.forms_revision = val? atol (val) : 0;
-  xfree (val); val = NULL;
-
-  load_extension_value ("announceNumber", &val);
-  opt.announce_number = val? atol (val) : 0;
-  xfree (val); val = NULL;
-
-  load_extension_value ("inlinePGP", &val);
-  opt.inline_pgp = val == NULL || *val != '1'? 0 : 1;
-  xfree (val); val = NULL;
-  load_extension_value ("autoresolve", &val);
-  opt.autoresolve = val == NULL ? 1 : *val != '1' ? 0 : 1;
-  xfree (val); val = NULL;
-  load_extension_value ("replyCrypt", &val);
-  opt.reply_crypt = val == NULL ? 1 : *val != '1' ? 0 : 1;
-  xfree (val); val = NULL;
-  load_extension_value ("smimeHtmlWarnShown", &val);
-  opt.smime_html_warn_shown = val == NULL || *val != '1'? 0 : 1;
-  xfree (val); val = NULL;
-  load_extension_value ("autosecure", &val);
-  opt.autosecure = val == NULL ? 1 : *val != '1' ? 0 : 1;
-  xfree (val); val = NULL;
+  opt.enable_smime = get_conf_bool ("enableSmime", 0);
+  opt.encrypt_default = get_conf_bool ("encryptDefault", 0);
+  opt.sign_default = get_conf_bool ("signDefault", 0);
+  opt.inline_pgp = get_conf_bool ("inlinePGP", 0);
+  opt.reply_crypt = get_conf_bool ("replyCrypt", 1);
+  opt.prefer_smime = get_conf_bool ("preferSmime", 0);
+  opt.autoresolve = get_conf_bool ("autoresolve", 1);
+  opt.automation = get_conf_bool ("automation", 1);
+  opt.autosecure = get_conf_bool ("autosecure", 1);
+  opt.autotrust = get_conf_bool ("autotrust", 0);
+  opt.smime_html_warn_shown = get_conf_bool ("smimeHtmlWarnShown", 0);
+
+  if (!opt.automation)
+    {
+      // Disabling automation is a shorthand to disable the
+      // others, too.
+      opt.autosecure = 0;
+      opt.autoresolve = 0;
+      opt.autotrust = 0;
+    }
 }
 
 
@@ -346,16 +333,6 @@ write_options (void)
     int  value;
     char *s_val;
   } table[] = {
-    {"enableSmime",              0, opt.enable_smime, NULL},
-    {"encryptDefault",           0, opt.encrypt_default, NULL},
-    {"signDefault",              0, opt.sign_default, NULL},
-    {"logFile",                  2, 0, (char*) get_log_file ()},
-    {"gitCommit",                4, opt.git_commit, NULL},
-    {"formsRevision",            1, opt.forms_revision, NULL},
-    {"announceNumber",           1, opt.announce_number, NULL},
-    {"inlinePGP",                0, opt.inline_pgp, NULL},
-    {"autoresolve",              0, opt.autoresolve, NULL},
-    {"replyCrypt",               0, opt.reply_crypt, NULL},
     {"smimeHtmlWarnShown",       0, opt.smime_html_warn_shown, NULL},
     {NULL, 0, 0, NULL}
   };

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

Summary of changes:
 src/common_indep.c      | 18 -----------
 src/common_indep.h      | 27 ++--------------
 src/cryptcontroller.cpp | 21 ++++++++++--
 src/mail.cpp            |  2 +-
 src/main.c              | 85 ++++++++++++++++++-------------------------------
 5 files changed, 53 insertions(+), 100 deletions(-)


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




More information about the Gnupg-commits mailing list