gpgol.git
14 months agoRemove obsolete logging categories
Andre Heinecke [Mon, 24 Sep 2018 07:13:53 +0000 (09:13 +0200)]
Remove obsolete logging categories

* src/common_indep.h (DBG_COMMANDS, DBG_IOWORKER),
(DBG_IOWORKER_EXTRA, DBG_FILTER, DBG_FILTER_EXTRA): Removed.
* src/main.c (read_options): Remove handling of obsolete values.

15 months agoMerge branch 'STABLE-BRANCH-2-3'
Andre Heinecke [Thu, 13 Sep 2018 09:14:30 +0000 (11:14 +0200)]
Merge branch 'STABLE-BRANCH-2-3'

15 months agoAdd disable async encryption as hidden option
Andre Heinecke [Thu, 13 Sep 2018 09:12:46 +0000 (11:12 +0200)]
Add disable async encryption as hidden option

* src/mail.cpp (Mail::check_inline_response): Look
at opt.sync_enc again.
* src/main.c (read_options): Read hidden _syncEnc value
to disable async encryption.

--
This might be useful for support when for someone encryption
crashes in the async form.

15 months agoDisable async encryption for mails with attachs
Andre Heinecke [Thu, 13 Sep 2018 09:07:56 +0000 (11:07 +0200)]
Disable async encryption for mails with attachs

* src/mail.cpp (check_inline_response): Disable async crypt
if mail has attachments.
* src/windowmessage.cpp (CRYPTO_DONE): Clarify that the
fallback to MAPI is a very very last resort.

--
This commit sacrifices usability (async encryption) for
stability. We now use the old sync crypt code when attachments
are added to a crypto mail to avoid errors that occured
for some attachments.
As there does not appear to be a detectable pattern or
value for which attachments the write in the second send
fails we block async crypt for all attachments.

GnuPG-Bug-Id: T4131

15 months agoAdd more mimetypes in infer_content_type
Andre Heinecke [Thu, 13 Sep 2018 08:29:55 +0000 (10:29 +0200)]
Add more mimetypes in infer_content_type

* src/mimemaker.cpp (infer_content_type): Add more mime types.

15 months agoFix encoding of last line
Andre Heinecke [Fri, 7 Sep 2018 08:28:11 +0000 (10:28 +0200)]
Fix encoding of last line

* src/mimedataprovider.cpp (get_body, get_html_body): Don't
append raw undecoded data anymore.
(MimeDataProvider::finalize): New. Parse the last unfinished data.
* src/parsecontroller.cpp (ParseController::parse): Call
finalize.

--
Before this a quoted printable line without a line feed at the
end would not be decoded. Leading to a broken display.

(cherry picked from commit a0671ccbb477e31d25547532004fa6fd16a29f78)

15 months agoFix a possible crash when reactivating gpgol
Andre Heinecke [Fri, 7 Sep 2018 07:56:35 +0000 (09:56 +0200)]
Fix a possible crash when reactivating gpgol

* src/gpgoladdin.cpp (GpgolAddin::invalidateRibbons)
(GpgolAddin::addRibbon): New.
(g_ribbon_uis): Removed.

--
This keeps the ribbon ui in a member variable so that they
are cleared out when the GpgolAddin class is remvoved on
unload.

Fixes a potential crash when a user would activate gpgol
after deactivating it in the same outlook session and
stale ribbon ui pointers would be accessed.

(cherry picked from commit 50c514d6bd6026076f5f467b7d8523dff2ce97aa)

15 months agoFix encoding of last line
Andre Heinecke [Fri, 7 Sep 2018 08:28:11 +0000 (10:28 +0200)]
Fix encoding of last line

* src/mimedataprovider.cpp (get_body, get_html_body): Don't
append raw undecoded data anymore.
(MimeDataProvider::finalize): New. Parse the last unfinished data.
* src/parsecontroller.cpp (ParseController::parse): Call
finalize.

--
Before this a quoted printable line without a line feed at the
end would not be decoded. Leading to a broken display.

15 months agoFix a possible crash when reactivating gpgol
Andre Heinecke [Fri, 7 Sep 2018 07:56:35 +0000 (09:56 +0200)]
Fix a possible crash when reactivating gpgol

* src/gpgoladdin.cpp (GpgolAddin::invalidateRibbons)
(GpgolAddin::addRibbon): New.
(g_ribbon_uis): Removed.

--
This keeps the ribbon ui in a member variable so that they
are cleared out when the GpgolAddin class is remvoved on
unload.

Fixes a potential crash when a user would activate gpgol
after deactivating it in the same outlook session and
stale ribbon ui pointers would be accessed.

15 months agoMerge branch 'STABLE-BRANCH-2-3'
Andre Heinecke [Thu, 6 Sep 2018 15:35:22 +0000 (17:35 +0200)]
Merge branch 'STABLE-BRANCH-2-3'

--
 Conflicts:
src/common.h
src/mail.cpp
src/windowmessages.cpp

15 months agoThou shalt not push before compiling
Andre Heinecke [Thu, 6 Sep 2018 15:25:48 +0000 (17:25 +0200)]
Thou shalt not push before compiling

* src/mail.cpp (Mail::refCurrentItem): Fix debug statement.

15 months agoTry to fix crashes in MAPI SubmitMessage path
Andre Heinecke [Thu, 6 Sep 2018 15:21:55 +0000 (17:21 +0200)]
Try to fix crashes in MAPI SubmitMessage path

* src/windowmessages.cpp (gpgol_window_proc): Close inspector
before closing the mail.

--
This is purely experimental programming. The SubmitMessage paths
both lead to random crashes. So I tried around what might
be the cause and found this. Let's hope it is not just luck
that it currently does not crash for me.

GnuPG-Bug-Id: T4131

15 months agoAdd some safeguards against NULL base msg
Andre Heinecke [Thu, 6 Sep 2018 15:19:07 +0000 (17:19 +0200)]
Add some safeguards against NULL base msg

* src/common.h (ERR_GET_BASE_MSG_FAILED): Add new bug code.
* src/mailitem-events.cpp (Send): Check for null base msg
* src/windowmessages.cpp (gpgol_window_proc): ditto.
* src/ribbon-callbacks.cpp (get_mail_from_control): ditto.

--
Except for get_mail_from_control this should never be hit
(thus the bug error) but accessing a pointer before checking
it seemed wrong.

15 months agoFix minor mem leak in format error
Andre Heinecke [Thu, 6 Sep 2018 15:17:59 +0000 (17:17 +0200)]
Fix minor mem leak in format error

* src/parsecontroller.cpp (format_error): Don't leak
the buf.

15 months agoDo not release old ref in refCurrentItem
Andre Heinecke [Thu, 6 Sep 2018 15:15:33 +0000 (17:15 +0200)]
Do not release old ref in refCurrentItem

* src/mail.cpp (Mail::refCurrentItem): Do not release
existing ref.

--
This was stupid. Releasing the ref there could trigger
the unload and so lead to crashes.

Happliy the case that refCurrentItem was called multiple
times did only exist for close and the anyway instable
MAPI SubmitMessage codepath.

15 months agoPost release version bump
Andre Heinecke [Fri, 31 Aug 2018 11:24:41 +0000 (13:24 +0200)]
Post release version bump

--

(cherry picked from commit ad81087b2f4c38aa353fce58bf4b2f5b967a381c)

15 months agoKeep strong ref after submit message
Andre Heinecke [Thu, 6 Sep 2018 13:03:13 +0000 (15:03 +0200)]
Keep strong ref after submit message

* src/windowmessages.cpp (gpgol_window_proc): Keep strong
ref in send fallback.

--
The close cleans up the mail. If we release the strong ref
here it crashes sometimes.

GnuPG-Bug-Id: T4131

15 months agoFallback to MAPI SubmitMessage if OOM Send fails
Andre Heinecke [Thu, 6 Sep 2018 09:54:34 +0000 (11:54 +0200)]
Fallback to MAPI SubmitMessage if OOM Send fails

* src/common.h (ERR_SEND_FALLBACK_FAILED): New error code.
* src/windowmessages.cpp (gpgol_window_proc): Fallback to SubmitMessage
on OOM Send failure.

--
This is a workaround for a strange case where the write
in the send event fails. This happens for example if
office documents are attached to a mail. In that
case we can fallback to MAPI as we already do when
Outlooks internal Sign / Encrypt is selected.
Maybe we could be so bold as to always send over
MAPI.

GnuPG-Bug-Id: T4131
(cherry picked from commit 8fb3524262283c77a91f7e6c615d97f426455332)

15 months agoIgnore temporary recipient resolve errors
Andre Heinecke [Thu, 6 Sep 2018 08:25:40 +0000 (10:25 +0200)]
Ignore temporary recipient resolve errors

* src/cryptocontroller.cpp (CryptController::resolve_keys):
Add unlikely error handling if recipients could not be resolved here.
* src/mail.cpp (Mail::getRecipients_o): Ignore error when
getting recipients.

--
When editing the recipients of a draft Outlook still has an
recipient object for the former recipient but does not provide
properties on it. So the address resolution fails. We can
treat the mail as having no recipients and only have a
fatal error if we can't resolve recipients in the cryptcontroller.

GnuPG-Bug-Id: T4129
(cherry picked from commit 3c0a66e402e84c0f8c5db4d2219eb8da6e5c0cac)

15 months agoRename autoresolveCheck to autosecureCheck
Andre Heinecke [Tue, 4 Sep 2018 11:50:28 +0000 (13:50 +0200)]
Rename autoresolveCheck to autosecureCheck

* src/mail.cpp, src/mail.h (Mail::autoresolveCheck): Rename
to autosecureCheck.
(Mail::autsecureCheck): Also check for opt.autosecure.

--
This reduces confusing naming and ensures that when opt.autosecure
is not set auto secure won't happen.

GnuPG-Bug-Id: T4126
(cherry picked from commit 3b770f928eb17fd876a00e85e7b384d566de2175)

15 months agoFix Mail::needs_crypto_m
Andre Heinecke [Tue, 4 Sep 2018 11:47:04 +0000 (13:47 +0200)]
Fix Mail::needs_crypto_m

* src/mail.cpp (Mail::needs_crypto_m): Fix function.

--
It would always return 1 if any crypto was required. This
had a side effect like:

GnuPG-Bug-Id: T4126
(cherry picked from commit a507d8bdfb9e31814abf21ad5a9915abd66c96c1)

15 months agoFallback to MAPI SubmitMessage if OOM Send fails
Andre Heinecke [Thu, 6 Sep 2018 09:54:34 +0000 (11:54 +0200)]
Fallback to MAPI SubmitMessage if OOM Send fails

* src/common.h (ERR_SEND_FALLBACK_FAILED): New error code.
* src/windowmessages.cpp (gpgol_window_proc): Fallback to SubmitMessage
on OOM Send failure.

--
This is a workaround for a strange case where the write
in the send event fails. This happens for example if
office documents are attached to a mail. In that
case we can fallback to MAPI as we already do when
Outlooks internal Sign / Encrypt is selected.
Maybe we could be so bold as to always send over
MAPI.

GnuPG-Bug-Id: T4131

15 months agoIgnore temporary recipient resolve errors
Andre Heinecke [Thu, 6 Sep 2018 08:25:40 +0000 (10:25 +0200)]
Ignore temporary recipient resolve errors

* src/cryptocontroller.cpp (CryptController::resolve_keys):
Add unlikely error handling if recipients could not be resolved here.
* src/mail.cpp (Mail::getRecipients_o): Ignore error when
getting recipients.

--
When editing the recipients of a draft Outlook still has an
recipient object for the former recipient but does not provide
properties on it. So the address resolution fails. We can
treat the mail as having no recipients and only have a
fatal error if we can't resolve recipients in the cryptcontroller.

GnuPG-Bug-Id: T4129

15 months agoAdd Address Book integration
Andre Heinecke [Wed, 5 Sep 2018 14:24:54 +0000 (16:24 +0200)]
Add Address Book integration

* src/Makefile.am: Add new files.
* src/addressbook.cpp, src/addressbook.h: New. Code for
Address Book handling.
* src/gpgoladdin.cpp (GpgolRibbonExtender::GetIDsOfNames),
(GpgolRibbonExtender::Invoke),
(GetCustomUI_MIME): Add Button to configure PGP Key.
* src/mail.cpp (m_locate_in_progress): Make static
locate_in_progress a proper member.
(Mail::locateKeys_o): Trigger address book check.
(Mail::locateAllCryptoRecipients_o): Don't abort
if autoresolve is false.
* src/mail.h: Update accordingly.
* src/mailitem-events.cpp (PropertyChange): Trigger
locate even if autoresolve is off.
* src/ribbon-callbacks.cpp (open_contact_key): New.
* src/ribbon-callbacks.h: Add id and protoype.
* src/windowmessages.cpp (gpgol_window_proc): Handle
config key done.
* src/windowmessages.h (CONFIG_KEY_DONE): New.

--
We do the now usual dance with an external process and
windowmessage callback to configure a PGP Key in the
Address book.
This key or keys override any other key and will
be used regardless of validity or user ids.
This should allow a power user or administrator to centrally
manage keys in a shared address book and enable such
use cases as delegateing one mail address to
a different key.

GnuPG-Bug-Id: T4122

15 months agoFix find user prop
Andre Heinecke [Wed, 5 Sep 2018 14:23:35 +0000 (16:23 +0200)]
Fix find user prop

* src/oomhelp.cpp (find_user_prop): Set cNamedArgs so it
is not unitialized.

15 months agoAdd l10n strings for the keyadder
Andre Heinecke [Wed, 5 Sep 2018 12:17:24 +0000 (14:17 +0200)]
Add l10n strings for the keyadder

* src/addin-options.cpp (i18n_noops): Extend with strings
for the key adder dialog.

15 months agoAdd import / override functions to keycache
Andre Heinecke [Wed, 5 Sep 2018 06:54:39 +0000 (08:54 +0200)]
Add import / override functions to keycache

* src/keycache.cpp (KeyCache::importFromAddrBook): New.
(KeyCache::onAddrBookImportJobDone): New internal helper.
(KeyCache::Private::importFromAddrBook): New.
(KeyCache::Private::getPGPOverrides): Access imported overrides.
(KeyCache::Private::getEncryptionKeys): Respect overrides.
(do_import): New thread function to do the actual import.
* src/keycache.h: Update accordingly and add comments which
functions are async.

--
This adds support to the keycache to import keys to override
existing keys / force their usage regardless of validity.

GnuPG-Bug-Id: T4122

15 months agoRename autoresolveCheck to autosecureCheck
Andre Heinecke [Tue, 4 Sep 2018 11:50:28 +0000 (13:50 +0200)]
Rename autoresolveCheck to autosecureCheck

* src/mail.cpp, src/mail.h (Mail::autoresolveCheck): Rename
to autosecureCheck.
(Mail::autsecureCheck): Also check for opt.autosecure.

--
This reduces confusing naming and ensures that when opt.autosecure
is not set auto secure won't happen.

GnuPG-Bug-Id: T4126

15 months agoFix Mail::needs_crypto_m
Andre Heinecke [Tue, 4 Sep 2018 11:47:04 +0000 (13:47 +0200)]
Fix Mail::needs_crypto_m

* src/mail.cpp (Mail::needs_crypto_m): Fix function.

--
It would always return 1 if any crypto was required. This
had a side effect like:

GnuPG-Bug-Id: T4126

15 months agoExtend oomhelp for address book integration
Andre Heinecke [Tue, 4 Sep 2018 08:37:36 +0000 (10:37 +0200)]
Extend oomhelp for address book integration

* src/oomhelp.h (shared_disp_t, MAKE_SHARED, release_disp):
New. Automatically releasing IDispatch pointer.
* src/oomhelp.cpp, src/oomhelp.h (release_disp),
(get_oom_recipients_with_addrEntry, find_user_prop),
(find_or_add_text_prop): New.

--
This adds a way to get the recipients with their addresentry
objects. For more complex IDispatch handling we now
have shared_disp_t and MAKE_SHARED to wrap the IDispatch
in an automatically releasing shared pointer.

find_user_prop and find_or_add_text_prop are new
functions to interact with Contact properties.

15 months agoFix missing space in german translation of version
Andre Heinecke [Fri, 31 Aug 2018 12:23:36 +0000 (14:23 +0200)]
Fix missing space in german translation of version

* po/de.po: Add ending space.

15 months agoPost release version bump
Andre Heinecke [Fri, 31 Aug 2018 11:24:41 +0000 (13:24 +0200)]
Post release version bump

--

15 months agoUpdate NEWS for todays release gpgol-2.3.0
Andre Heinecke [Fri, 31 Aug 2018 11:19:48 +0000 (13:19 +0200)]
Update NEWS for todays release

--

15 months agoTranslate the word "technical"
Andre Heinecke [Thu, 30 Aug 2018 13:01:38 +0000 (15:01 +0200)]
Translate the word "technical"

* po/de.po, po/nl.po, po/pt.po: Translate technical in the
100% languages.

15 months agoAuto update po files
Andre Heinecke [Thu, 30 Aug 2018 12:58:56 +0000 (14:58 +0200)]
Auto update po files

* po/*: update

15 months agoRevert "Check for PGP/Inline inside of S/MIME mails"
Andre Heinecke [Thu, 30 Aug 2018 12:41:16 +0000 (14:41 +0200)]
Revert "Check for PGP/Inline inside of S/MIME mails"

This reverts commit 1656e01d2eb19c8349dcab9d9b7e25fb85b9c854.

15 months agoRevert "Also check for pgp/inline in IPM.Note.SMIME"
Andre Heinecke [Thu, 30 Aug 2018 12:41:08 +0000 (14:41 +0200)]
Revert "Also check for pgp/inline in IPM.Note.SMIME"

This reverts commit 0e05606f693114b491a74030e7ae54c75738eeae.

15 months agoAdd a debug statement when marking MOSS attachs
Andre Heinecke [Thu, 30 Aug 2018 07:45:59 +0000 (09:45 +0200)]
Add a debug statement when marking MOSS attachs

* src/mapihelp.cpp (mapi_mark_moss_attach, mapi_body_to_attachment):
Add debug.

15 months agoAlso check for pgp/inline in IPM.Note.SMIME
Andre Heinecke [Thu, 30 Aug 2018 07:44:43 +0000 (09:44 +0200)]
Also check for pgp/inline in IPM.Note.SMIME

* src/mapihelp.cpp (mapi_change_message_class): Also check
for inline in IPM.Note.SMIME

GnuPG-Bug-Id: T4115

15 months agoCheck for PGP/Inline inside of S/MIME mails
Andre Heinecke [Thu, 30 Aug 2018 07:39:45 +0000 (09:39 +0200)]
Check for PGP/Inline inside of S/MIME mails

* src/mapihelp.cpp
(change_message_class_ipm_note_smime_multipartsigned): Check for
PGP/Inline if S/MIME is disabled.

--
This is a hack to handle the case where some crypto gateway
might wrap a PGP Inline message inside an S/MIME message.

GnuPG-Bug-Id: T4115

15 months agoFix minor german l10n error
Andre Heinecke [Thu, 30 Aug 2018 06:27:21 +0000 (08:27 +0200)]
Fix minor german l10n error

--

15 months agoCache icons
Andre Heinecke [Wed, 29 Aug 2018 09:28:15 +0000 (11:28 +0200)]
Cache icons

* src/ribbon-callbacks.cpp (getIcon): Use dispcache.
(getIconDisp): New.

--
While this may not be much it felt excessive to initialize
GDIPlus and convert the icon from PNG to bitmap for each
getIcon call even though the icons never change over
the lifetime of GpgOL

GnuPG-Bug-Id: T4113

15 months agoAccept sent on behalf of as the sender address
Andre Heinecke [Wed, 29 Aug 2018 09:02:52 +0000 (11:02 +0200)]
Accept sent on behalf of as the sender address

* src/mail.cpp (Mail::updateOOMData_o): Cache sent on behalf.
(Mail::updateSigstate): Fallback to sent on behalf.
(m_sent_on_behalf): New cache variable.
* src/oomhelp.cpp (get_sender_SentRepresentingAddress): New.

--
Outlook clearly shows in the mail:
"foo@bar.baz at behalf of foo2@bar.baz"

So we can accept "foo2@bar.baz" also as the sender address
as it is visible.

GnuPG-Bug-ID: T4110

15 months agoFix minor locking issue
Andre Heinecke [Wed, 29 Aug 2018 08:37:11 +0000 (10:37 +0200)]
Fix minor locking issue

* src/keycache.cpp (KeyCache::Private::getByFpr): Use a copy
to return after unlocking the map.

--
I'm not sure if this is neccessary as the iterator is const
but better be safe.

15 months agoUse dispcache for Multilanguage COM interface
Andre Heinecke [Wed, 29 Aug 2018 08:30:02 +0000 (10:30 +0200)]
Use dispcache for Multilanguage COM interface

* src/dialogs.h (DISPID_MULTILANG): New.
* src/mlang-charset.cpp (ansi_charset_to_utf8): Use dispcache.

--
Using CoCreateInstance for every string to convert seemed excessive
so we better cache it.

GnuPG-Bug-Id: T4114

15 months agoAdd generic cache for IDispatch objects
Andre Heinecke [Wed, 29 Aug 2018 08:24:14 +0000 (10:24 +0200)]
Add generic cache for IDispatch objects

* src/dispcache.cpp, src/dispcache.h: New.
* src/gpgoladdin.cpp, src/gpgoladdin.h: Carry dispcache as
member.
* src/Makefile.am: Add new Files.

--
The cache shares the lifetime of the addin object and
can be used to keep IDispatch object around without having
to create them again and again.

15 months agoAdd missing word from config dialog to i18n
Andre Heinecke [Wed, 29 Aug 2018 08:14:10 +0000 (10:14 +0200)]
Add missing word from config dialog to i18n

* src/addin-options.cpp: Add (Technical)

15 months agoRemove attic
Andre Heinecke [Wed, 29 Aug 2018 07:10:13 +0000 (09:10 +0200)]
Remove attic

* src/attic.c: Deleted.

--
This was dead / old code that was just confusing to have
lying around.

15 months agoUpdate NEWS
Andre Heinecke [Tue, 28 Aug 2018 12:22:25 +0000 (14:22 +0200)]
Update NEWS

--

15 months agoMinor indentation fix
Andre Heinecke [Tue, 28 Aug 2018 11:59:54 +0000 (13:59 +0200)]
Minor indentation fix

--

15 months agoImprove keycache performance a bit
Andre Heinecke [Tue, 28 Aug 2018 10:20:55 +0000 (12:20 +0200)]
Improve keycache performance a bit

* src/keycache.cpp: Use unordered_map and set for better
speed.

15 months agoAdd another tracepoint in parsing_done
Andre Heinecke [Tue, 28 Aug 2018 10:15:24 +0000 (12:15 +0200)]
Add another tracepoint in parsing_done

* src/mail.cpp (Mail::parsing_done): Add tracepoint.

15 months agoUse keycache instead of Signature::Key
Andre Heinecke [Tue, 28 Aug 2018 10:13:19 +0000 (12:13 +0200)]
Use keycache instead of Signature::Key

* src/mail.cpp (Mail::updateSigstate),
(Mail::getCryptoDetails_o): Use keycache.
* src/parsecontroller.cpp (Parsecontroller::parse): Use
keycache.

--
This is a huge performance improvement as the old code
was pretty bad. The old code did three keylistings
after a verify to search the key, then check if the
key is secret and then update the key.

15 months agoExtend keycache for fingerprint lookup
Andre Heinecke [Tue, 28 Aug 2018 10:11:23 +0000 (12:11 +0200)]
Extend keycache for fingerprint lookup

* src/keycache.cpp, src/keycache.h (KeyCache::update),
(KeyCache::getByFpr): New.

--
This extends the keycache with a generic fingerprint
to key mapping. Update inserts or updates a key
in the keycache, getByFpr is the main accessor.

15 months agoFix confusing debug output
Andre Heinecke [Tue, 28 Aug 2018 10:10:18 +0000 (12:10 +0200)]
Fix confusing debug output

* src/windowmessages.cpp (delayed_invalidate_ui): Print
waiting before sleep, not after.

15 months agoChange mime data log category
Andre Heinecke [Thu, 23 Aug 2018 07:21:41 +0000 (09:21 +0200)]
Change mime data log category

* src/mimedataprovider.cpp: Change data logging from
log_mime_parser to log_mime_data.

15 months agoIgnore disable async crypto option
Andre Heinecke [Wed, 22 Aug 2018 11:33:11 +0000 (13:33 +0200)]
Ignore disable async crypto option

* src/mail.cpp (Mail::isAsyncCryptDisabled): We assume
that Async crypto is now stable. So ignore this option.

--
We assume that T3838 is fixed.

GnuPG-Bug-Id: T3838

15 months agoFix is_valid_chksum check
Andre Heinecke [Wed, 22 Aug 2018 11:30:35 +0000 (13:30 +0200)]
Fix is_valid_chksum check

* src/parsecontroller.cpp (is_valid_checksum): Don't check
the OR'ed sigsum values for equality.

--
This fixes handling of "Green Valid" S/MIME mails.

15 months agoMake autosecure compatible with always sign
Andre Heinecke [Wed, 22 Aug 2018 11:28:32 +0000 (13:28 +0200)]
Make autosecure compatible with always sign

* src/mail.cpp (Mail::setDoAutosecure_m): Handle always
sign and do not treat it as manual setting.

--
It makes sense for users who always sign to still encrypt
based on key availablity.

15 months agoFix minor name inconsitencs
Andre Heinecke [Wed, 22 Aug 2018 08:59:57 +0000 (10:59 +0200)]
Fix minor name inconsitencs

* src/mail.cpp (releaseCurrentItem): m_tmp was not a member.

15 months agoFix potential crash in T3656 workaround
Andre Heinecke [Wed, 22 Aug 2018 08:51:42 +0000 (10:51 +0200)]
Fix potential crash in T3656 workaround

* src/windowmessages.cpp (CLOSE): Use the currentViewRef trick
to avoid unload in close.

--
The workaround codepath crashed reliably for me with the
async sending. But with the current item ref trick it no
longer crashes as the unload is later. My observation is
that any Invoke that triggers an Unload can crash so we
better avoid it.

GnuPG-Bug-Id: T3656

15 months agoWKS: Handle aborted confirmation process better
Andre Heinecke [Wed, 22 Aug 2018 08:26:58 +0000 (10:26 +0200)]
WKS: Handle aborted confirmation process better

* src/wks-helper.cpp (handle_confirmation_notify): Go back a
state if we have not seen a confirmation in this run.

15 months agoRewrite cached key resolution
Andre Heinecke [Wed, 22 Aug 2018 08:20:20 +0000 (10:20 +0200)]
Rewrite cached key resolution

* src/cryptcontroller.cpp (resolve_through_protocol): New.
(resolve_keys_cached): Use new helper function.

--
The old code was too much spaghetti and several issues. E.g.
it could select a CMS Signing key with OpenPGP Encryption
keys. Or would not support fallback to S/MIME if OpenPGP
encryption was possible but only an S/MIME signing key available.

15 months agoAdd helper to print out protocol
Andre Heinecke [Wed, 22 Aug 2018 08:19:27 +0000 (10:19 +0200)]
Add helper to print out protocol

* src/cpphelp.cpp, src/cpphelp.h (to_string): New.

--
It's in cpphelp as I plan to have some more overloads of
this.

16 months agoFix crash on async send in OL 2013
Andre Heinecke [Fri, 10 Aug 2018 09:38:01 +0000 (11:38 +0200)]
Fix crash on async send in OL 2013

* src/mail.cpp, src/mail.h (Mail::

16 months agoDisable super verbose debug output
Andre Heinecke [Fri, 10 Aug 2018 08:39:02 +0000 (10:39 +0200)]
Disable super verbose debug output

* src/w32-gettext.h: Disable very verbose debug output.

16 months agoAdd new function to check for preview pane
Andre Heinecke [Thu, 9 Aug 2018 12:11:58 +0000 (14:11 +0200)]
Add new function to check for preview pane

* src/oomhelp.cpp, src/oomhelp.h (is_preview_pane_visible): New.
* src//ribbon-callbacks.cpp (get_mail_from_control): Use it.

--
This should hopefully work on all outlook versions.

16 months agoAdd ref in get_strong_reference
Andre Heinecke [Thu, 9 Aug 2018 12:11:20 +0000 (14:11 +0200)]
Add ref in get_strong_reference

* src/oomhelp.cpp (get_strong_reference): Mark add ref.

16 months agoUse utf8 gettext in ribbon callbacks
Andre Heinecke [Thu, 9 Aug 2018 12:10:39 +0000 (14:10 +0200)]
Use utf8 gettext in ribbon callbacks

* src/ribbon-callbacks.cpp: Use utf8 gettext.

--
The outlook ribbon UI uses utf8

16 months agoMerge remote-tracking branch 'dutch-l10n/dutch'
Andre Heinecke [Tue, 7 Aug 2018 06:51:27 +0000 (08:51 +0200)]
Merge remote-tracking branch 'dutch-l10n/dutch'

16 months agopo: Update pt translation
Andre Heinecke [Tue, 7 Aug 2018 06:50:13 +0000 (08:50 +0200)]
po: Update pt translation

* po/pt.po: Update

--
Provided again by Marco. Thanks.

16 months agoMake send_message_to_ui_thread private
Andre Heinecke [Mon, 6 Aug 2018 08:47:24 +0000 (10:47 +0200)]
Make send_message_to_ui_thread private

* src/windowmessages.cpp, src/windowmessages.h
(send_msg_to_ui_thread): Make it static

--
Helps reviewing code to check if the wm_ctx_t is always valid.

16 months agoUpdate Dutch translation
Erwin Bronkhorst [Wed, 27 Jun 2018 20:13:05 +0000 (22:13 +0200)]
Update Dutch translation

16 months agomalloc -> xmalloc
Andre Heinecke [Tue, 24 Jul 2018 12:09:10 +0000 (14:09 +0200)]
malloc -> xmalloc

* src/w32-gettext.cpp (bindtextdomain): Change a spurious malloc
to xmalloc.

--
Fixes a memdbg error.

16 months agoMinor cleanups
Andre Heinecke [Tue, 24 Jul 2018 09:07:45 +0000 (11:07 +0200)]
Minor cleanups

* src/cryptcontroller.cpp, src/cryptcontroller.h: m_recipents is
now a vector.

16 months agoFix memory leak when opening options
Andre Heinecke [Tue, 24 Jul 2018 09:06:56 +0000 (11:06 +0200)]
Fix memory leak when opening options

* src/addin-options.cpp (open_gpgolgui): Release cArray.

16 months agoAuto update german po file formatting
Andre Heinecke [Tue, 24 Jul 2018 08:25:17 +0000 (10:25 +0200)]
Auto update german po file formatting

* po/de.po: Update.

16 months agoFix return value of is_crypt_pressed
Andre Heinecke [Tue, 24 Jul 2018 08:24:34 +0000 (10:24 +0200)]
Fix return value of is_crypt_pressed

* src/ribbon-callbacks.cpp (get_crypt_pressed): Fix return
value.

16 months agoFix w64 build
Andre Heinecke [Tue, 24 Jul 2018 08:06:56 +0000 (10:06 +0200)]
Fix w64 build

* src/windowmessages.cpp (delayed_invalidate_ui): Cast delay
to intptr_t before casting to int.

16 months agoUpdate german translation
Andre Heinecke [Tue, 24 Jul 2018 07:32:28 +0000 (09:32 +0200)]
Update german translation

* po/de.po: Update

16 months agoAuto update po files
Andre Heinecke [Tue, 24 Jul 2018 07:23:13 +0000 (09:23 +0200)]
Auto update po files

* po: Update

16 months agoReturn 0 for handled WindowMessages
Andre Heinecke [Tue, 24 Jul 2018 06:10:29 +0000 (08:10 +0200)]
Return 0 for handled WindowMessages

* src/windowmessages.cpp (gpgol_window_proc): Return 0 for
messages handled by us.

--
Does not make sense to call the defaultwindowproc for our
own messages.

16 months agoTrace timing of sig key request
Andre Heinecke [Tue, 24 Jul 2018 06:09:42 +0000 (08:09 +0200)]
Trace timing of sig key request

* src/parsecontroller.cpp (ParseController::parse): Add tracepoints.

16 months agoLog invalid skipped secret keys
Andre Heinecke [Tue, 24 Jul 2018 06:08:02 +0000 (08:08 +0200)]
Log invalid skipped secret keys

* src/keycache.cpp (locate_secret): Log invalid skipped keys.

--
This might help in debug output if autoencrypt does not
work for some.

16 months agoPrint parsed mail count in dbg output
Andre Heinecke [Tue, 24 Jul 2018 06:06:58 +0000 (08:06 +0200)]
Print parsed mail count in dbg output

* src/mail.cpp (Mail::updateBody_o): Print parsed mail
count.

16 months agoFix orig body memleak in decryptVerify
Andre Heinecke [Mon, 23 Jul 2018 14:32:32 +0000 (16:32 +0200)]
Fix orig body memleak in decryptVerify

* src/mail.cpp (Mail::decryptVerify_o): Don't assign
heap alloced data to std::string without free.

16 months agoFix memleak of plain body in collect_data
Andre Heinecke [Mon, 23 Jul 2018 14:31:45 +0000 (16:31 +0200)]
Fix memleak of plain body in collect_data

* src/cryptcontroller.cpp (CryptController::collect_data): Fix
leak.

16 months agoFix important memleak in get_mail_from_control
Andre Heinecke [Mon, 23 Jul 2018 14:09:51 +0000 (16:09 +0200)]
Fix important memleak in get_mail_from_control

* src/ribbon-callbacks.cpp (get_mail_from_control): Fix memleak.

--
This function is called 4 times for each invalidate UI so this
leak is important even if it just leaks a few bytes.

16 months agoImprove wchar and utf8 conversion memdbg
Andre Heinecke [Mon, 23 Jul 2018 14:08:52 +0000 (16:08 +0200)]
Improve wchar and utf8 conversion memdbg

* src/w32-gettext.h (wchar_to_utf8, utf8_to_wchar): replace
by logging macros.

16 months agoRemove dead code
Andre Heinecke [Mon, 23 Jul 2018 14:07:57 +0000 (16:07 +0200)]
Remove dead code

* src/mail.cpp, src/mail.h (getHTMLBody_o): Removed.

16 months agoMinor initialzation
Andre Heinecke [Mon, 23 Jul 2018 14:07:09 +0000 (16:07 +0200)]
Minor initialzation

* src/mail.cpp (Mail::decryptVerify_o): Initialize placeholder.

16 months agoFix super minor memleak
Andre Heinecke [Mon, 23 Jul 2018 14:06:35 +0000 (16:06 +0200)]
Fix super minor memleak

* src/gpgoladdin.cpp (GpgolAddin::OnConnection): Release
version.

16 months agoFix memleak in put_pa_string
Andre Heinecke [Mon, 23 Jul 2018 13:34:35 +0000 (15:34 +0200)]
Fix memleak in put_pa_string

* src/oomhelp.cpp (put_pa_string): Fix memleak.

--
Its a definitve but not a major or critical memleak. In a usual
setup this would leak ~32 Bytes per mail.

16 months agoAdd caller debugging for wchar / utf8 convs
Andre Heinecke [Mon, 23 Jul 2018 13:24:22 +0000 (15:24 +0200)]
Add caller debugging for wchar / utf8 convs

* src/w32-gettext.cpp, src/w32-gettext.h (utf8_to_wchar),
(wchar_to_utf8): Improve tracing for memory debug.

--
We have some leaks here.

16 months agoUse static references for VARAINT_BOOL | BYREF
Andre Heinecke [Mon, 23 Jul 2018 13:22:25 +0000 (15:22 +0200)]
Use static references for VARAINT_BOOL | BYREF

* src/ribbon-callbacks.cpp (get_crypt_pressed),
(get_is_details_enabled, get_is_crypto_mail): Reference a static.

--
I really don't understand it but malloc'ing also seems wrong
as we leak heap mem here.
These references to static variables appear to work.

16 months agoFix unlikely error memleak
Andre Heinecke [Mon, 23 Jul 2018 13:21:14 +0000 (15:21 +0200)]
Fix unlikely error memleak

* src/mapihel.cpp (mapi_get_message_content_type): Fix error
handling meleak.

16 months agoPoor redmond man's valgrind
Andre Heinecke [Mon, 23 Jul 2018 12:01:16 +0000 (14:01 +0200)]
Poor redmond man's valgrind

* src: Use x functions
* src/xmalloc.h: Provide macros for memdbg.

16 months agoFix tmp path naming if name exists
Andre Heinecke [Mon, 23 Jul 2018 11:54:27 +0000 (13:54 +0200)]
Fix tmp path naming if name exists

* src/common.cpp (get_tmp_outfile): Fix name.

16 months agostrdup -> xstrdup
Andre Heinecke [Mon, 23 Jul 2018 11:04:34 +0000 (13:04 +0200)]
strdup -> xstrdup

--

16 months agoRemove unused code
Andre Heinecke [Mon, 23 Jul 2018 07:42:59 +0000 (09:42 +0200)]
Remove unused code

* src/main.c (create_initialization_vector)
(get_crypt_random): Removed.