gpgol.git
4 days agoAbort attachment process chain in case of error master
Andre Heinecke [Wed, 11 Jul 2018 06:32:57 +0000 (08:32 +0200)]
Abort attachment process chain in case of error

* src/mail.cpp (add_attachments_o): Don't continue with attachment
processing if something failed.

--
This should make the errors clearer and avoid undefined behavior
in case e.g. obtaining an attachment tmp name fails.

GnuPG-Bug-Id: T4063

4 days agoLog w32 error and tried filename for tmp attach
Andre Heinecke [Wed, 11 Jul 2018 06:31:54 +0000 (08:31 +0200)]
Log w32 error and tried filename for tmp attach

* src/common.cpp (get_tmp_outfile): Log error and tried filename.

--
This will help analyse issues like:
GnuPG-Bug-Id: T4063

5 days agoConvert common to cpp and clean it up
Andre Heinecke [Tue, 10 Jul 2018 12:26:12 +0000 (14:26 +0200)]
Convert common to cpp and clean it up

* src/Makefile.am: Remove config-dialog.c
* src/common.c, src/common.cpp: Cppify, cleanup.
* src/config-dialog.c: Remove it.
* src/gpgoladdin.cpp (GetCustomUI_MIME): Use normal utf8_to_wchar.

5 days agoRemove accidentally commited dev debug
Andre Heinecke [Tue, 10 Jul 2018 11:47:52 +0000 (13:47 +0200)]
Remove accidentally commited dev debug

--

5 days agoAdd support for distribution lists (groups)
Andre Heinecke [Tue, 10 Jul 2018 10:25:45 +0000 (12:25 +0200)]
Add support for distribution lists (groups)

* src/oomhelp.cpp (get_recipient_addr_fallbacks):
Handle distributionb lists and plit into
(get_recipient_addr_entry_fallbacks_ex): New. Handle
the exchange stuff.
(try_resolve_group): Resolve distribution lists.
(get_oom_recipients): Check for distribution lists.
* src/oomhelp.h: Add some new defines.

--
This adds support for contact groups / distribution lists.
Not tested with exchange yet but it should work as the code
for the exchange fallbacks is still used.

GnuPG-Bug-Id: T4065

5 days agoLog keys used in internal resolution
Andre Heinecke [Tue, 10 Jul 2018 10:24:45 +0000 (12:24 +0200)]
Log keys used in internal resolution

* src/cryptcontroller.cpp (CryptController::resolve_keys_cached):
Log used keys.

--
Can be helpful to detect problems.

5 days agoImprove recipient handling
Andre Heinecke [Tue, 10 Jul 2018 08:50:33 +0000 (10:50 +0200)]
Improve recipient handling

* src/cryptcontroller.cpp (CryptController::CryptController),
src/keycache.cpp (KeyCache::isMailResolvable),
src/wks-helper.cpp (WKSHelper::handle_confirmation_read):
Update call to mail->getRecipients.
* src/mail.h (Mail::getRecipients): Renamed to
Mail::getCachedRecipients.
* src/mail.cpp (Mail::getRecipients_o): Adapt to vector.
Add error handling.
(Mail::updateOOMData_o): Use vector directly.
* src/oomhelp.cpp, src/oomhelp.h (get_oom_recipients):
Use vector and provide an error.

--
Downstream we already used the recipients mostly as a
vector anyway to avoid the memory mangement hassle.
This gives us more flexibility.

Additionally we now report an error for the case
from:
GnuPG-Bug-Id: T4065

5 days agoUse unique ptr for parser context
Andre Heinecke [Tue, 10 Jul 2018 08:30:51 +0000 (10:30 +0200)]
Use unique ptr for parser context

* src/parsecontroller.cpp (ParseController::parse): Use unique
ptr for GpgME Context.

--
Wherever I see it I tend to change it. Makes the code
easier.

5 days agoUse c++ linkage for oomhelp and conv w32getttext
Andre Heinecke [Tue, 10 Jul 2018 08:27:50 +0000 (10:27 +0200)]
Use c++ linkage for oomhelp and conv w32getttext

* src/mapihelp.h: Don't include oomhelp with c linkage.
* src/oomhelp.h: Use C++ linkage.
* src/Makefile.am: Update accordingly.
* src/w32-gettext.c, src/w32-gettext.cpp: Renamed. Added
casts for c++ and removed trailing whitespace.
* src/w32-gettext.h: Use C linkage for gettext.

--
We have some few C only files like common and main but
mostly we are fully c++. Using C++ linkage will allow
us to change oomhelp functions to work with C++ data
types for better memory management.

6 days agoClarify logging for empty UID emails
Andre Heinecke [Mon, 9 Jul 2018 14:24:32 +0000 (16:24 +0200)]
Clarify logging for empty UID emails

* src/mail.cpp (get_uid_for_sender): Check that email is
not empty.

6 days agoImplement "prefer-smime" option
Andre Heinecke [Mon, 9 Jul 2018 14:22:34 +0000 (16:22 +0200)]
Implement "prefer-smime" option

* src/cryptcontroller.cpp (CryptController::resolve_keys_cached):
Respect prefer smime setting.

--
Some prefer SM.

GnuPG-Bug-Id: T3961

6 days agoMore options / config cleanup
Andre Heinecke [Mon, 9 Jul 2018 14:19:35 +0000 (16:19 +0200)]
More options / config cleanup

* src/main.cpp (write_options): Remove most options now
controlled by the external dialog.
(get_conf_bool): New helper.
(read_options): Use it.
* src/common_indep.c (set_default_key): Removed.
* src/common_indep.h (opt): Remove obsolete values and
add some new ones.

--
Most of the removed options were already obsolete for
ages.

GnuPG-Bug-Id: T3944

6 days agoFix crash for attachment names > 76 chars
Andre Heinecke [Mon, 9 Jul 2018 13:37:28 +0000 (15:37 +0200)]
Fix crash for attachment names > 76 chars

* src/rfc2047parse.c (rfc2047_decode_tokens): Use return
value of realloc.

--
This was introduced by me when porting rfc2047parse away from
glib. *blushes*

GnuPG-Bug-Id: T4062

6 days agotests: Don't override GNUPGHOME in run-parser
Andre Heinecke [Mon, 9 Jul 2018 13:16:07 +0000 (15:16 +0200)]
tests: Don't override GNUPGHOME in run-parser

* tests/run-parser.c (main): Don't override the GNUPGHOME

--
This was useful back when I ran the parser test mostly on
KMail's testcorpus but now when I use it to debug other
errors it is better to let the user set the homedir.

6 days agoFix linux build
Andre Heinecke [Mon, 9 Jul 2018 13:09:13 +0000 (15:09 +0200)]
Fix linux build

* src/parsecontroller.cpp (ParseController::parse): Ifdef
native encoding workaround.

9 days agoSwitch back to old check for reading pane for ol16
Andre Heinecke [Fri, 6 Jul 2018 09:54:11 +0000 (11:54 +0200)]
Switch back to old check for reading pane for ol16

* src/ribbon-callbacks.cpp (get_mail_from_control): Use the
same codepath as OL2010 and 13 for 2016 again, too.

--
The crash in Outlook 2016 started to appear at some point.
Now after various updates to Outlook I can no longer reproduce it.
As the previewpane.wordeditor is not reliable. see:
GnuPG-Bug-Id: T4056

We disable that codepath again. The crash report was
GnuPG-Bug-Id: T3484

9 days agoAdd log_addins oomhelp function
Andre Heinecke [Fri, 6 Jul 2018 09:16:19 +0000 (11:16 +0200)]
Add log_addins oomhelp function

* src/oomhelp.cpp, src/oomhelp.h (log_addins): New.
(get_oom_object): Debug dispid.

--
I could not find a place where the call to Item(x) does
not result in the general 80020009 exception. Strange.
There is something fishy here because "Item" has dispid 0. But
this is also what OutlookSpy shows.

9 days agoAdd missing i18n for conf dialog
Andre Heinecke [Fri, 6 Jul 2018 09:15:12 +0000 (11:15 +0200)]
Add missing i18n for conf dialog

* src/addin-options.cpp (i18n_noops): Add another option string.

12 days agoRemove now unused WinAPI dialog resource
Andre Heinecke [Tue, 3 Jul 2018 14:21:38 +0000 (16:21 +0200)]
Remove now unused WinAPI dialog resource

* src/dialogs.rc: Remove last winapi dialog.

12 days agoChange addion-options to use external dialog
Andre Heinecke [Tue, 3 Jul 2018 14:14:43 +0000 (16:14 +0200)]
Change addion-options to use external dialog

* src/addin-options.cpp (open_gpgolgui): New.
(options_dialog_box): Open gpgolgui or bring it to foreground.
(i18n_noops): Add strings.
(launch_kleo_config): Removed.
(options_window_proc): Removed.

--
This adds a new config dialog which is a dynamic qt application.
It uses the translations from GpgOL.

GnuPG-Bug-Id: T3944

2 weeks agoMake it possible to move decrypted mails
Andre Heinecke [Tue, 26 Jun 2018 14:18:38 +0000 (16:18 +0200)]
Make it possible to move decrypted mails

* src/Makefile.am: Add folder-events.cpp
* src/eventsinks.h (install_FolderEvents_sink),
(detach_FolderEvents_sink): New.
* src/folder-events.cpp: New event handler.
* src/mail.cpp (s_folder_events_map): New map to track
registered handlers.
(Mail::isAboutToBeMoved, Mail::setIsAboutToBeMoved): New.
(Mail::installFolderEventHandler_o): New.
(Mail::closeAllMails_o): detach folder handler.
* src/mail.h: Update accordingly.
* src/mailitem-events.cpp (Write): Pass if mail is about to
be moved.
* src/oomhelp.h (IID_FolderEvents): New.

--
Finally!
While the application has the item copy events the folder
has a before item move event. To catch this we register an
event handler for each folder in which a mail was decrypted.
If a crypto mail is then about to be moved we close it with
discard changes to discard the plaintext, then we pass
the write event to allow the move.

Works flawlessly in the first tests.

GnuPG-Bug-Id: T3459
GnuPG-Bug-Id: T3956
GnuPG-Bug-Id: T3418

2 weeks agoEnable auto-key-retrieve if autoresolve is set
Andre Heinecke [Tue, 26 Jun 2018 12:46:49 +0000 (14:46 +0200)]
Enable auto-key-retrieve if autoresolve is set

* src/parsecontroller.cpp (ParseController::parse): Enable
auto-key-retrieve if autoresolve is set to true.

--
With autoresolve we do network lookups already so it makes
sense to reuse the option here.

2 weeks agoFix bring to foreground logic
Andre Heinecke [Tue, 26 Jun 2018 12:43:10 +0000 (14:43 +0200)]
Fix bring to foreground logic

* src/mail.cpp (do_crypt): Bring to foreground with delay.
* src/windowmessages.cpp (gpgol_window_proc): Don't sleep in the
UI thread.

--
Sleeping in the UI thread to wait for the UI thread to do something
(close a window) was stupid.

GnuPG-Bug-Id: T3771

2 weeks agoAdd i18n noops for config dialog
Andre Heinecke [Tue, 26 Jun 2018 11:03:03 +0000 (13:03 +0200)]
Add i18n noops for config dialog

* src/addin-options.cpp (i18n_noops): New. Strings to be used
from the config dialog.

2 weeks agoImprove state handling of WKS Mails
Andre Heinecke [Tue, 26 Jun 2018 09:17:24 +0000 (11:17 +0200)]
Improve state handling of WKS Mails

* src/wks-helper.cpp: Add new PublishInProgress state. This
avoids the possibility of multiple notifications due to the
late advancement out of the needspublish state.

2 weeks agoMinor improvement to german string
Andre Heinecke [Tue, 26 Jun 2018 09:17:00 +0000 (11:17 +0200)]
Minor improvement to german string

--

2 weeks agoIgnore propchanges on custom mails
Andre Heinecke [Tue, 26 Jun 2018 09:15:28 +0000 (11:15 +0200)]
Ignore propchanges on custom mails

* src/mail.h (Mail::hasOverrideMimeData): New.
* src/mailitem-events.cpp (PropertyChange): Ignore changes
for mails with override mime data.
* src/wks-helper.cpp (WKSHelper::send_mail): Set override
MIME data earlier.

--
This removes auto key locates for our custom WKS Mails.

2 weeks agoImprove handling of UID origin
Andre Heinecke [Tue, 26 Jun 2018 09:05:34 +0000 (11:05 +0200)]
Improve handling of UID origin

* src/mail.cpp (Mail::getCryptoDetails_o, Mail::updateSigstate):
Treat WKD origin as "shortcut to level 2.

--
As described on https://wiki.gnupg.org/AutomatedEncryption we
treat WKD already as a shortcut to level 2 as we have an
HTTPS secure indication from the provider that the key matches
the mail address.

This sets the green bar "verified sender" already for such mails,
because the senders address was verified through the provider.

To protect against phishing attacks this does not help but for
these Level 3 and 4 are required.

2 weeks agoFix potential crash in do autosecure
Andre Heinecke [Tue, 26 Jun 2018 09:03:18 +0000 (11:03 +0200)]
Fix potential crash in do autosecure

* src/mail.cpp (Mail::setDoAutosecure_m): Return if msg
is not found.

--
This happens for example if we programatically created a
mail and then set the "to"

3 weeks agoFix passing std::string to asprintf
Andre Heinecke [Fri, 22 Jun 2018 15:27:33 +0000 (17:27 +0200)]
Fix passing std::string to asprintf

* src/wks-helper.cpp (WKSHelper::notifiy): Fix asprintf call.

--

ooops.

3 weeks agoEnable async crypto again (for now)
Andre Heinecke [Fri, 22 Jun 2018 15:10:32 +0000 (17:10 +0200)]
Enable async crypto again (for now)

* src/mail.cpp (DO_ASYNC_CRYPTO): Define.

--
This works soo much better. But I still have not figured out
why it crashes reliably for some users. :-/

3 weeks agoNote mbox in WKS message
Andre Heinecke [Fri, 22 Jun 2018 15:09:27 +0000 (17:09 +0200)]
Note mbox in WKS message

* src/wks-helper.cpp (WKSHelper::notify): Note for which
mbox the message applies.

--
With multiple accounts this can otherwise be confusing. We
also avoid the word "domain" which is too technical for most.

3 weeks agoTake language from Outlook instead of the system
Andre Heinecke [Fri, 22 Jun 2018 15:06:21 +0000 (17:06 +0200)]
Take language from Outlook instead of the system

* src/oomhelp.cpp (invoke_oom_method_with_parms_type): New.
Helper to allow invokes with a custom type.
(invoke_oom_method_with_parms): Use it.
(get_ol_ui_language): New. Read out the UI language of outlook.
* src/w32-gettext.c (_nl_locale_name): Use it.
* src/oomhelp.h: Update accordingly.

--
It makes sense to use the same language as outlook does. Users
will find anything else confusing and broken.

This also makes it easier to switch languages for screenshots :-P

3 weeks agoRemove code about compat flags
Andre Heinecke [Fri, 22 Jun 2018 15:05:19 +0000 (17:05 +0200)]
Remove code about compat flags

* src/main.c (read_options): Remove compat flags handling.

--
This was no longer used and contained the only i18n call
before the "OnStartupComplete" callback.

3 weeks agoMove i18n_init after the addin connecction
Andre Heinecke [Fri, 22 Jun 2018 15:03:08 +0000 (17:03 +0200)]
Move i18n_init after the addin connecction

* src/common.h (i18n_init): Expose.
* src/main.c (DllMain): Don't init here.
(i18n_init): No longer static.
* src/gpgoladdin.cpp (GpgolAddin::OnStartupComplete): Call it.

--
This ensures that the Application object is accessible when
initializing i18n.

3 weeks agoFix WKS when async enc is disabled
Andre Heinecke [Fri, 22 Jun 2018 13:19:34 +0000 (15:19 +0200)]
Fix WKS when async enc is disabled

* src/mailitem-events.cpp (Send): Allow notify after the
send.
* src/windowmessages.cpp (CRYPTO_DONE): Don't do allow notify here.

3 weeks agoMore cleanup and convetional naming
Andre Heinecke [Fri, 22 Jun 2018 12:46:04 +0000 (14:46 +0200)]
More cleanup and convetional naming

--

3 weeks agoUse convention for MAPI/OOM active functs
Andre Heinecke [Thu, 21 Jun 2018 14:31:57 +0000 (16:31 +0200)]
Use convention for MAPI/OOM active functs

--
This should make it easier to see if a function accesses
MAPI or OOM somewhere internally. For now this is only
done for our main Mail class.

3 weeks agoConstify some calls
Andre Heinecke [Thu, 21 Jun 2018 12:34:21 +0000 (14:34 +0200)]
Constify some calls

--

3 weeks agoIntroduce naming conventions
Andre Heinecke [Thu, 21 Jun 2018 12:28:26 +0000 (14:28 +0200)]
Introduce naming conventions

* src/mail.h: Add comment explaining naming convetions and
explain window message and OOM interaction.

3 weeks agoSet UUID when auto toggling secure
Andre Heinecke [Thu, 21 Jun 2018 11:11:11 +0000 (13:11 +0200)]
Set UUID when auto toggling secure

* src/mail.cpp (Mail::set_do_autosecure_mapi): set uuid.

--
Setting the UUID is neccessary to find the Mail object from
the toggle button to mark that the state was manually set.

GnuPG-Bug-Id: T3999

3 weeks agoFix flicker when locate threads are running
Andre Heinecke [Thu, 21 Jun 2018 11:10:40 +0000 (13:10 +0200)]
Fix flicker when locate threads are running

* src/mail.cpp (Mail::autoresolve_s): Check locate thread count.
--
GnuPG-Bug-Id: T3999

3 weeks agoSimplify isMailResolvable and accept keygen
Andre Heinecke [Thu, 21 Jun 2018 09:22:47 +0000 (11:22 +0200)]
Simplify isMailResolvable and accept keygen

* src/keycache.cpp (isMailResolvable): Return bool. Accept
potential keygen.
* src/keycache.h: Update accordingly.
* src/mail.cpp (Mail::autoresolve_check_s): Update for new API.

--
This inly check for a self key for SMIME. For OpenPGP we can
generate a key.

GnuPG-Bug-Id: T3999

3 weeks agoImplement auto secure feature
Andre Heinecke [Thu, 21 Jun 2018 08:40:39 +0000 (10:40 +0200)]
Implement auto secure feature

* src/common_indep.h (opt): Add autosecure.
* src/cryptcontroller.cpp (CryptController::CryptController): Adopt
new API.
* src/keycache.cpp (do_locate, do_locate_secret): Fix broken handling
of args.
(locate_secret): Add check for empty mbox. Otherwise it could
select the first secret key if the sender address could not be
resolved.
(KeyCache::startLocate): Take recipients as vector.
(KeyCache::isMailResolvable): New. Check if all keys are found
in the cache.
* src/keycache.h: Update accordingly.
* src/mail.cpp (m_cached_recipients): Use a vector instead of
a carray.
(m_first_autoresolve_check): Track state of autoresolve.
(Mail::~Mail): No need to free cached recipients.
(Mail::update_oom_data): Use vector for cached recipients.
(Mail::locate_keys): Adapt to new recipients API. Do
autoresolve_check.
(Mail::take_cached_recipients): Removed.
(Mail::get_cached_recipents): New. Get a copy of the recipients.
(Mail::decrement_locate_count): Trigger autoresolve check.
(Mail::autoresolve_check_s): New. Check if mail is resolvable.
* src/mail.h: Update accordingly.
* src/mailitem-events.cpp (RecipientAdded): Handle opt.autosecure.
* src/main.c (read_options): Read autosecure.
* src/ribbon-callbacks.cpp (mark_mime_action): Use more modern
style. Mark if crypto state was set manually.
* src/windowmessages.cpp (DO_AUTO_SECURE, DONT_AUTO_SECURE): New
messages to set state.

--
This is a first implementation of opportunistic encryption
in GpgOL. If we have enough keys with marginal validity
or if the keys come from WKD we can select "secure" automatically.

GnuPG-Bug-Id: T3999

3 weeks agoHandle always sign/encrypt for inline reply/fw
Andre Heinecke [Wed, 20 Jun 2018 12:58:16 +0000 (14:58 +0200)]
Handle always sign/encrypt for inline reply/fw

* src/mailitem-events.cpp (reply, forward, replyall): Handle
the always sign/encrypt options.

--
If the option reply_crypt is set and the reply is to
a crypto mail the settings from that mail will override
the always options.

Previously this only worked in the Open command so only
if a new message composer window was opened.

This fixes a problem noticed in:
GnuPG-Bug-Id: T4037

3 weeks agoAdd clarifying comment about forward reply detect
Andre Heinecke [Wed, 20 Jun 2018 12:21:02 +0000 (14:21 +0200)]
Add clarifying comment about forward reply detect

--
I just looked at it and at first could not remember why
I didn't just use the pdispVal.

3 weeks agoPrepare keycache for autoencryption
Andre Heinecke [Wed, 20 Jun 2018 11:56:19 +0000 (13:56 +0200)]
Prepare keycache for autoencryption

* src/keycache.cpp,
* src/mail.cpp, src/mail.h (set_crypto_selected_manually),
(increment_locate_count, decrement_locate_count): New stateholders.
* src/keycache.cpp (LocateArgs): Argument helper to carry mail.
(startLocate, startLocateSecret): Add mail argument and use it.
* src/keycache.h: Update accordingly.

--
This keeps track of how many locate threads are running
on a mail. So that we can handle the state where
all locates for a mail are done.

This prepares:
GnuPG-Bug-Id: T3999

3 weeks agoLocks and more locks
Andre Heinecke [Wed, 20 Jun 2018 11:33:28 +0000 (13:33 +0200)]
Locks and more locks

* src/mail.cpp (mail_map_lock, uid_map_lock): New locks.
(Mail::Mail, Mail::~Mail, Mail::get_mail_for_item),
(Mail::get_mail_for_uuid, Mail::is_valid_ptr),
(Mail::close_all_mails, Mail::revert_all_mails),
(Mail::revert_all_mails, Mail::wipe_all_mails),
(Mail::set_uuid, Mail::locate_all_crypto_recipients)
(Mail::delete_lock, Mail::delete_unlock): New helpers to
ensure a mail pointer stays valid.
* src/mail.h: Update accordingly.

--
As the mail object is used from more and more threads
and will soon be used even more for autoencryption
we have to be _very_ careful to minimize / remove race
conditions which could lead to a crash.
For autoencryption we will have async code working
on every new mail.

Prepares:
GnuPG-Bug-Id: T3999

3 weeks agoCppinize keycache a bit more
Andre Heinecke [Tue, 19 Jun 2018 13:36:39 +0000 (15:36 +0200)]
Cppinize keycache a bit more

* src/keycache.cpp (setSmimeKeySecret, setSmimeKey, setPgpKey),
(setPgpKeySecret): Use std::string.
(do_locate, locate_secret): Smart pointer for ctx.
std::string for addr.
* src/keycache.h: Update accordingly.

--
This avoids free / delete errors and here also reduces
std::string allocations.

3 weeks agoFix crash when adding attachment without fileext
Andre Heinecke [Tue, 19 Jun 2018 07:29:11 +0000 (09:29 +0200)]
Fix crash when adding attachment without fileext

* src/mimemaker.cpp (infer_content_type): Check if a suffix
was found and check for the size of the suffix before using it.

--
The crash was introduced with 94c354a0

GnuPG-Bug-Id: T4032

4 weeks agoPost release version bump
Andre Heinecke [Sun, 17 Jun 2018 10:13:37 +0000 (12:13 +0200)]
Post release version bump

--

4 weeks agoUpdate NEWS for todays release gpgol-2.2.0
Andre Heinecke [Sun, 17 Jun 2018 10:08:08 +0000 (12:08 +0200)]
Update NEWS for todays release

--

4 weeks agopo: Update formatting of pt/de
Andre Heinecke [Fri, 15 Jun 2018 06:38:01 +0000 (08:38 +0200)]
po: Update formatting of pt/de

* po/de.po, po/pt.po: Update formatting.

4 weeks agoAdd ukrainian translation
Andre Heinecke [Fri, 15 Jun 2018 06:36:33 +0000 (08:36 +0200)]
Add ukrainian translation

* po/uk.po: New.
* po/LINGUAS: Add it.

--
Translation provided by Yuri Chornoivan. Thanks!

4 weeks agoUpdate Dutch translation.
Erwin Bronkhorst [Sun, 3 Jun 2018 22:44:09 +0000 (00:44 +0200)]
Update Dutch translation.

4 weeks agopo: Update portugese translation
Andre Heinecke [Tue, 12 Jun 2018 12:14:49 +0000 (14:14 +0200)]
po: Update portugese translation

* po/pt.po: Update translations.

--
Translations provided by Marco A.G. Pinto. Thanks!

4 weeks agopo: Update german translation
Andre Heinecke [Tue, 12 Jun 2018 11:40:43 +0000 (13:40 +0200)]
po: Update german translation

--

4 weeks agoAuto update po files
Andre Heinecke [Tue, 12 Jun 2018 09:17:16 +0000 (11:17 +0200)]
Auto update po files

* po: Update.

4 weeks agoRemove engine.c from potfiles
Andre Heinecke [Tue, 12 Jun 2018 09:16:53 +0000 (11:16 +0200)]
Remove engine.c from potfiles

* po/POTFILES.in: No more engine.c

4 weeks agoRemove removed bitmaps from extra dist
Andre Heinecke [Tue, 12 Jun 2018 09:15:45 +0000 (11:15 +0200)]
Remove removed bitmaps from extra dist

* src/icons/Makefile.am: Update EXTRA_DIST.

--
The Icons were required for Outlook < 2010

4 weeks agoClean reply / forwards of unsigned S/MIME Mails
Andre Heinecke [Mon, 11 Jun 2018 16:19:48 +0000 (18:19 +0200)]
Clean reply / forwards of unsigned S/MIME Mails

* src/mailitem-events.cpp (EVENT_SINK_INVOKE): Improve
reply / forward handling and check for HTML Blocked Mails to
clean them.
* src/windowmessages.cpp, src/windowmessages.h
(do_in_ui_thread_async): Extend to take delay as opt. param.
(CLEAR_REPLY_FORWARD): New message.
(gpgol_window_proc): Handle it.

--
This is ugly ugly ugly. As we don't have a reliable
way to detect when a reply / forward is filled with data
we just wait a second before wiping the reply if necessary.

The change in the write event to not invalidate the
last mail also poses a regression risk.

GnuPG-Bug-Id: T3986

4 weeks agoExtend mail class for better reply/forward handling
Andre Heinecke [Mon, 11 Jun 2018 16:17:03 +0000 (18:17 +0200)]
Extend mail class for better reply/forward handling

* src/mail.cpp, src/mail.h (Mail::set_is_reply_crypto_mail),
(Maill::is_reply_crypto_mail, m_is_reply_crypto_mail): New flag for
replies.
(Mail::remove_all_attachements): New helper.
(Mail::is_block_html): Expose the flag.

--
This helps with:
GnuPG-Bug-Id: T3986

4 weeks agoImprove unsigned S/MIME HTML handling
Andre Heinecke [Mon, 11 Jun 2018 16:15:14 +0000 (18:15 +0200)]
Improve unsigned S/MIME HTML handling

* src/mail.cpp (update_body): Improve handling and messages.

--
GnuPG-Bug-Id: T3986

4 weeks agoCleanup unused options and add a warning shown opt
Andre Heinecke [Mon, 11 Jun 2018 16:12:17 +0000 (18:12 +0200)]
Cleanup unused options and add a warning shown opt

* src/common_indep.h: Update option struct.
* src/main.c (init_options): Removed.
(write_options, read_options): Update accordingly.
* src/mapihelp.cpp (mapi_get_gpgol_body_attachment): Remove
obsolete handling to show body as attachment.

--
This removes obsolete OL < 2010 Options and adds a new
smime_html_warn_shown flag.

6 weeks agoClarify comment about inline pgp encoding
Andre Heinecke [Fri, 1 Jun 2018 13:00:14 +0000 (15:00 +0200)]
Clarify comment about inline pgp encoding

* src/parsecontroller.cpp (ParseController::parse): Improve
comment.

6 weeks agoAdd distinct error for legacy nomdc
Andre Heinecke [Fri, 1 Jun 2018 12:59:25 +0000 (14:59 +0200)]
Add distinct error for legacy nomdc

* src/parsecontroller.cpp (format_error): Check for
isLegacyCipherNoMDC.

--
GnuPG-Bug-Id: T3714

6 weeks agoTry to convert clearsigned to utf8 on verify fail
Andre Heinecke [Fri, 1 Jun 2018 12:09:07 +0000 (14:09 +0200)]
Try to convert clearsigned to utf8 on verify fail

* src/parsecontroller.cpp (ParseController::parse): Try again
with UTF-8 if verify opaque failed.

--
We have a bit of a problem in that we access the body
through the 8 bit interface and we need to give it
to GnuPG as 8 bit.

We now try utf8 if the native encoding did not
give us a result. It's a bit of a hack but will
work for messages from gpgol to gpgol and hopefully
for some others, too.

GnuPG-Bug-Id: T3962

6 weeks agoProperly set UTF8 encoding for clearsigned
Andre Heinecke [Fri, 1 Jun 2018 12:07:10 +0000 (14:07 +0200)]
Properly set UTF8 encoding for clearsigned

* src/cryptcontroller.cpp(CryptController::update_mail_mapi):
Set CPID.
* src/mail.cpp (Mail::update_body): Fix charset variable.
(Mail::inline_body_to_body): Also set CPID in OOM.
* src/mymapitags.h: Define PR_INTERNET_CPID.

--

GnuPG-Bug-Id: T3962

6 weeks agoFix encoding for some inline pgp mails
Andre Heinecke [Fri, 1 Jun 2018 09:30:18 +0000 (11:30 +0200)]
Fix encoding for some inline pgp mails

* src/mail.cpp (Mail::update_body): Use InternetCodepage if
charset is not set by the parser.
* src/mlang-charset.cpp (ansi_charset_to_utf8): Add handling
for a directly provided codepage.
* src/rfc2047parse.c (rfc2047_decode_tokens): Update caller.

--
For PGP Inline the charset is not detected by the parsecontroller
in that case we now just use the InternetCodepage from OOM.
Tests show that this works properly.

GnuPG-Bug-Id: T3962

6 weeks agoShow error status on syserror verify
Andre Heinecke [Fri, 1 Jun 2018 08:11:44 +0000 (10:11 +0200)]
Show error status on syserror verify

* src/mail.cpp (Mail::get_crypto_details): Show error.

--
This helps with diagnostics. E.g. and ed25519 signature
in vs-nfd mode leads to a sys error with status
Invalid pubkey algorithm.

6 weeks agoBlock HTML for unsigned S/MIME messages
Andre Heinecke [Fri, 1 Jun 2018 08:06:18 +0000 (10:06 +0200)]
Block HTML for unsigned S/MIME messages

* src/mail.cpp (Mail::set_block_status): New. Sets a MAPI prop
to disable automatic HTML external references.
(Mail::set_block_html): New. HTML content should be blocked.
(Mail::parsing_done): check for block html.
(Mail::update_body): Block HTML if necessary.
* src/parsecontroller.cpp (ParseController::shouldBlockHtml): New.
(is_valid_chksum): Check that the sig is valid even if it is
untrusted.
* src/mymapitags.h (PR_BLOCK_STATUS): New.
* src/oomhelp.h (PR_BLOCK_STATUS_DASL): New.

--
This blocks HTML display in unsigned S/MIME Mails to avoid
attacks that rely on HTML side channels. If there is
no text/plain part it will show the unparsed HTML. Trying
to parse it with Outlook and then inserting at as plain text
left the references intact and appears to be too risky.

GnuPG-Bug-Id: T3986

8 weeks agoRemove unused engine based code
Andre Heinecke [Thu, 17 May 2018 09:01:16 +0000 (11:01 +0200)]
Remove unused engine based code

* src/gpgoladdin.cpp (getCustomUI_MIME): Remove attachment
decrypt context menu. This should be handled by windows file
registry now.

--
This removes the decryptattachment callback which was the last
engine based callback and the now unused crypto functions
from mimemaker.

8 weeks agoRemove GpgOLStr class
Andre Heinecke [Thu, 17 May 2018 07:53:28 +0000 (09:53 +0200)]
Remove GpgOLStr class

--
This was more of a failed experiment and is mostly uneccesary.

8 weeks agoRemove no MIME UI
Andre Heinecke [Thu, 17 May 2018 07:23:16 +0000 (09:23 +0200)]
Remove no MIME UI

--
This should reduce the amount of strings to translate and
also reduce the code lying around.

8 weeks agoRemove unused bitmap icons
Andre Heinecke [Thu, 17 May 2018 07:08:56 +0000 (09:08 +0200)]
Remove unused bitmap icons

* dialogs.h, dialogs.rc: Update accordingly.

8 weeks agoCleanup gpgol_Sources
Andre Heinecke [Thu, 17 May 2018 06:59:19 +0000 (08:59 +0200)]
Cleanup gpgol_Sources

* src/Makefile.am (gpgol_SOURCES): Cleanup / sort.

8 weeks agoRemove additional OL2007 files
Andre Heinecke [Thu, 17 May 2018 06:58:59 +0000 (08:58 +0200)]
Remove additional OL2007 files

--

8 weeks agoRemove files for Outlook 2007 / 2003 support
Andre Heinecke [Wed, 16 May 2018 15:11:35 +0000 (17:11 +0200)]
Remove files for Outlook 2007 / 2003 support

--
This has been long overdue. Outlook 2007 is no longer supported
by Microsoft for over a year now. Outlook 2003 is well,..

This still leaves a lot of unused code that has to be cleaned
up but it removes all the files that are no longer needed.

GnuPG-Bug-Id: T3984

8 weeks agoRemove obsolete patch file. outlook-2007-removal
Andre Heinecke [Wed, 16 May 2018 14:16:46 +0000 (16:16 +0200)]
Remove obsolete patch file.

* gpgol-assuan-abi-2.patch: Remove.

2 months agoAdd Dutch translation
Erwin Bronkhorst [Mon, 14 May 2018 20:38:17 +0000 (22:38 +0200)]
Add Dutch translation

* configure.ac: Bump required GPGME version.
* po/LINUGUAS: Add dutch.
* po/nl.po: New.
* po/po/fr.po: Remove spurious file.

(cherry picked from commit 64f0522227fa50a11e44e07d4b07cbef9fb8c126)

Commit message amended and:
Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
2 months agoStop prasing on non whitepspace before PGP Message
Andre Heinecke [Fri, 11 May 2018 07:05:09 +0000 (09:05 +0200)]
Stop prasing on non whitepspace before PGP Message

* src/mapihelp.cpp (get_msgcls_from_pgp_lines): Again break
on non whitespace before message marker.

--
The problem here is that for inline messages a full quote in
the response could cause GpgOL to use the full quote as the
message instead of the reply. Outlook itself formats
its quotes in a way that would cause this.

While this might break again MTA's which insert stuff above
a Message we have to do this.

GnuPG-Bug-Id: T3964

2 months agoFix crash when looking at msgs without content type
Andre Heinecke [Fri, 4 May 2018 07:23:38 +0000 (09:23 +0200)]
Fix crash when looking at msgs without content type

* src/mapihelp.cpp (change_message_class_ipm_note): Check
for ct before using it in string comparison.

--
The codepath is reached for temporary, discarded mails, e.g.
when a Reply All in the Inline editor is canceled through
Escape.

This fixes: dc48589b3d429d7d156c75b4e7bc784b140f40ce
GnuPG-Bug-Id: T3960

2 months agoLaunch Kleopatra config dialog with parent
Andre Heinecke [Mon, 30 Apr 2018 09:44:54 +0000 (11:44 +0200)]
Launch Kleopatra config dialog with parent

* src/addin-options.cpp (launch_kleo_config): New.
(options_window_proc): Use it.

--
This fixes that the config dialog might be opened in the
background, or that the assuan communication fails.

Fixes
GnuPG-Bug-Id: T3946

2 months agopo: Translate print decrypted in pt
Andre Heinecke [Fri, 27 Apr 2018 07:40:31 +0000 (09:40 +0200)]
po: Translate print decrypted in pt

* po/pt.po: Add a translation.

2 months agoDisable OL 2013 / 2016 resiliency for us
Andre Heinecke [Fri, 27 Apr 2018 06:29:13 +0000 (08:29 +0200)]
Disable OL 2013 / 2016 resiliency for us

* src/gpgoladdin.cpp (setupDoNotDisable): New.
(addGpgOLToReg): New helper.

--
While this should not be necessrary if we don't crash, well
in the real world it happens and then users have the problem
that they have to manually renable GpgOL and report it
as an issue.

With this GpgOL should no longer be disabled in Outlook
2013 and 2016. 2010 does not have this auto disable.

GnuPG-Bug-Id: T3938

2 months agoPost release version bump
Andre Heinecke [Tue, 24 Apr 2018 09:52:04 +0000 (11:52 +0200)]
Post release version bump

--

2 months agoUpdate NEWS for todays release gpgol-2.1.1
Andre Heinecke [Tue, 24 Apr 2018 09:18:07 +0000 (11:18 +0200)]
Update NEWS for todays release

--

2 months agoUpdate german translation
Andre Heinecke [Tue, 24 Apr 2018 08:59:48 +0000 (10:59 +0200)]
Update german translation

* po/de.po: Translate

2 months agoAuto update po files
Andre Heinecke [Tue, 24 Apr 2018 08:54:52 +0000 (10:54 +0200)]
Auto update po files

* po: Auto update

2 months agoFix internal keycache for de-vs mode
Andre Heinecke [Tue, 24 Apr 2018 08:47:21 +0000 (10:47 +0200)]
Fix internal keycache for de-vs mode

* src/keycache.cpp (KeyCache::Private::getEncryptionKeys):
Fix logic for deVs check.

2 months agoFix strange crash in recipient lookup
Andre Heinecke [Tue, 24 Apr 2018 06:37:48 +0000 (08:37 +0200)]
Fix strange crash in recipient lookup

* src/mail.cpp (Mail::locate_keys): Add reentrancy guard.

--
The strangest thing seems to happen here:
In get_recipients the lookup for "AddressEntry" on
an unresolved address might cause network traffic.

So Outlook somehow "detaches" this call and keeps
processing window messages while the call is running.

So our do_delayed_locate might trigger a second locate.
If we access the OOM in this call while we access the
same object in the blocked "detached" call we crash.
(T3931)

After the window message is handled outlook retunrs
in the original lookup.

A better fix here might be a non recursive lock
of the OOM. But I expect that if we lock the handling
of the Windowmessage we might deadlock.

GnuPG-Bug-Id: T3931

This also might be a cause for the crashes which caused
GnuPG-Bug-Id: T3838

2 months agoFix a possible (unlikely) use after free
Andre Heinecke [Tue, 24 Apr 2018 06:36:32 +0000 (08:36 +0200)]
Fix a possible (unlikely) use after free

* src/oomhelp.cpp (get_oom_recipients): Fix a possible
use after release of recipient object.
(get_recipient_addr_fallbacks): Add usual null guard.

2 months agoFormat error if decryption was canceled
Andre Heinecke [Mon, 23 Apr 2018 13:06:54 +0000 (15:06 +0200)]
Format error if decryption was canceled

* src/parsecontroller.cpp (ParseController::parse): Format
error if decryption was canceled.

--
Otherwise it would show an empty body in that case.

2 months agoFix display of No Seckey errors
Andre Heinecke [Mon, 23 Apr 2018 13:03:37 +0000 (15:03 +0200)]
Fix display of No Seckey errors

* src/parsecontroller.cpp (format_error): At some point
decrpyt failed was no longer set but instead it changed
to no seckey. This is better but was not handled.

2 months agoImprove error handling on encryption
Andre Heinecke [Mon, 23 Apr 2018 12:34:12 +0000 (14:34 +0200)]
Improve error handling on encryption

* src/cryptcontroller.cpp (CryptController::parse_output): Handle
the case the the user selects no encryption recipients.
(CryptController::do_crypto): Accept error as argument and
set it / use it.
* src/mail.cpp (do_crypt): Handle error.

--
We still get General Error and Unknown Error way too much
but maybe it helps a bit. At least it won't give us
a little bit more information and don't show the bug
message.

GnuPG-Bug-Id: T3897

2 months agoAccept keys out of WKD as usable for encryption
Andre Heinecke [Thu, 19 Apr 2018 12:48:28 +0000 (14:48 +0200)]
Accept keys out of WKD as usable for encryption

* src/keycache.cpp (KeyCache::getEncryptionKeys): Accept
keys with Original WKD.

--
We are trying to determine here if "automatic" certificate
selection is Ok. When we have a key from WKD we find
that Ok.

2 months agoFix launch cert details on signature error
Andre Heinecke [Thu, 19 Apr 2018 12:47:17 +0000 (14:47 +0200)]
Fix launch cert details on signature error

* src/mail.cpp, src/mail.h (get_verification_result_dump): New.
* src/ribbon-callbacks.cpp (launch_cert_details): Handle the
case that we don't have a sig fingerprint.

2 months agoAdd quick print context menu entry
Andre Heinecke [Thu, 19 Apr 2018 12:36:39 +0000 (14:36 +0200)]
Add quick print context menu entry

* src/gpgoladdin.cpp: Extend ribbon UI and callbacks.
* src/ribbon-callbacks.cpp (print_decrypted, get_is_crypto_mail):
New.

--
As the Quick Print and File -> Print do not work if mails
are only viewed in the Explorer this is a shortcut to
avoid that users have to explicitly open the mail before
printing.

GnuPG-Bug-Id: T3762

2 months agoDon't write OpenPGP Encrypted Message for sig only
Andre Heinecke [Thu, 19 Apr 2018 11:19:38 +0000 (13:19 +0200)]
Don't write OpenPGP Encrypted Message for sig only

* src/mail.cpp (Mail::decrypt_verify): Write only
that it is an OpenPGP or S/MIME message and not that
its encrypted even if its only signed.

3 months agoPost release version bump
Andre Heinecke [Thu, 12 Apr 2018 11:15:12 +0000 (13:15 +0200)]
Post release version bump