gpgol.git
10 months 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!

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

--

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

* po: Update.

10 months 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

10 months 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

10 months 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

10 months 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

10 months 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

10 months 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.

10 months 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.

10 months 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

10 months 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

10 months 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

10 months 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

10 months 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.

10 months 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

11 months 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.

11 months 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.

11 months 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.

11 months 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.

11 months 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.

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

--

11 months 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

11 months 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.

11 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>
11 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

11 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

11 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

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

11 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

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

--

11 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

--

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

* po/de.po: Translate

11 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

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

11 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

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

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

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

11 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

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

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

11 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

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

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

12 months agoUpdate NEWS for todays release gpgol-2.1.0
Andre Heinecke [Thu, 12 Apr 2018 11:00:52 +0000 (13:00 +0200)]
Update NEWS for todays release

--

12 months agoUpdate german l10n
Andre Heinecke [Thu, 12 Apr 2018 11:00:17 +0000 (13:00 +0200)]
Update german l10n

* po/de.po: Translate.

12 months agoAuto update po files
Andre Heinecke [Thu, 12 Apr 2018 10:58:10 +0000 (12:58 +0200)]
Auto update po files

--

12 months agoHide attachment removal warning on revert
Andre Heinecke [Thu, 12 Apr 2018 10:49:35 +0000 (12:49 +0200)]
Hide attachment removal warning on revert

* src/mail.cpp (attachment_remove_warning_disabled): New.
(Mail::revert): Disable attachment warning.
* src/mailitem-events.cpp: Check if warnings are disabled.

--
On revert this would otherwise show the newly introduced
warning.

12 months agoIgnore InternetCodepage changes
Andre Heinecke [Thu, 12 Apr 2018 10:49:08 +0000 (12:49 +0200)]
Ignore InternetCodepage changes

* src/mailitem-events.cpp: Ignore internetcodepage changes.

12 months agoShow warning if attachment of crypt mail removed
Andre Heinecke [Wed, 11 Apr 2018 14:14:44 +0000 (16:14 +0200)]
Show warning if attachment of crypt mail removed

* src/mailitem-events.cpp (EVENT_SINK_INVOKE): Handle
AttachmentRemove event and show warning if an attachment
is removed from a crypto mail.

--
GnuPG-Bug-Id: T3886

12 months agoIgnore received time propchange
Andre Heinecke [Wed, 11 Apr 2018 14:14:16 +0000 (16:14 +0200)]
Ignore received time propchange

* src/mailitem-events.cpp (prop_blacklist): Add
ReceivedTime to blacklist.

12 months agoFix early deletion of temporary attachments
Andre Heinecke [Wed, 11 Apr 2018 14:12:49 +0000 (16:12 +0200)]
Fix early deletion of temporary attachments

* src/mail.cpp (add_attachments): Close handle before
deletion.

--
This fixes the problem that as long as Outlook is open
the temporary files stick around and are not removed.
Which in turn leads to numbers added to the attachments.

GnuPG-Bug-Id: T3886

12 months agoFix spelling in german propchange warning
Andre Heinecke [Wed, 11 Apr 2018 14:11:31 +0000 (16:11 +0200)]
Fix spelling in german propchange warning

* po/de.po: Fix german propchange warning.

--
GnuPG-Bug-Id: T3884

12 months agoImplement send again for crypto mails
Andre Heinecke [Wed, 11 Apr 2018 13:22:05 +0000 (15:22 +0200)]
Implement send again for crypto mails

* src/mail.cpp (Mail::set_is_send_again): New.
(Mail::parsing_done): Add handling for send again.
* src/mailitem-events.cpp: Detect a send again.

--
This detects the send again by the propchange of SendUsingAccount
and a "sent" value of false. Usually crypto mails have a sent
value of true.

In this case we remove our attachments (so that they are not
included in the sent again), set the draft info so that the
crypto state is nicely preselected and finally change the
type so that is_crypo_mail returns false for decrypted
send again mails.

GnuPG-Bug-Id: T3885

12 months agoChange S/MIME behavior depending on Exchange ver.
Andre Heinecke [Wed, 11 Apr 2018 11:15:09 +0000 (13:15 +0200)]
Change S/MIME behavior depending on Exchange ver.

* src/oomhelp.cpp, src/oomhelp.h (get_ex_major_version_for_addr): New.
* src/cryptcontroller.cpp (create_encrypt_attach): Accept
exchange version as parameter. Change behavior accordingly.
(CryptController::update_mail_mapi): Add handling for exchange ver.
* src/mimemaker.cpp (create_top_encryption_header): Accept
exchange ver.
* src/mimemaker.h: Update accordingly.

--
This fixes 7cb3feaf which broke S/MIME encrypted send for
older exchange versions and SMTP / IMAP. Because it unconditionally
used different code to construct the encrypted message in the
expectation that this would also work as an alternative.

GnuPG-Bug-Id: T3884

12 months agoHandle weirdly constructed PGP/MIME mails
Andre Heinecke [Wed, 11 Apr 2018 08:13:33 +0000 (10:13 +0200)]
Handle weirdly constructed PGP/MIME mails

* src/mapihelp.cpp (get_msgcls_from_pgp_lines): Add return
value for empty body.
(get_msgcls_from_first_attachment): New. factored out.
(change_message_class_ipm_note): Use get_msgcls_from_first_attachment.

--
This fixes the handling of mails that are:

multipart/mixed
->application/pgp-encrypted
->application/octed-stream

They also don't have a body. To avoid overhead in a
normal unencrypted multipart mixed mail we only check
for this structure if we don't have a body.

GnuPG-Bug-Id: T3882

12 months agoMake S/MIME compatible with Exchange 2016 patched
Andre Heinecke [Tue, 10 Apr 2018 13:49:21 +0000 (15:49 +0200)]
Make S/MIME compatible with Exchange 2016 patched

* src/oomhelp.h (PR_PIDNameContentType_DASL): New.
* src/mimemaker.cpp (create_top_encryption_header): We no longer
create the header ourself.
* src/mail.cpp (Mail::update_crypt_oom): Here we set the header
values now.
* src/cryptcontroller.h (CryptController::get_protocol)
(CryptController::is_encrypter): New accessors.
* src/cryptcontroller.cpp (create_encrypt_attach): Write binary
data for S/MIME. Outlook will do the base64 conversion.

--
This fixes a lot of interop issues. Otherwise we would
either have weirdly structured mails or mails without smime-type
header or mails where the pkcs7-mime part was doubly base64
encoded with the inner encoding containing the headers.

Hope this works with older Exchanges and Outlooks.

GnuPG-Bug-Id: T3884

12 months agoImprove acceptance of the parser
Andre Heinecke [Tue, 10 Apr 2018 13:48:08 +0000 (15:48 +0200)]
Improve acceptance of the parser

* src/mimedataprovider.cpp (MimeDataProvider::collect_data): Relax.
If a message starts with Content-Type it's probably a mime structure.

12 months agoHandle error in mapi update
Andre Heinecke [Tue, 10 Apr 2018 11:14:42 +0000 (13:14 +0200)]
Handle error in mapi update

* src/mail.cpp (do_crypt): Handle error in mapi update.

12 months agoSleep a bit before bringing window to front
Andre Heinecke [Tue, 10 Apr 2018 11:12:35 +0000 (13:12 +0200)]
Sleep a bit before bringing window to front

* src/common.c (bring_to_front): log when done.
* src/windowmessages.cpp (gpgol_window_proc): Sleep a bit
before bring to front.

--
This might resolve an observed deadlock where setforegroundwindow
would block the UI thread as it tried to bring the disabled
mail window to front. Might also help with:

GnuPG-Bug-Id: T3889

12 months agoFix encrypt to self if keycache is used
Andre Heinecke [Thu, 5 Apr 2018 12:05:13 +0000 (14:05 +0200)]
Fix encrypt to self if keycache is used

* src/cryptcontroller.cpp (CryptController::resolve_keys_cached):
Add sender to recipients if encrypt is selected.
* src/keycache.cpp, src/keycache.h (KeyCache::getEncryptionKeys):
Use a vector of strings instead of carray.

--
Oooops.

12 months agoAdd helper to convert carray to vector
Andre Heinecke [Thu, 5 Apr 2018 12:04:38 +0000 (14:04 +0200)]
Add helper to convert carray to vector

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

12 months agoRevert "Jump the event queue"
Andre Heinecke [Thu, 5 Apr 2018 10:01:18 +0000 (12:01 +0200)]
Revert "Jump the event queue"

This reverts commit a6bf8ef284d98f87a9e64ce326e2a0a55633213c.

--
Did not work as intended

12 months agoMore saveguards and logging in get_ultimate_keys
Andre Heinecke [Thu, 5 Apr 2018 09:29:02 +0000 (11:29 +0200)]
More saveguards and logging in get_ultimate_keys

* src/parsecontroller.cpp (ParseController::get_ultimate_keys):
Add more debug output and saveguards.

--
From the logs in a bugreport it looks very much like we
crash somewhere in between starting the keylisting and
finishing it.

Checking for invalid key or if a uid has an id makes
sense, but might not be the crash.

GnuPG-Bug-Id: T3857

12 months agoDisable oom body check for MIME mails
Andre Heinecke [Thu, 5 Apr 2018 08:57:39 +0000 (10:57 +0200)]
Disable oom body check for MIME mails

* src/mailitem-events.cpp (EVENT_SINK_INVOKE): Disable
safety checks.

--
The safety check added for T3863 triggered too often.
Even if a Body is found in OOM when we send MIME that
should not be a problem as the MIME conversion will
wkill the body.

GnuPG-Bug-Id: T3863
GnuPG-Bug-Id: T3875

12 months agoLog body if body was found after crypto
Andre Heinecke [Thu, 5 Apr 2018 08:56:29 +0000 (10:56 +0200)]
Log body if body was found after crypto

* src/mail.cpp (has_crypt_or_empty_body_oom): Log body in
very verbose logging mode.

--
Might help to figure out what goes wrong in:
GnuPG-Bug-Id: T3875

12 months agoAlso clear plain body in wipe
Andre Heinecke [Thu, 5 Apr 2018 08:55:43 +0000 (10:55 +0200)]
Also clear plain body in wipe

* src/mail.cpp (Mail::wipe): Clear body even if clearing
the HTML Body succeeds.

--
Might help with:
GnuPG-Bug-Id: T3875

12 months agoProperly handle crypt cancel for inline mails
Andre Heinecke [Thu, 5 Apr 2018 06:44:44 +0000 (08:44 +0200)]
Properly handle crypt cancel for inline mails

* src/mailitem-events.cpp (EVENT_SINK_INVOKE): Handle error
or canceled crypt for inline mails.

--
Canceling recipients would otherwise show a bug message.

GnuPG-Bug-Id: T3864

12 months agoDon't access listed key on error
Andre Heinecke [Thu, 5 Apr 2018 06:39:40 +0000 (08:39 +0200)]
Don't access listed key on error

* src/parsecontroller.cpp (ParseController::get_ultimate_keys):
Don't access key data member on error.

--
A bit cleaner in case key is somehow invalid.

12 months agoFix S/MIME encryption with latest Exchange 2016
Andre Heinecke [Wed, 28 Mar 2018 09:12:10 +0000 (11:12 +0200)]
Fix S/MIME encryption with latest Exchange 2016

* src/cryptcontroller.cpp (CryptController::update_mail_mapi):
Set overrideMimeTag to application/pkcs7-mime for smime enc.
* src/mimemaker.cpp (create_mapi_attachmend): Add overrideMimeTag
paramenter.
(create_top_encryption_header): Rearrange header for S/MIME enc.

--
Comparing outlooks own S/MIME mails with GpgOL mails lead to this.
Tests show that this way the mails do pass the exchange
server. With only slight variations we get errors.

GnuPG-Bug-Id: T3853

12 months agos/is_inline_response/async_crypt_disabled/
Andre Heinecke [Mon, 26 Mar 2018 15:41:39 +0000 (17:41 +0200)]
s/is_inline_response/async_crypt_disabled/

--
This should make it more clear and avoid a PGP/Inline <> Inline
Editor misunderstanding.

12 months agos/should_inline_crypt/do_pgp_inline/
Andre Heinecke [Mon, 26 Mar 2018 15:39:51 +0000 (17:39 +0200)]
s/should_inline_crypt/do_pgp_inline/

--
Make it more clear.

12 months agoFix sending PGP/Inline synchronously
Andre Heinecke [Mon, 26 Mar 2018 15:35:16 +0000 (17:35 +0200)]
Fix sending PGP/Inline synchronously

* src/common.h: Add error code.
* src/mail.cpp (Mail::update_crypt_mapi): Don't reset crypter
if in sync mode.
(Mail::update_crypt_oom): Reset crypter in sync mode.
* src/mailitem-events.cpp (EVENT_SINK_INVOKE): Check that
states for inline mail are as expected or bug out.

--
For synchonous inline encrypted the cryptcontroller was
deleted too early. This caused body_to_body to fail and
ultimately lead to an unencrypted mail.

This fixes:
GnuPG-Bug-Id: T3863

12 months agoAdd bug error if body_to_body failed
Andre Heinecke [Mon, 26 Mar 2018 15:16:40 +0000 (17:16 +0200)]
Add bug error if body_to_body failed

* src/mail.cpp (Mail::update_crypt_oom): Check for and
handle error in inline_body_to_body.

--
GnuPG-Bug-Id: T3863

12 months agoAdd safety check to prevent unencrypted send
Andre Heinecke [Mon, 26 Mar 2018 14:57:20 +0000 (16:57 +0200)]
Add safety check to prevent unencrypted send

* src/mail.cpp (Mail::has_crypted_or_empty_body): New.
(Mail::update_crypt_oom): Use it.
(has_crypt_or_empty_body_oom): New helper.
* src/mailitem-events.cpp (EVENT_SINK_INVOKE): Check if
body is empty or a crypt message before passing send on
a crypto mail.

--
GnuPG-Bug-Id: T3863

The idea is to check as a last ditch if before sending
a mail that "should" be encrypted if it has either
an empty body or a PGP/Inline body.
This won't help of course for empty mails with attachments
but should work in most cases.

The codepath is never hit intentional so the error
message points to a bug. It's just an additional
saveguard.

12 months agoCheck for error on encrypt_sign_start
Andre Heinecke [Mon, 26 Mar 2018 14:56:28 +0000 (16:56 +0200)]
Check for error on encrypt_sign_start

* src/mailitem-events.cpp (EVENT_SINK_INVOKE): Check error
of encrypt_sign_start.

12 months agoHandle encrypt / sign on empty message
Andre Heinecke [Mon, 26 Mar 2018 14:55:35 +0000 (16:55 +0200)]
Handle encrypt / sign on empty message

* src/cryptcontroller.cpp (CryptController::collect_data):
Handle empty message.

12 months agoAbort if mail has no body and no attachments
Andre Heinecke [Mon, 26 Mar 2018 14:41:00 +0000 (16:41 +0200)]
Abort if mail has no body and no attachments

* src/cryptcontroller.cpp (CryptController::collect_data):
Abort if no body and no attachments.

12 months agoAdd gpgol_bug helper function
Andre Heinecke [Mon, 26 Mar 2018 14:13:36 +0000 (16:13 +0200)]
Add gpgol_bug helper function

* src/common.c, src/common.h (gpgol_bug): New.
* src/mail.cpp (do_crypt): Use it.

--
This is a little helper to reuse the same message if we
think a user visible error / bug should be done.

12 months agoDocument how encryption is done in do_crypt
Andre Heinecke [Mon, 26 Mar 2018 14:12:40 +0000 (16:12 +0200)]
Document how encryption is done in do_crypt

* src/mail.cpp (do_crypt): Add explaining comment about the
states.

12 months agoDon't carry around inline crypt state twice
Andre Heinecke [Mon, 26 Mar 2018 06:47:57 +0000 (08:47 +0200)]
Don't carry around inline crypt state twice

* src/cryptcontroller.cpp, src/cryptcontroller.h: Replace
m_inline member variable with access to Mail::should_inline_crypt.
* src/mail.h: Add set_should_inline_crypt.
* src/mail.cpp: Update callers.

--
Having two inline states adds complexity and might lead to
wrong results. E.g. Mail::should_inline_crypt would not change
when the cryptcontroller detected attachments.

GnuPG-Bug-Id: T3863

12 months agoSpellcheck german localisation
Andre Heinecke [Fri, 23 Mar 2018 13:37:22 +0000 (14:37 +0100)]
Spellcheck german localisation

* po/de.po: Spellcheck.

--
GnuPG-Bug-Id: T3859

12 months agoFix w64 build
Andre Heinecke [Wed, 21 Mar 2018 12:55:13 +0000 (13:55 +0100)]
Fix w64 build

* src/ribbon-callbacks.cpp (launch_cert_details): Cast HWND w64
compatible.

12 months agoAuto update translations
Andre Heinecke [Wed, 21 Mar 2018 12:03:02 +0000 (13:03 +0100)]
Auto update translations

* po/*: update.

12 months agoAdd proper spawn flags to kleopatra initial start
Andre Heinecke [Tue, 20 Mar 2018 08:14:28 +0000 (09:14 +0100)]
Add proper spawn flags to kleopatra initial start

* src/ribbon-callbacks.cpp (launch_cert_details): Add spawn
flags to fix initial show.

--
This allows the initial start to show a window / foreground
window and fixes a bug that the initial cert details was
not shown.

GnuPG-Bug-Id: T3845

12 months agoProvide parent wid for certificate details
Andre Heinecke [Tue, 20 Mar 2018 07:43:45 +0000 (08:43 +0100)]
Provide parent wid for certificate details

* src/ribbon-callbacks.cpp (launch_cert_details): Add
--parent-wid.

--
This helps Kleopatra not to open the certificate details
in the background.

GnuPG-Bug-Id: T3845

13 months agoJump the event queue
Andre Heinecke [Thu, 15 Mar 2018 14:03:04 +0000 (15:03 +0100)]
Jump the event queue

* src/olflange.h (ProgID): We are now Z.GNU.GpgOL

--
According to hearsay events are handled in reverse
alphabetical order. Let's try this to see if it results
in fewer problems with other addins.

The ProgId is not user visible anywhere.

GnuPG-Bug-Id: T3769

13 months agoFix unencrypted forward of crypto mail
Andre Heinecke [Thu, 15 Mar 2018 08:27:24 +0000 (09:27 +0100)]
Fix unencrypted forward of crypto mail

* src/mail.cpp (Mail::Mail): Add new marker for forwarded
crypto mails.
(Mail::remove_our_attachments): New. Removes gpgol attachments.
(Mail::set_is_forwarded_crypto_mail, Mail::is_forwarded_crypto_mail):
New accessors to marker.
* src/mailitem-events.cpp (EVENT_SINK_INVOKE): Set marker on
forward. Handle marker on write.

--
GnuPG-Bug-Id: T3836

13 months agoAvoid double gpgme_data_identify
Andre Heinecke [Thu, 15 Mar 2018 07:26:46 +0000 (08:26 +0100)]
Avoid double gpgme_data_identify

* src/parsecontroller.cpp (ParseController::parse): Store first
identify value and reuse it.

13 months agoDisable async crypto for now
Andre Heinecke [Wed, 14 Mar 2018 14:24:45 +0000 (15:24 +0100)]
Disable async crypto for now

* src/mail.cpp (Mail::is_inline_response): Treat every mail
as inline response exept when DO_ASYNC_CRYPTO is defined.

--
So sad :'-(
I really hope I find a way in the future to make it work.

GnuPG-Bug-Id: T3838

13 months agoRemove error handling for failure to resolve
Andre Heinecke [Wed, 14 Mar 2018 13:11:18 +0000 (14:11 +0100)]
Remove error handling for failure to resolve

* src/cryptcontroller.cpp (CryptController::do_crypto):
Remove an error handling.

--
This should never happen except when a bug occurs. And
handling it here would result in the overlay not beeing
properly destroyed.

13 months agoAdd small safety check in ribbon callback
Andre Heinecke [Wed, 14 Mar 2018 13:09:34 +0000 (14:09 +0100)]
Add small safety check in ribbon callback

* src/ribbon-callbacks.cpp (get_is_details_enabled): Add
safety check.

--
I doubt that it is necessary but I've seen logs where this
function is the last before a crash. So just be sure.

13 months agoFurther extend debugging around mail dtor
Andre Heinecke [Wed, 14 Mar 2018 10:16:03 +0000 (11:16 +0100)]
Further extend debugging around mail dtor

* src/mail.cpp (do_crypt): Note when ui thread is done.
* src/mailitem-events.cpp (EVENT_SINK_INVOKE): Log when deletion
is done in unload.
* src/windowmessages.cpp (gpgol_window_proc): Log when crypto
done handler is complete.
(do_async): Log invocation.

13 months agoImplement forwarding crypto mails with attachments
Andre Heinecke [Tue, 13 Mar 2018 15:41:45 +0000 (16:41 +0100)]
Implement forwarding crypto mails with attachments

* src/application-events.cpp (EVENT_SINK_INVOKE): Invalidate last
mail in the next UI Loop.
* src/mail.cpp (Mail::update_body): Safety check for parser. Keep
parser around.
(Mail::invalidate_last_mail): New. Clear cached last mail ptr.
* src/mail.h: Update accordingly.
* src/mailitem-events.cpp (EVENT_SINK_INVOKE): Extend write
event to detect forward of mails with attachments.
* src/oomhelp.cpp (get_inline_body): New.
* src/oomhelp.h: Update accordingly.
* src/windowmessages.cpp, src/windowmessages.h
(INVALIDATE_LAST_MAIL, REVERT_MAIL): New messages.
* src/wks-helper.cpp (WKSHelper::send_mail): Check if last
mail was invalidated.

--
This is a first working draft of forwarding crypto mails
with attachments. As we don't see the forward event before
we get the write event (that we have to cancel usually) we
now have some extra magic to detect the forward based on
an ItemLoad of an empty mail in the same UI loop as the
write event. This is pretty magic but it works.

Once we detect the forward we save the mail and then immediately
revert it and save it again. This has the usual uglyness of
reverting (sync) but works and allows to forward mails.

GnuPG-Bug-Id: T3836

13 months agoImprove error handling on enc/sign errors
Andre Heinecke [Tue, 13 Mar 2018 15:38:54 +0000 (16:38 +0100)]
Improve error handling on enc/sign errors

* src/cryptcontroller.cpp (CryptController::do_crypto):
Improve error handling.
* src/mail.cpp (do_crypt): Use correct window and hide overlay /
destroy crypter before showing the error. Add better text for
general "Crypto failed" error.

13 months agoTurn up debugging at the end of crypto
Andre Heinecke [Mon, 12 Mar 2018 14:02:25 +0000 (15:02 +0100)]
Turn up debugging at the end of crypto

* src/mail.cpp (Mail::~Mail): Very verbose logging in oom_extra.
(Mail::~Mail): Use release_cArray. Explicitly null shared ptrs.
(do_crypt): Log when done.
(Mail::update_oom_data): Use release_cArray.

--
GnuPG-Bug-Id: T3617

13 months agoUpdate portuguese translation
Andre Heinecke [Mon, 12 Mar 2018 14:01:07 +0000 (15:01 +0100)]
Update portuguese translation

* po/pt.po: Update.

--
Translation provided by Marco A.G. Pinto. Thanks.

13 months agoBump Version to 2.1.0 and update NEWS
Andre Heinecke [Wed, 7 Mar 2018 12:36:07 +0000 (13:36 +0100)]
Bump Version to 2.1.0 and update NEWS

--

13 months agoFix protocol selection for autoresolve
Andre Heinecke [Wed, 7 Mar 2018 12:33:01 +0000 (13:33 +0100)]
Fix protocol selection for autoresolve

* src/cryptcontroller.cpp (CryptController::resolve_keys_cached):
Handle Protocol.