gpgol.git
3 months agoAdd explicit decrypt as WindowMessage handler
Andre Heinecke [Fri, 9 Nov 2018 17:17:36 +0000 (18:17 +0100)]
Add explicit decrypt as WindowMessage handler

* src/mail.cpp (decryptVerify_o): Remove obsolete safeguard
against double decryption.
* src/windowmessages.cpp (EXT_API_DECRYPT): Add new command.

--
This is nice to have a close -> do something with the encrypted
mail -> decrypt again workflow.

GnuPG-Bug-Id: T4241

3 months agoPass write for closed mails
Andre Heinecke [Fri, 9 Nov 2018 14:44:21 +0000 (15:44 +0100)]
Pass write for closed mails

* src/folder-events.cpp (Invoke): Set is now implicit in close.
* src/mail.cpp: Change isAboutToBeMoved to passWrite.
(decryptVerify_o): Stop passing write when processing.
* src/mailitem-events.cpp (Write): Pass it when a mail was closed
by us.

--
After closing with discard changes it should be ok to write
as long as we are not decrypted again. This can be helpful
after an external close was triggered and is basically
the same as what we do for a move.

GnuPG-Bug-Id: T4241

3 months agoOverride file close cmd to trigger shutdown
Andre Heinecke [Fri, 9 Nov 2018 10:20:05 +0000 (11:20 +0100)]
Override file close cmd to trigger shutdown

* src/gpgoladdin.cpp (GpgolRibbonExtender::GetIDsOfNames)
(GpgolRibbonExtender::Invoke): Hookup override.
(GetCustomUI_MIME): Override File->Close command.
* src/ribbon-callbacks.cpp (override_file_close): New.
* src/ribbon-callbacks.h: Update accordingly.

--
There are two ways Outlook can be closed. Either through
a Windowmessage (which wie handled already) or through
the FileClose Command. We now also handle the FileClose
to shutdown.
Doing the shutdown later does not work for us because before
we get any events or shutdown notifications we already have
to close / discard our decrypted contents.

GnuPG-Bug-Id: T4236

3 months agoMinor debug output improvements
Andre Heinecke [Thu, 8 Nov 2018 14:43:36 +0000 (15:43 +0100)]
Minor debug output improvements

--

3 months agoRevert "Add InspectorEvents experiment"
Andre Heinecke [Thu, 8 Nov 2018 14:43:21 +0000 (15:43 +0100)]
Revert "Add InspectorEvents experiment"

This reverts commit db8f468e0462f2a4d600b41f8dd0e6b4135d38fa.

3 months agoAdd InspectorEvents experiment
Andre Heinecke [Thu, 8 Nov 2018 14:42:25 +0000 (15:42 +0100)]
Add InspectorEvents experiment

--
This commit is just an experiment to check the order
of events when closing.

3 months agoAdd some NEWS
Andre Heinecke [Thu, 8 Nov 2018 13:04:23 +0000 (14:04 +0100)]
Add some NEWS

--

3 months agoUse WM_USER without offset for ext messages
Andre Heinecke [Thu, 8 Nov 2018 13:01:40 +0000 (14:01 +0100)]
Use WM_USER without offset for ext messages

* src/windowmessages.cpp,
tests/run-messanger.cpp: Use WM_USER without offset.

--
Some documentation like the wine windowmessages list documents
that above WM_USER messages are still system defined.

3 months agoAdd tracing in shutdown
Andre Heinecke [Thu, 8 Nov 2018 13:01:06 +0000 (14:01 +0100)]
Add tracing in shutdown

* src/gpgoladdin.cpp (GpgolAddin::shutdown): Add tracing.

3 months agoSet validate keylist mode for keycache
Andre Heinecke [Thu, 8 Nov 2018 12:40:30 +0000 (13:40 +0100)]
Set validate keylist mode for keycache

* src/keycache.cpp (do_populate_protocol): Add validate option.

--
This fixes S/MIME keys for verfied signatures to have trust
level 2 (because their trust was unknown) before the key
is first updated.

3 months agoFix 64bit format error
Andre Heinecke [Thu, 8 Nov 2018 12:38:27 +0000 (13:38 +0100)]
Fix 64bit format error

* src/windowmessages.cpp (gpgol_window_proc): Fix message id.

3 months agoAdd external API with WindowMessages
Andre Heinecke [Thu, 8 Nov 2018 12:13:06 +0000 (13:13 +0100)]
Add external API with WindowMessages

* src/windowmessages.cpp: Handle new messages.
* src/windowmessagees.h: Add new codes.
* tests/Makefile.am: Update accordingly.
* tests/run-messenger.cpp: New.

--
The run-messenger can be used as an example how to use
this API. As we block saves while decrypted data is open
we add API to close the mails now. Either all or a specific
uuid.

e.g.:

run-messenger.exe 1301 1147d7ed-22fb-48d2-8678-a814df5009eb

GnuPG-Bug-Id: T4241

3 months agoUpdate POTFILES and po files and de.po
Andre Heinecke [Tue, 6 Nov 2018 10:51:28 +0000 (11:51 +0100)]
Update POTFILES and po files and de.po

--

3 months agoFix infographic url
Andre Heinecke [Tue, 6 Nov 2018 07:56:27 +0000 (08:56 +0100)]
Fix infographic url

* src/ribbon-callbacks.cpp (launch_cert_details): Fix url.

--
The old redirect redirects to 404 :-( Maybe time to
change the infographic.

3 months agoAdd junk mail handling
Andre Heinecke [Tue, 6 Nov 2018 07:54:26 +0000 (08:54 +0100)]
Add junk mail handling

* src/categorymanager.cpp (getJunkMailCategory): New.
* src/mail.cpp (Mail::decryptVerify_o): Handle junk.
* src/mail.h (Mail::m_is_junk): New.

--
Junk mails are special. An addon can't access the attachments
so we can't decrypt PGP-MIME. We just add a marker to let
the user now and register our folder event handler so
that the mail can be moved out of junk.

GnuPG-Bug-Id: T4188

3 months agoAdd junk/spam mail folder detection
Andre Heinecke [Mon, 5 Nov 2018 15:44:00 +0000 (16:44 +0100)]
Add junk/spam mail folder detection

* src/oomhelp.cpp, src/oomhelp.h (is_junk_mail): New.

--
We can't access attachments in junk so we need some special
handling. As there is no "Junk" property we do this by
comparing the entryid of the accounts junk folder with
the actual folder of the mail.

GnuPG-Bug-Id: T4188

3 months agoFix tests build for different gpgmepp prefix
Andre Heinecke [Mon, 5 Nov 2018 08:11:14 +0000 (09:11 +0100)]
Fix tests build for different gpgmepp prefix

* tests/Makefile.am: Add GPGME_CXXFLAGS to CXXFLAGS.

3 months agoFix Linux build of tests
Andre Heinecke [Tue, 30 Oct 2018 08:18:35 +0000 (09:18 +0100)]
Fix Linux build of tests

* src/common_indep.c: Include wchar.h
* src/cpphelp.cpp (in_de_vs_mode): use strcasecm
(get_registry_subkeys): Make conditional.
* src/cpphelp.h: Update accordinlgy.
* src/debug.cpp: Fix unused errors and do locking.
* src/parsecontroller.cpp (ParseController::parse): Remove unused
warning.
* tests/Makefile.am: Add definitions for linux

3 months agoMinor style improvement in run-parser output
Andre Heinecke [Tue, 30 Oct 2018 08:16:22 +0000 (09:16 +0100)]
Minor style improvement in run-parser output

* tests/run-parser.cpp (main): Add some newlines.

3 months agotests: Add repeats option to parser runner
Andre Heinecke [Mon, 29 Oct 2018 12:49:15 +0000 (13:49 +0100)]
tests: Add repeats option to parser runner

* tests/run-parser.cpp: Add repeats option.

3 months agoInitialize memory to X on trace + memdbg
Andre Heinecke [Mon, 29 Oct 2018 10:53:27 +0000 (11:53 +0100)]
Initialize memory to X on trace + memdbg

* src/xmalloc.h (xmalloc): Initialize memory to X on debug
level.

--
This is intended to better find memory errors.

3 months agoFix off by one in iconv_to_utf8
Andre Heinecke [Mon, 29 Oct 2018 10:52:23 +0000 (11:52 +0100)]
Fix off by one in iconv_to_utf8

* src/mlang-charset.cpp (iconv_to_utf8): Inlen needed
to include the zero.

--
This fixes a crash when this function is used for conversion.

3 months agoEnable building tests for windows
Andre Heinecke [Mon, 29 Oct 2018 10:13:08 +0000 (11:13 +0100)]
Enable building tests for windows

* src/debug.cpp: Use platform indepentent gpgrt_locks.
* src/main.c (initialize_main): Drop mutex init.

3 months agoPopulate keycache on startup
Andre Heinecke [Thu, 25 Oct 2018 12:03:36 +0000 (14:03 +0200)]
Populate keycache on startup

* src/gpgoladdin.cpp (GpgolAddin::OnStartupComplete): Populate
keycache.
* src/keycache.cpp (KeyCache::populate, do_populate)
(do_populate_protocol): New.
(KeyCache::getUltimateKeys): New.
* src/mail.cpp (level_4_check): Use getUltimateKeys from cache.
* src/parsecontroller.cpp, src/parsecontroller.h (get_ultimate_keys):
Removed.

--
This moves the ultimate keys cache into the keycache where it
belongs and should fix problems not finding signing keys when
sign always is set. It should also speed up the first verify
operation as keylistings are no longer required.

GnuPG-Bug-Id: T4218

3 months agoRevert "Explicitly set real access key for reg too" STABLE-BRANCH-2-3
Andre Heinecke [Thu, 25 Oct 2018 10:29:56 +0000 (12:29 +0200)]
Revert "Explicitly set real access key for reg too"

This reverts commit bf4ab9a6d16869aa6083b10b54a77fc9b8b95b41.

3 months agoExplicitly set real access key for reg too
Andre Heinecke [Thu, 25 Oct 2018 10:23:42 +0000 (12:23 +0200)]
Explicitly set real access key for reg too

* src/common.cpp (REAL_ACCESS): Define.

--
We have to make sure that we try both registry views.

3 months agoRead HKLM fallback from cross registry view
Andre Heinecke [Thu, 25 Oct 2018 09:50:58 +0000 (11:50 +0200)]
Read HKLM fallback from cross registry view

* src/addin-options.cpp (open-gpgolconfig): Do not pass w64 again.
* src/common.cpp (CROSS_ACCESS): New define.
(_readRegStr): Helper for readRegStr.
(readRegStr): More explicit fallbacks.

--
This should be more robust to handle cases where either
HKLM is set up as 32 bit registry key or as 64 bit registry
key.

3 months agoUse gpgrt_w32_iconv as fallback for mlang-charset
Andre Heinecke [Thu, 25 Oct 2018 07:15:18 +0000 (09:15 +0200)]
Use gpgrt_w32_iconv as fallback for mlang-charset

* src/mlan-charset.cpp (ansi_charset_to_uf8): Use gpgrt
as a fallback.

--
We only use it as a fallback as the old code is known to work
and we want to avoid regressions in case the charset names
differ between gpgrt and getcharsetinfo.

GnuPG-Bug-Id: T4156

3 months agoPass --w64 parameter to gpgolconfig
Andre Heinecke [Wed, 24 Oct 2018 12:45:33 +0000 (14:45 +0200)]
Pass --w64 parameter to gpgolconfig

* src/addin-options.cpp (open_gpgolconfig): Pass --64 on
64 bit systems.

3 months agoRevert "Add temporary logging to readRegStr"
Andre Heinecke [Wed, 24 Oct 2018 11:16:06 +0000 (13:16 +0200)]
Revert "Add temporary logging to readRegStr"

This reverts commit 0ab051af6406cb877200f651ca23ebf1ead6482a.

3 months agoRevert "Addionally add outputdebugstring debugs"
Andre Heinecke [Wed, 24 Oct 2018 11:15:57 +0000 (13:15 +0200)]
Revert "Addionally add outputdebugstring debugs"

This reverts commit 56ea58e405b57dcc46f6e8a02dd8dca5a619ef31.

3 months agoAddionally add outputdebugstring debugs
Andre Heinecke [Wed, 24 Oct 2018 11:04:39 +0000 (13:04 +0200)]
Addionally add outputdebugstring debugs

--
This commit is also temporary.

3 months agoAdd temporary logging to readRegStr
Andre Heinecke [Wed, 24 Oct 2018 10:53:05 +0000 (12:53 +0200)]
Add temporary logging to readRegStr

* src/common.cpp (readRegStr): Add temporary verbose logging.

--
This will be reverted after a little beta release to debug
an on site issue.

3 months agoPseudonym some more without DBG_DATA
Andre Heinecke [Wed, 24 Oct 2018 10:51:26 +0000 (12:51 +0200)]
Pseudonym some more without DBG_DATA

* src/oomhelp.cpp (get_sender_SentRepresentingAddress):
anonstr.
* src/mimemaker.cpp (write_part): Anonstr filename.

4 months agoOnly log raw crypto data if DBG_DATA is enabled
Andre Heinecke [Tue, 23 Oct 2018 08:55:07 +0000 (10:55 +0200)]
Only log raw crypto data if DBG_DATA is enabled

* src/mimedataprovider.cpp (MimeDataProvider::collect_input_lines):
Change a log_debug to log_data.

--
This can be signed data so it might be a data leak.

4 months agoFix check for debug levels for string debug
Andre Heinecke [Mon, 22 Oct 2018 10:13:48 +0000 (12:13 +0200)]
Fix check for debug levels for string debug

* src/w32-gettext.h (wchar_to_utf8, utf8_to_wchar): Fix enable_debug
check.

--
The broken logic caused the string debugging to be active if one
of the debug levels required was enabled. This caused data
leak even if debug data was disabled.

GnuPG-Bug-Id: T4193

4 months agoFix HKLM fallback for config values
Andre Heinecke [Mon, 22 Oct 2018 09:56:28 +0000 (11:56 +0200)]
Fix HKLM fallback for config values

* src/common.cpp (load_extension_value): Use read_w32_registry_string.
(load_config_value, expand_path): Removed.

--
We don't need two ways to access the registry. And the
load_config_value codepath did not fallback to HKLM.

GnuPG-Bug-Id: T4204

4 months agoPass lang correctly to config dialog
Andre Heinecke [Tue, 16 Oct 2018 12:14:29 +0000 (14:14 +0200)]
Pass lang correctly to config dialog

* src/addin-options.cpp (open_gpgolconfig): Pass lang.

4 months agoPost release version bump
Andre Heinecke [Tue, 16 Oct 2018 10:28:40 +0000 (12:28 +0200)]
Post release version bump

--

4 months agoAuto update po files gpgol-2.3.1
Andre Heinecke [Tue, 16 Oct 2018 10:25:20 +0000 (12:25 +0200)]
Auto update po files

--

4 months agoUpdate NEWS for todays release
Andre Heinecke [Tue, 16 Oct 2018 10:24:35 +0000 (12:24 +0200)]
Update NEWS for todays release

--

4 months agoDo not try to import empty key data from addrbook
Andre Heinecke [Tue, 16 Oct 2018 10:22:47 +0000 (12:22 +0200)]
Do not try to import empty key data from addrbook

* src/keycache.cpp (importFromAddrBook): Check if data
is empty.

4 months agoMake address book lookup more robust
Andre Heinecke [Tue, 16 Oct 2018 10:21:42 +0000 (12:21 +0200)]
Make address book lookup more robust

* src/addressbook.cpp (Addressbook::update_key_o): Clear checked
entries after update.
(Addressbook::check_o): Only mark resolved contacts as checked.
:xa

4 months agoFix memleaks in new category code
Andre Heinecke [Tue, 16 Oct 2018 08:52:57 +0000 (10:52 +0200)]
Fix memleaks in new category code

* src/categorymanager.cpp,
src/oomhelp.cpp (get_store_for_id, delete_category): Fix leaks.

4 months agoFix string alloc tracing
Andre Heinecke [Tue, 16 Oct 2018 08:52:32 +0000 (10:52 +0200)]
Fix string alloc tracing

* src/w32-gettext.h: Fix string alloc trace check

4 months agoUpdate po files and translate german
Andre Heinecke [Tue, 16 Oct 2018 08:38:06 +0000 (10:38 +0200)]
Update po files and translate german

--

4 months agoAdd signature info to verify category
Andre Heinecke [Tue, 16 Oct 2018 08:24:05 +0000 (10:24 +0200)]
Add signature info to verify category

* src/categorymanager.cpp, src/categorymanager.h: New.
* src/Makefile.am: Add it.
* src/cpphelp.cpp, src/cpphelp.h (join): New.
* src/gpgoladdin.cpp, src/gpgoladdin.h
(Gpgoladdin::get_category_mngr): New.
* src/mail.cpp (Mail::~Mail): Remove categories.
(Mail::updateCategories_o): Use new code for categories.
(Mail::storeID): New carry store info.
* src/oomhelp.cpp (create_category): Fix dbg.
(get_store_for_id): New helper.
(ensure_category_exists): Remove need for appl.
(remove_category): Rewrite to allow partial matches.
(_delete_category): New helper.
(delete_category): New. Delete a category.
(delete_all_categories_starting_with): New.
* src/oomhelp.h: Update accordingly.

--
On startup we delete all old categories to cleanup e.g. after
we crashed and a category was left over. The categories
are only created on the stores where they are required and
only temporary as long as the mail is loaded.

As several mails can share the same category we need the
categorymanager to do some ref counting and help a bit.

GnuPG-Bug-Id: T4183

4 months agoMinor indentation fix
Andre Heinecke [Tue, 16 Oct 2018 08:14:21 +0000 (10:14 +0200)]
Minor indentation fix

--

4 months agoPass address book overrides to keyresolver
Andre Heinecke [Mon, 15 Oct 2018 06:59:05 +0000 (08:59 +0200)]
Pass address book overrides to keyresolver

* src/cryptcontroller.cpp (CryptController::resolve_keys): Pass
overrides.
* src/keycache.cpp, src/keycache.h (KeyCache::getOverrides): Expose
overrides directly.

--

GnuPG-Bug-Id: T4122

4 months agoAdd some new strings from the config dialog
Andre Heinecke [Mon, 15 Oct 2018 06:58:33 +0000 (08:58 +0200)]
Add some new strings from the config dialog

* src/addin-options.cpp (i18n_noops): Add / update
config dlg strings.

4 months agoPass preferred protocol to keyresolver
Andre Heinecke [Mon, 15 Oct 2018 06:55:38 +0000 (08:55 +0200)]
Pass preferred protocol to keyresolver

* src/cryptcontroller.cpp (CryptController::resolve_keys): Pass
preferred protocol.

--
GnuPG-Bug-Id: T4178

4 months agoUpdate pt translation
Andre Heinecke [Wed, 10 Oct 2018 06:52:30 +0000 (08:52 +0200)]
Update pt translation

* po/pt.po: Update

--
Thanks Marco A.G.Pinto

4 months agoMake auto import from S/MIME keyserver default off
Andre Heinecke [Tue, 9 Oct 2018 12:23:26 +0000 (14:23 +0200)]
Make auto import from S/MIME keyserver default off

* src/common_indep.h (opt.search_smime_servers): New.
* src/main.c (read_options): Read it.
* src/keycache.cpp (do_locate): Respect it.

--
This also does not do an external search if there
was an OpenPGP certificate found for the recipient and
prefer_smime is not set.

4 months agoImport certs for s/mime autoresolve from keyserver
Andre Heinecke [Tue, 9 Oct 2018 11:58:23 +0000 (13:58 +0200)]
Import certs for s/mime autoresolve from keyserver

* src/keycache.cpp (do_locate): Factor out S/MIME lookup.
(get_extern_smime_keys): New.
(get_local_smime_keys, get_most_valid_key_simple): Factored
out from do_locate.

--
This implements the feature that X509 Certificates are
automatically searched and imported from the keyserver if
they are not available locally or if all local certs
are expired / revoked etc.

GnuPG-Bug-Id: T4174

4 months agoUpdate german translation
Andre Heinecke [Mon, 8 Oct 2018 16:10:00 +0000 (18:10 +0200)]
Update german translation

* po/de.po: Update.

4 months agoAuto update po files
Andre Heinecke [Mon, 8 Oct 2018 16:06:55 +0000 (18:06 +0200)]
Auto update po files

* po/*: Update.

4 months agoTrace parsing some more
Andre Heinecke [Mon, 8 Oct 2018 16:02:26 +0000 (18:02 +0200)]
Trace parsing some more

* src/parsecontroller.cpp (ParseController::parse): Trace
some more.

--
We especially want to know when GpgME calls are finished.

4 months agoTune down an error to an info
Andre Heinecke [Mon, 8 Oct 2018 16:01:09 +0000 (18:01 +0200)]
Tune down an error to an info

* src/keycache.cpp (onUpdateJobDone): Tune down error to
debug.

--
This happens regularly enough if you switch quickly between two mails.

4 months agoAdd new strings for config dialog debug page
Andre Heinecke [Mon, 8 Oct 2018 16:00:29 +0000 (18:00 +0200)]
Add new strings for config dialog debug page

* src/addin-options.cpp (i18n_noops): Add new strings.

4 months agoAdd lock tracing
Andre Heinecke [Mon, 8 Oct 2018 14:13:34 +0000 (16:13 +0200)]
Add lock tracing

* src/debug.h (gpgol_lock, gpgol_unlock): Add tracing makros.
* src/*.cpp: Use them.

--
This adds lock tracing everywhere except memdbg as tracing
there would be too verbose.

Because deadlocks from race conditions are so hard to
debug it's better if we have the capabilities to anylyse them.

4 months agoRevert "Show signer KeyID and UserID for valid mails"
Andre Heinecke [Mon, 8 Oct 2018 13:28:38 +0000 (15:28 +0200)]
Revert "Show signer KeyID and UserID for valid mails"

This reverts commit c186f2832294737ada9de6d23e466c106537676f.

--
This only worked with contacts from the Address book for
other contacts outlook shows:

To help protect your security, the Follow Up flag text has
been hidden. Follow up. Click here to see hidden text.

4 months agoUse mail_map copies for all complex ops
Andre Heinecke [Mon, 8 Oct 2018 13:23:16 +0000 (15:23 +0200)]
Use mail_map copies for all complex ops

* src/mail.cpp (Mail::revertAllMails_o, Mail::wipeAllMails_o),
(Mail::closeAllMails_o): Use copy of the mail map.

--
For any complex operation we can't hold the lock of the
map for the operation as the map might be modified / accessed
from a different thread to complete the operation.

It should not be a big problem with these functions.

4 months agoFix deadlock when selecting encrypt
Andre Heinecke [Mon, 8 Oct 2018 13:19:58 +0000 (15:19 +0200)]
Fix deadlock when selecting encrypt

* src/mail.cpp (Mail::locateAllCryptoRecipients_o): Use a copy
of the mail map instead of a locked instance.

--
Locking the mail map for a complex operation is a bad
idea. What happened here is that locateKeys_o can start
different threads and those threads can use "Mail::isValidPtr" which
uses the s_mail_map and locks it accordingly.
So there is a deadlock.

4 months agoAdd option to do decryption synchronously
Andre Heinecke [Mon, 8 Oct 2018 13:07:45 +0000 (15:07 +0200)]
Add option to do decryption synchronously

* src/common_indep.h (syncDec): New option.
* src/main.c (read_options): Read it.
* src/mail.cpp (do_parsing): Do not use windowmessage signaling
for parsing done.
(Mail::decryptVerify_o): Call the parser synchronously.

--
This is very ugly but might help some users who are affected
by regular crashes when reading crypto mail.

4 months agoLog configuration settings
Andre Heinecke [Mon, 8 Oct 2018 13:06:22 +0000 (15:06 +0200)]
Log configuration settings

* src/common.cpp (load_extension_value): Log settings.

--
This can be helpful understanding user logs.

4 months agoAdd tracing in keycache
Andre Heinecke [Mon, 1 Oct 2018 08:58:28 +0000 (10:58 +0200)]
Add tracing in keycache

* src/keycache.cpp: Add tracing.

4 months agoAdd specific option for auto-key-retrieve
Andre Heinecke [Mon, 1 Oct 2018 07:17:53 +0000 (09:17 +0200)]
Add specific option for auto-key-retrieve

* src/common_inde.p (opt): Add it.
* src/main.c (read_options): Read it.
* src/parsecontroller.common_inde (ParseController::parse): Use it.

--
This is a new default off option. With the delays coming
from many SKS-Keyservers we can't use it in good consicence
yet it is just too slow if communicating with people that
have not published their keys.

4 months agoFix two encoding issues
Andre Heinecke [Fri, 28 Sep 2018 12:40:57 +0000 (14:40 +0200)]
Fix two encoding issues

* src/ribbon-callbacks.cpp (launch_cert_details): Use MessageBoxW.

4 months agoIgnore Content-Id for Cnt-Disp: attachment
Andre Heinecke [Fri, 28 Sep 2018 11:45:08 +0000 (13:45 +0200)]
Ignore Content-Id for Cnt-Disp: attachment

* src/mimedataprovider.cpp (t2body): Ignore content-id.

--
This should hopefully cover all cases where attachments
were hidden although they should have been shown. Outlook
itself seems to make the difference based on Content-Disposition.

According to documentation there are also ATTACH_FLAGS set
in case an attachment is hidden due to MHTML embeds. But
modifying those did not have an effect.

GnuPG-Bug-Id: T4161

4 months agoImprove attachment add debug output
Andre Heinecke [Fri, 28 Sep 2018 11:43:41 +0000 (13:43 +0200)]
Improve attachment add debug output

* src/mail.cpp (fixup_last_attachment_o): Add a non working
experiment. Improve debugging.
* src/oomhelp.h (PR_ATTACH_FLAGS_DASL): New.

--
The experiment to remove the ATTACH_FLAGS should work in
theory and according to documentation. In practice it does
not work :-(
But maybe we can figure this out later.

4 months agoFix error message in keycache lookup
Andre Heinecke [Fri, 28 Sep 2018 11:35:18 +0000 (13:35 +0200)]
Fix error message in keycache lookup

* src/keycache.cpp (do_update): Fix error / debug output.

4 months agoIgnore reads when shutdown was triggered
Andre Heinecke [Fri, 28 Sep 2018 11:33:42 +0000 (13:33 +0200)]
Ignore reads when shutdown was triggered

* src/gpgoladdin.cpp (GpgolAddin::shutdown): Set state
variable at begin of shutdown.
* src/mailitem-events.cpp (BeforeRead): Ignore when
shutting down.

--
This happened when we are closing and closing all mails
but there are multiple inspectors around e.g. if the mail
is open in Outlook Spy. In that case Outlook tries to read
it again immediately after close.

4 months agoFix potential crash in revert
Andre Heinecke [Fri, 28 Sep 2018 11:32:31 +0000 (13:32 +0200)]
Fix potential crash in revert

* src/revert.cpp (gpgol_mailitem_revert): Bail out if
msg class is NULL.

--
This happened to me in a weird close scenario where I
had multiple outlook spy windows open.

4 months agoShow signer KeyID and UserID for valid mails
Andre Heinecke [Wed, 26 Sep 2018 13:47:48 +0000 (15:47 +0200)]
Show signer KeyID and UserID for valid mails

* src/mail.cpp (Mail::updateSigFlag_o): Set the flag.
(Mail::flagChangeTriggered): New helper to carry the state.
(pretty_id): Helper to format a fingerprint / long keyid.
* src/mailitem-events.cpp (PropertyChange): Ignore our
own changes.

--
This has two purposes. If the name of the sender is large
or looks like a mail address it is not visible at first
glance which key was used to verify as the real mail
address might be out of the screen.

Additionally this serves as another split between the
Verified Sender category and the body to make it even
harder to undetectable fake this through HTML. It
is never possible to fake it or replace it together
with the changed status icon.

4 months agoAdd sender name and repr name DASL
Andre Heinecke [Wed, 26 Sep 2018 13:46:52 +0000 (15:46 +0200)]
Add sender name and repr name DASL

* src/oomhelp.h: Add new defines.

--
We do not need them right now but I've used them for experiments.

4 months agoFix potential deadlock in autosecure check
Andre Heinecke [Tue, 25 Sep 2018 13:36:58 +0000 (15:36 +0200)]
Fix potential deadlock in autosecure check

* src/mail.cpp (autosecureCheck): Do not wait for
the auto secure set to finish.

--
This fixes a race that could occur when the addressbook thread
and a locator thread were working at the same time that
could cause a deadlock in lockDelete.

4 months agoUpdate de.po after auto msgfmt
Andre Heinecke [Tue, 25 Sep 2018 13:36:43 +0000 (15:36 +0200)]
Update de.po after auto msgfmt

--

4 months agoUpdate german localisation
Andre Heinecke [Tue, 25 Sep 2018 12:23:33 +0000 (14:23 +0200)]
Update german localisation

* po/de.po: Translate

4 months agoAuto update po file
Andre Heinecke [Tue, 25 Sep 2018 12:14:52 +0000 (14:14 +0200)]
Auto update po file

* po/*: update.

4 months agoFix memdbg error for log_file
Andre Heinecke [Tue, 25 Sep 2018 12:13:24 +0000 (14:13 +0200)]
Fix memdbg error for log_file

* src/debug.cpp (set_log_file): Do not use memdbg decorated
functions.

--
The log file is first set in conjunction with reading the
debug options. So we do not memdbg the alloc and later
get an error when options are read again. This
fixes an Error message.

4 months agoFurther simplyify log level values
Andre Heinecke [Tue, 25 Sep 2018 12:07:01 +0000 (14:07 +0200)]
Further simplyify log level values

--
As we only have 4 levels now remove the others and
only keep their values around for compatibility.

4 months agoOnly include conversion strings for DBG_DATA
Andre Heinecke [Tue, 25 Sep 2018 11:23:13 +0000 (13:23 +0200)]
Only include conversion strings for DBG_DATA

* src/w32-gettext.h: Guard debug output of all strings
also with DBG_DATA.

--
Otherwise we would have leaked private data if trace
and dbg mem was enabled.

4 months agoAdd new strings for gpgolconfig and rename
Andre Heinecke [Tue, 25 Sep 2018 11:22:14 +0000 (13:22 +0200)]
Add new strings for gpgolconfig and rename

* src/addin-options.cpp: Renamed gpgolgui to gpgolconfig.
We have more then one GUI application nowadays ;-)
* src/addin-options.cpp: Added new strings for debug config.

4 months agoFix mlang release after mlang error
Andre Heinecke [Tue, 25 Sep 2018 09:27:12 +0000 (11:27 +0200)]
Fix mlang release after mlang error

* src/mlang-charset.cpp (ansi_charset_to_utf8): Fix release.

--
In case of errors we may not release the mlang charset anymore
because we are now using it cached. This caused crashes and
probably hangs.

It is a regression from:
59e8a7ee3bcd16275091c9535626e49fc2a6c4af

GnuPG-Bug-Id: T4141

4 months agoFix a tracing regression
Andre Heinecke [Tue, 25 Sep 2018 07:50:32 +0000 (09:50 +0200)]
Fix a tracing regression

* src/mapihelp.cpp (mapi_set_attach_hidden): Fix return scope.

--
My regexp did not match lines that did not contain an
if or an else *sigh* above the return.

4 months agoReduce tracing verbosity a bit
Andre Heinecke [Tue, 25 Sep 2018 07:31:36 +0000 (09:31 +0200)]
Reduce tracing verbosity a bit

--
This removes tracing from very often called functions
like message_cb in mimedataprovider or lookup_oom_dispid.

4 months agoMerge remote-tracking branch 'dutch-l10n/dutch'
Andre Heinecke [Tue, 25 Sep 2018 06:16:03 +0000 (08:16 +0200)]
Merge remote-tracking branch 'dutch-l10n/dutch'

4 months agoAdd tracing support for important code
Andre Heinecke [Mon, 24 Sep 2018 16:18:11 +0000 (18:18 +0200)]
Add tracing support for important code

src/addressbook.cpp,
src/application-events.cpp,
src/cryptcontroller.cpp,
src/debug.h,
src/folder-events.cpp,
src/mail.cpp,
src/mailitem-events.cpp,
src/mapihelp.cpp,
src/mimedataprovider.cpp,
src/oomhelp.cpp,
src/parsecontroller.cpp,
src/rfc2047parse.c,
src/w32-gettext.h,
src/windowmessages.cpp: Add tracing support.

--
If DBG_TRACE is enabled this will trace function calls
and returns. As we don't really have a debugger this
can be important to understand differences in different
scenarios.

Big performance impact when enabled. Huge logs will be
created and the commit has a regression risk due to
lines like:

if (foo)
  return X;

Where we now need:

if (foo)
  {
    TRETURN X;
  }

I hope I caught all this with my regular expressions and
manual review but this patch is very large,..

4 months agoImprove debugging (e.g. by using pseudonyms)
Andre Heinecke [Mon, 24 Sep 2018 14:50:51 +0000 (16:50 +0200)]
Improve debugging (e.g. by using pseudonyms)

--
This should improve debugging in that without log_data enabled
no user specific strings should be logged. This will make
it easier to query users for their logs.

4 months agoMake debug macros variadic to include category
Andre Heinecke [Mon, 24 Sep 2018 14:40:11 +0000 (16:40 +0200)]
Make debug macros variadic to include category

* src/debug.h (log_oom, log_data, log_memory): Make variadic to
include the category.

--
This should help with filtering logs.

4 months agoRemove very obsolete "watcher.cpp"
Andre Heinecke [Mon, 24 Sep 2018 14:00:52 +0000 (16:00 +0200)]
Remove very obsolete "watcher.cpp"

* src/watcher.cpp: Removed.

--
This was not even used by the 2003 plugin anymore.

4 months agoRemove obsolete / unused code
Andre Heinecke [Mon, 24 Sep 2018 10:03:33 +0000 (12:03 +0200)]
Remove obsolete / unused code

* src/exechelp.c, src/exechelp.h: Removed.
* src/Makefile.am: Update accordingly.

--
We use GpgME spawning nowadays.

4 months agoAdd string pseudonyms for debug output
Andre Heinecke [Mon, 24 Sep 2018 09:50:25 +0000 (11:50 +0200)]
Add string pseudonyms for debug output

* src/debug.cpp (anonstr): New.

--
If DBG_DATA is disabled this will pseudonym strings
in debug output.

4 months agoUse unordered_map in memdbg for performance
Andre Heinecke [Mon, 24 Sep 2018 09:12:00 +0000 (11:12 +0200)]
Use unordered_map in memdbg for performance

* src/memdbg.cpp: Use unordered_map for faster lookups.

--
This code can be queried very often so a performance
improvement is nice to have.

4 months agoReplace log_mime_data with log_data
Andre Heinecke [Mon, 24 Sep 2018 09:00:11 +0000 (11:00 +0200)]
Replace log_mime_data with log_data

* src/mimedataprovider.cpp: Replace log_mime_data with log_data.
* src/debug.h: Update log macros

4 months agoReplace log_oom_extra with log_oom
Andre Heinecke [Mon, 24 Sep 2018 08:57:19 +0000 (10:57 +0200)]
Replace log_oom_extra with log_oom

--

4 months agoAdd "Supertrace" macros
Andre Heinecke [Mon, 24 Sep 2018 08:56:40 +0000 (10:56 +0200)]
Add "Supertrace" macros

* src/debug.h (TSTART, TRETURN, DBG_SUPERTRACE): New macros
for a new super verbose tracing.

4 months agoLog if logging fails
Andre Heinecke [Mon, 24 Sep 2018 08:02:13 +0000 (10:02 +0200)]
Log if logging fails

* src/debug.cpp (lock_log): Do not wait infinite for
log lock.
(do_log): Log to debug output if obtaining the log lock failed.

--
I do not see how this can fail. But still an infinite wait
should be avoided and the failure handled at least with a
short note.

4 months agoStart simplification of log categories
Andre Heinecke [Mon, 24 Sep 2018 07:38:29 +0000 (09:38 +0200)]
Start simplification of log categories

* src/debug.cpp, src/debug.h: New. Place for log functionality.
* src/common.cpp, src/common_indep.c, src/common_indep.h: Move out
debugging functions.
* src/keycache.cpp, src/mail.cpp, src/main.c,
src/mimedataprovider.cpp, src/oomhelp.cpp,
src/parsecontroller.cpp: Rename log_mime_parser to log data.

4 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.