gpgol.git
12 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

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

12 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

12 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

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

12 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

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

* po/de.po: Update.

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

* po/*: Update.

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

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

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

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

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

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

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

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

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

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

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

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

12 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

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

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

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

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

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

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

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

12 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

--

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

* po/de.po: Translate

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

* po/*: update.

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

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

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

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

12 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

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

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

12 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'

12 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,..

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

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

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

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

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

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

12 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

12 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

--

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

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

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

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

12 months agoUpdate Dutch translations
Erwin Bronkhorst [Wed, 19 Sep 2018 21:00:54 +0000 (23:00 +0200)]
Update Dutch translations

13 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'

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

13 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

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

13 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)

13 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)

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

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

13 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

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

13 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

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

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

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

13 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)

13 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

13 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)

13 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)

13 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)

13 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)

13 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

13 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

13 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

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

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

13 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

13 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

13 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

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

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

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

--

13 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

--

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

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

* po/*: update

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

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

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

13 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

13 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

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

--

13 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

13 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

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

13 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

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

13 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)

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