gpgol.git
6 days agoHandle multipe valid secret keys better master
Andre Heinecke [Mon, 20 May 2019 11:48:50 +0000 (13:48 +0200)]
Handle multipe valid secret keys better

* src/keycache.cpp (compareSkeys): New.
(setPgpKeySecret, setSmimeKeySecret): Use it.

--
This checks for the capabilities of keys and then
orders them to resolve multiple valid signing keys automatically.

Fixes internal encryption with a specific cert only for
sign and one for encrypt.

6 days agoChange S/MIME Message Class handling
Andre Heinecke [Mon, 20 May 2019 11:44:06 +0000 (13:44 +0200)]
Change S/MIME Message Class handling

* src/olflange.cpp (install_forms): Register new icons
* src/mimemaker.cpp (finalize_message): Use SMIME for encryption.
* src/revert.cpp (gpgol_mailitem_revert): Use standard classes.
* src/mapihelp.cpp (change_message_class_ipm_note_smime)
(change_message_class_ipm_note_secure_cex)
(string_to_type)
(mapi_change_message_class): Split up MultipartSigned and
SM.MultipartSigned

--
This allows us to use better icons which should lead to
less confusion.

Interoperability issues are also addressed by changing
the message class to a value more standard.

GnuPG-Bug-Id: T4278

6 days agoUse similar S/MIME icons as Outlook
Andre Heinecke [Mon, 20 May 2019 11:39:07 +0000 (13:39 +0200)]
Use similar S/MIME icons as Outlook

* forms/Makefile.am: Add new files.
* encr-s-smime.ico, encr-s-yellow.xcf, ribbon-red.xcf,
sign-s-smime.ico, gpgol-form-signed-smime.cfg,
gpgol-form-signed-smime-opaque.cfg, gpgol-form-encrypted-smime.cfg:
New.

--
This introduces the Message Class
"IPM.Note.GpgOL.SM.MultipartSigned" to display a similar ribbon
as Outlook does and for better distinction internally.

6 days agoFix dangerous memdbg pattern
Andre Heinecke [Mon, 20 May 2019 08:43:43 +0000 (10:43 +0200)]
Fix dangerous memdbg pattern

* src/mapihelp.cpp (is_really_cms_encrypted)
(get_first_attach_mime_tag, mapi_create_attach_table)
(mapi_get_attach, mapi_mark_moss_attach): Use memdbg_addref after
error checking.

--
This might fix a crash when memdbg was enabled and
errors occoured.

2 weeks agoUpdate german translation
Andre Heinecke [Wed, 8 May 2019 06:24:25 +0000 (08:24 +0200)]
Update german translation

* po/de.po: Translate new strings

2 weeks agoAuto update po files
Andre Heinecke [Wed, 8 May 2019 05:59:16 +0000 (07:59 +0200)]
Auto update po files

* po/*: Update

2 weeks agoOnly autosecure when seckey found for CMS
Andre Heinecke [Mon, 6 May 2019 12:57:16 +0000 (14:57 +0200)]
Only autosecure when seckey found for CMS

* src/keycache.cpp (isMailResolvable): If the prefer smime
option is selected only autosecure if there is a secret CMS cert.

--
When OpenPGP keys could be found for all recipients
it would toggle autosecure even if S/MIME was preferred.
As we don't have a good way to automatically handle
SMIME key generation we should not automatically toggle
encryption for that case.

GnuPG-Bug-Id: T4483

2 weeks agoFix T3656 workaround activation
Andre Heinecke [Mon, 6 May 2019 12:16:26 +0000 (14:16 +0200)]
Fix T3656 workaround activation

* src/mailitem-events.cpp (Send): Do not activate T3656 workaround
for non-info path form msg class.

--
As we set it now it becomes also our class.

2 weeks agoFix locale of opened dialogs
Andre Heinecke [Mon, 6 May 2019 12:15:11 +0000 (14:15 +0200)]
Fix locale of opened dialogs

* src/w32-gettext.cpp (_nl_locale_name): Check UI language only
once.

--
In some callbacks e.g. if you click the open options button we
can get an error trying to access the LanguageSettings object
so it is better just to cache it. Outlook requires a restart
for language changes to take effect anyway.

2 weeks agoFix some draft encrypt sending issues
Andre Heinecke [Mon, 6 May 2019 12:14:12 +0000 (14:14 +0200)]
Fix some draft encrypt sending issues

* src/mailitem-events.cpp (Send): Ensure draft mark is removed.
(Write): Only start draft encrypt on No crypt mails.
(AfterWrite): Release current item on error.

2 weeks agoAdd S/MIME Addressbook integration
Andre Heinecke [Mon, 6 May 2019 10:20:34 +0000 (12:20 +0200)]
Add S/MIME Addressbook integration

* src/addressbook.cpp (parse_output): New. Move the more
complex output parsing out.
(open_keyadder): Add --cms option. Send CMS certificates, too.
(Addressbook::update_key_o): Fix mem leak of user_props on error.
Add handling for CMS / SMIME.
(Addressbook::edit_key_o): Add handling for CMS.
(Addressbook::check_o): Add handling for CMS.
* src/addressbook.h (callback_args_t): Extend for cms.
* src/cryptcontroller.cpp (CryptController::resolve_keys): Add
overrides and args for SMIME.
* src/keycache.cpp (filter_chain): New. Helper to filter non leaf
certificates.
(do_update, getOverrides, onAddrBookImportJobDone, importFromAddrBook):
Handle S/MIME.
* src/keycache.h: Update accordingly.

--
It is now possible to set both S/MIME and OpenPGP Overrides.
This code handles it. It requires an updates keyadder and
keyresolver from Gpg4win-tools together with the latest
libkleo.

GnuPG-Bug-Id: T4479

2 weeks agoChange addr book ribbon icon to "settings"
Andre Heinecke [Mon, 6 May 2019 10:16:58 +0000 (12:16 +0200)]
Change addr book ribbon icon to "settings"

* src/gpgoladdin.cpp (GetCustomUI): Fix strings for
the new "settings" functionality.

2 weeks agoAdd note about IPM.Note.SMIME in mimemaker
Andre Heinecke [Mon, 6 May 2019 10:14:55 +0000 (12:14 +0200)]
Add note about IPM.Note.SMIME in mimemaker

* src/mimemaker.cpp (finalize_message): Add a note.

2 weeks agoAdd new strings for config and keyadder
Andre Heinecke [Mon, 6 May 2019 10:14:20 +0000 (12:14 +0200)]
Add new strings for config and keyadder

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

3 weeks agoEnsure proto is always set for draft encryption
Andre Heinecke [Thu, 2 May 2019 15:37:37 +0000 (17:37 +0200)]
Ensure proto is always set for draft encryption

* src/cryptcontroller.cpp (CryptController::resolve_keys): Handle
protocol of draft encryption key.

3 weeks agoDo not start draft encryption while sending
Andre Heinecke [Thu, 2 May 2019 15:36:43 +0000 (17:36 +0200)]
Do not start draft encryption while sending

* src/mailitem-events.cpp (Write): Do not
start draft encryption if encryption is already in
progress.

--

3 weeks agoUse IPM.Note.SMIME.MultipartSigned again
Andre Heinecke [Thu, 2 May 2019 15:24:38 +0000 (17:24 +0200)]
Use IPM.Note.SMIME.MultipartSigned again

* src/mimemaker.cpp (finalize_message): Use standard form
for S/MIME.

--
When sending on the same exchange server the mapi properties
and so our message class is kept when sending. So
another (faulty) client without GpgOL might receive this message
with the InfoPathForm MessageClass and might not
handle it as an S/MIME mail.

According to MS-OXOSMIME IPM.Note.SMIME should also be possible
for encrypted mails.
For now we use MultipartSigned again.

3 weeks agoBump GPGME dependency to 1.13.0
Andre Heinecke [Thu, 2 May 2019 12:03:57 +0000 (14:03 +0200)]
Bump GPGME dependency to 1.13.0

* configure.ac: Bump GPGME dependency.

--
This was de facto already the case.

3 weeks agoAdd strings for S/MIME addr book config
Andre Heinecke [Thu, 2 May 2019 12:03:15 +0000 (14:03 +0200)]
Add strings for S/MIME addr book config

* src/addin-options.cpp: Add new strings for the keyadder dialog.

3 weeks agoBump c++ std to 14
Andre Heinecke [Thu, 2 May 2019 12:00:04 +0000 (14:00 +0200)]
Bump c++ std to 14

* src/Makefile.am: Use -stdc++14

--
Some useful new features and it should
not hurt.

6 weeks agoAdd new strings for the config dialog
Andre Heinecke [Fri, 12 Apr 2019 10:10:51 +0000 (12:10 +0200)]
Add new strings for the config dialog

* src/addin-options.cpp (i18n_noops): Add new string.
* po/*: update.

6 weeks agoPrefer Outlook language over environment
Andre Heinecke [Fri, 12 Apr 2019 10:10:01 +0000 (12:10 +0200)]
Prefer Outlook language over environment

* src/w32-gettext.cpp (_nl_locale_name): Give highest
preference to the Outlook language.

--
I think this is what users most expect.

6 weeks agoFix typo in decrypt permanently action
Andre Heinecke [Fri, 12 Apr 2019 10:08:30 +0000 (12:08 +0200)]
Fix typo in decrypt permanently action

--

6 weeks agoMake default folder selection account sensitive
Andre Heinecke [Fri, 12 Apr 2019 09:15:32 +0000 (11:15 +0200)]
Make default folder selection account sensitive

* src/oomhelp.cpp (is_mail_in_folder): Use the parent folder
store to check for the default folder.

--
This fixes the case that only for one account junk and draft
encryption works.

6 weeks agoDecrypt again after a draft was closed
Andre Heinecke [Fri, 12 Apr 2019 09:13:00 +0000 (11:13 +0200)]
Decrypt again after a draft was closed

* src/mail.cpp (m_decrypt_again, isDecryptAgain, setDecryptAgain):
New state variable.
* src/mail.h: Update accordingly.
* src/mailitem-events.cpp (BeforeRead): Schedule
decrypt if a closed mail was before read again.
(Close): Mark closed drafts for potential decrypt again.
* src/windowmessage.cpp, src/windowmessages.h (DECRYPT): New.

--
This allows us to detach an inline editor draft, edit it,
close it and continue editing in the inline editor.

6 weeks agoDon't complain about empty drafts
Andre Heinecke [Fri, 12 Apr 2019 09:11:39 +0000 (11:11 +0200)]
Don't complain about empty drafts

* src/cryptcontroller.cpp (CryptController::collect_data):
Don't complain for drafts.

--
This is a usual case because autosave can hit if you
only entered recipients and the subject.

6 weeks agoDon't take base message for drafts
Andre Heinecke [Fri, 12 Apr 2019 09:10:05 +0000 (11:10 +0200)]
Don't take base message for drafts

* src/cryptcontroller.cpp (CryptController::collect_data): Use
message instead of base message.

--
The base message might have the wrong attachments as this
is a decrypted mail where the MAPI message mirrors the OOM
and the Base Message mirrors what is on the server.

6 weeks agoAdd safety check for reordered attachments
Andre Heinecke [Fri, 12 Apr 2019 07:46:27 +0000 (09:46 +0200)]
Add safety check for reordered attachments

* src/mapihelp.cpp (mapi_mark_or_create_moss_attach): When
there are two MOSS attachments check for content_type.

--
Sometimes the attachments are not in the order we expect.
This happened somehow if a draft encrypted by us was opened in
the Web interface.

6 weeks agoImprove propchange debug output
Andre Heinecke [Fri, 12 Apr 2019 07:45:39 +0000 (09:45 +0200)]
Improve propchange debug output

* src/mailitem-events.cpp (PropertyChange): Log the mail pointer
not the message pointer.

6 weeks agoFactor out activeInlineResponse in own function
Andre Heinecke [Fri, 12 Apr 2019 07:43:55 +0000 (09:43 +0200)]
Factor out activeInlineResponse in own function

* src/mail.cpp (Mail::isActiveInlineResponse_o): New. checks
if a mail is the inline response.
(Mail::checkSyncCrypto_o): New. Explicitly checks if sync
crypto is needed.
* src/mail.h: Update accordingly.

6 weeks agoExplicitly note when close is passed for drafs
Andre Heinecke [Thu, 11 Apr 2019 12:45:14 +0000 (14:45 +0200)]
Explicitly note when close is passed for drafs

* src/mailitem-events.cpp (Close): Debug when close
is passed because of draft status.

--
This allows to determine if a question was intentional or
accidental.

6 weeks agoPass crypto mails through write depending on state
Andre Heinecke [Thu, 11 Apr 2019 12:44:06 +0000 (14:44 +0200)]
Pass crypto mails through write depending on state

* src/mailitem-events.cpp (Write): Pass encrypted mails
when the state is Mail::WantsSendMIME.

6 weeks agoAllow sending of decrypted crypto mails
Andre Heinecke [Thu, 11 Apr 2019 12:43:00 +0000 (14:43 +0200)]
Allow sending of decrypted crypto mails

* src/mailitem-events.cpp (Send): Decrypt mails before
sending if no crypto was requested.

--
This allows to store a draft encrypted but later send it
without encryption.

6 weeks agoFix detection of async / sync encryption
Andre Heinecke [Thu, 11 Apr 2019 12:41:47 +0000 (14:41 +0200)]
Fix detection of async / sync encryption

* src/mail.cpp (Mail::prepareEncrypt_o): Move check_inline_response
to the top as this determines the async / sync state.

6 weeks agoAdd for_encryption parameter to updateOOMData
Andre Heinecke [Thu, 11 Apr 2019 12:39:37 +0000 (14:39 +0200)]
Add for_encryption parameter to updateOOMData

* src/mail.cpp (Mail::updateOOMData_o): Add for_encryption parameter.
(Mail::prepareEncrypt_o): Use it.

--
Now that we need to send encrypted drafts we can no longer
rely on isCryptoMail to determine if we are reading or writing
a mail.

6 weeks agoDo not store modified drafts if decrypt failed
Andre Heinecke [Thu, 11 Apr 2019 12:36:12 +0000 (14:36 +0200)]
Do not store modified drafts if decrypt failed

* src/mailitem-events.cpp (BeforeAutoSave, Write): Do
not allow writes if decryption failed.
* src/mail.cpp (decryptedSuccessfully): New helper.

--
Otherwise we would re-encrypt our error message ;-)

6 weeks agoAllow property changes for encrypted drafts
Andre Heinecke [Thu, 11 Apr 2019 12:35:04 +0000 (14:35 +0200)]
Allow property changes for encrypted drafts

* src/mailitem-events.cpp (PropertyChange): Pass changes
for drafts.

--
Drafts can be edited even though they are encrypted.

6 weeks agoInitial handling for edits on encrypted drafts
Andre Heinecke [Wed, 10 Apr 2019 13:44:46 +0000 (15:44 +0200)]
Initial handling for edits on encrypted drafts

* src/mail.cpp (Mail::updateOOMData_o): Cache body for
drafts, too.
* src/mailitem-events.cpp (Write): Encrypt drafts again on write.
(Close): Let Outlook ask for "want to save changes" for drafts.

--
This is still extremly buggy. Somehow after the write
in which we prepare the encrypt MAPI is not updated.
So we have to take our information from OOM. That's never
good.

6 weeks agoFix deadlock on synchronous encrypt
Andre Heinecke [Wed, 10 Apr 2019 13:43:40 +0000 (15:43 +0200)]
Fix deadlock on synchronous encrypt

* src/mail.cpp (do_crypt): Release lock in case sync
encrypt for drafts finished.

6 weeks agoEnsure draft encrypt state is reset on error
Andre Heinecke [Wed, 10 Apr 2019 13:42:54 +0000 (15:42 +0200)]
Ensure draft encrypt state is reset on error

* src/mail.cpp (do_crypt): On error remove draft encrypt
marker.

6 weeks agoAdd helper function "is_draft_mail"
Andre Heinecke [Wed, 10 Apr 2019 12:42:21 +0000 (14:42 +0200)]
Add helper function "is_draft_mail"

* src/oomhelp.cpp (is_draft_mail): New.
(is_mail_in_folder): New. factored out from is_junk_mail.

6 weeks agopo: Fix a mislabling in german l10n
Andre Heinecke [Wed, 10 Apr 2019 12:35:51 +0000 (14:35 +0200)]
po: Fix a mislabling in german l10n

--

6 weeks agoDo not reset draft info for drafts
Andre Heinecke [Wed, 10 Apr 2019 10:41:26 +0000 (12:41 +0200)]
Do not reset draft info for drafts

* src/cryptcontroller.cpp (CryptController::update_mail_mapi):
Pass isDraftEncrypt to finalize message.
* src/mimemaker.cpp (finalize_message): Do not remove draft info
for drafts.

--
This commit is a bit confusing because we use "draft info" as
our tracking property for the encrypt/sign actions. Now that
we also work with real drafts this is a bit confusing.

6 weeks agominor: Add a missing return to improve dbg output
Andre Heinecke [Wed, 10 Apr 2019 07:40:55 +0000 (09:40 +0200)]
minor: Add a missing return to improve dbg output

--

6 weeks agoAdd SentOnBehalfOfName to ignored prop changes
Andre Heinecke [Wed, 10 Apr 2019 07:39:59 +0000 (09:39 +0200)]
Add SentOnBehalfOfName to ignored prop changes

* src/mailitem-events.cpp (prop_blacklist): Add SentOnBehalfOfName.

--
This can change for drafts when they are decrypted.

6 weeks agoAdd initial draft encryption support
Andre Heinecke [Wed, 10 Apr 2019 07:30:24 +0000 (09:30 +0200)]
Add initial draft encryption support

* src/common_indep.h (opt): Add option draft_key.
* src/cryptcontroller.cpp (CryptController::resolve_keys): Handle
draft and resolve to draft key.
(CryptController::do_crypto): Don't sign draft encrypts.
* src/mail.cpp (Mail::Mail): New state variable for drafts.
(do_crypt): Handle draft encryption.
(Mail::encryptSignStart_o): Disable inline pgp for drafts.
(Mail::updateCryptOOM_o): Don't wipe but trick Outlook when
encrypting drafts.
(Mail::prepareCrypto_o): New. Factored out from send event.
* src/mail.h: Update accordingly.
* src/mailitem-events.cpp (BeforeAutoSave): New. Start
encryption.
(Write, AfterWrite): Add handling for drafts.
* src/main.c (read_options): Read draftKey and draftEnc.
* src/windowmessages.cpp (CRYPTO_DONE): Handle drafts.

--
This uses some tricks to add draft encryption in a
way that the user does not notice. E.g. when an
autosave happens.

It's still a bit fragile and needs more work but the
basics work for explict draft save and autosave.

GnuPG-Bug-Id: T4388

6 weeks agoSilence a too verbose trace
Andre Heinecke [Wed, 10 Apr 2019 06:40:50 +0000 (08:40 +0200)]
Silence a too verbose trace

* src/cryptcontroller.cpp (sink_data_write): Do not trace each call.

6 weeks agoPrint maip error on OpenProperty error
Andre Heinecke [Tue, 9 Apr 2019 12:42:20 +0000 (14:42 +0200)]
Print maip error on OpenProperty error

* src/oomhelp.cpp (gpgol_openProperty): Print out mapi error.

--
This saves time looking up the error codes manually.

6 weeks agoAdd MAPI error codes and helpers
Andre Heinecke [Mon, 8 Apr 2019 09:43:12 +0000 (11:43 +0200)]
Add MAPI error codes and helpers

* src/mapierr.cpp, src/mapierr.h: New.
* src/mymapi.h: Include it.
* src/Makefile.am: Add it to sources.

8 weeks agoFix crash when looking at messages without attachs
Andre Heinecke [Wed, 27 Mar 2019 11:53:10 +0000 (12:53 +0100)]
Fix crash when looking at messages without attachs

* src/mapihelp.cpp (mapi_get_first_attach_data): Do not crash
if message has no attachments.

8 weeks agoFix content-type detection for headerless mails
Andre Heinecke [Wed, 27 Mar 2019 09:53:42 +0000 (10:53 +0100)]
Fix content-type detection for headerless mails

* src/mapihelp.cpp (mapi_get_message_content_type):
Check first attachment if mail has no headers.

--
Yep that happens. I could reproduce it by looking at
sent mails in a local data file. This is very likely
the cause for:

GnuPG-Bug-Id: T3935

2 months agoReplace fancy attribute by comment
Andre Heinecke [Tue, 26 Mar 2019 18:46:57 +0000 (19:46 +0100)]
Replace fancy attribute by comment

* src/mailitem-events.cpp: Change attribute fallthrough to magic
comment.

--
This fixed build with older gcc versions....

2 months agoPost release version bump
Andre Heinecke [Tue, 26 Mar 2019 13:00:53 +0000 (14:00 +0100)]
Post release version bump

--

2 months agoFix distcheck gpgol-2.3.3
Andre Heinecke [Tue, 26 Mar 2019 12:56:58 +0000 (13:56 +0100)]
Fix distcheck

* tests/Makefile.am: Check for TESTS should have been inverted.

2 months agoAuto update po files
Andre Heinecke [Tue, 26 Mar 2019 12:13:57 +0000 (13:13 +0100)]
Auto update po files

--

2 months agoUpdate NEWS for todays release
Andre Heinecke [Tue, 26 Mar 2019 12:12:31 +0000 (13:12 +0100)]
Update NEWS for todays release

--

2 months agoFix / improve decrypting sent exchange mails again
Andre Heinecke [Tue, 26 Mar 2019 08:48:23 +0000 (09:48 +0100)]
Fix / improve decrypting sent exchange mails again

* src/mail.cpp (Mail::preProcessMessage_m): Also pass the
parsed_message.
* src/mapihelp.cpp (hide_attachment_mapipos): New helper.
(mapi_mark_or_create_moss_attach): Take parsed msg as
additional parameter. Improve MOSSTMPL handling.

--
If we have a mosstempl. This means that we created
this message. Sometimes we get the situation in
sent mails that we have a mosstempl but the
pgp version header and octet streams also
attached in the parsed_message. We can't
trigger a reread from the base message so
in that case we want to hide everything
as we rebuild the message from our MOSS.

We don't delete here to avoid bugs where data loss
might occur.

GnuPG-Bug-Id: T4241

2 months agoEnsure that decrypt again uses preprocessing
Andre Heinecke [Tue, 26 Mar 2019 08:18:23 +0000 (09:18 +0100)]
Ensure that decrypt again uses preprocessing

* src/windowmessages.cpp (EXT_API_DECRYPT): call
pre process message.

--
This ensures that our usual preprocessing is done
when decrypting again.

GnuPG-Bug-Id: T4241

2 months agoUpdate pt translations
Andre Heinecke [Tue, 26 Mar 2019 06:58:27 +0000 (07:58 +0100)]
Update pt translations

* po/pt.po: Update.

--
As usual, thanks to Marco.

2 months agoFix a message box encoding error
Andre Heinecke [Mon, 25 Mar 2019 13:34:56 +0000 (14:34 +0100)]
Fix a message box encoding error

* src/cryptcontroller.cpp (CryptController::parse_output): Use
UTF-8 gettext.

2 months agoMinor string improvement
Andre Heinecke [Mon, 25 Mar 2019 08:52:13 +0000 (09:52 +0100)]
Minor string improvement

--

2 months agoAuto update po files
Andre Heinecke [Mon, 25 Mar 2019 08:22:52 +0000 (09:22 +0100)]
Auto update po files

* po/*: Update

2 months agoPrint warning when unsupported attachs are found
Andre Heinecke [Mon, 25 Mar 2019 08:20:06 +0000 (09:20 +0100)]
Print warning when unsupported attachs are found

* po/POTFILES.in: Add mimemaker.
* src/mimemaker.cpp (count_usable_attachments): Also count
OLE and embedded.
(write_attachments): Print warning in case such an attach
was found.
(add_body_and_attachments): Forward error.

--
This should only show when we previously would have
ignored an attachment. Siliently ignoring attachments
like appointments can lead to ugly communication.

GnuPG-Bug-Id: T4184

2 months agoTake attachment display name if filename null
Andre Heinecke [Mon, 25 Mar 2019 08:05:34 +0000 (09:05 +0100)]
Take attachment display name if filename null

* src/mapihelp.cpp (get_attach_filename): Check DISPLAY_NAME
as a fallback.

2 months agoAdd filenames for our mime parts
Andre Heinecke [Tue, 19 Mar 2019 08:51:13 +0000 (09:51 +0100)]
Add filenames for our mime parts

* src/cryptcontroller.cpp (create_sign_attach): Add file name
for signatures.
* src/mimemaker.cpp (create_top_encryption_header): Add file name
for OpenPGP encrypted.
* src/mimemaker.h: Add defines for filenames.

--
This makes it look nicer if a client does not support PGP/MIME
and you can even open the message with Kleopatra.

GnuPG-Bug-Id: T4258

2 months agoLog if DBG_TRACE is set
Andre Heinecke [Mon, 18 Mar 2019 16:17:38 +0000 (17:17 +0100)]
Log if DBG_TRACE is set

* src/main.c (read_options): Log if DBG_TRACE is set.

--
Should be pretty obvious from the log afterwards but this
is cleaner and less irritating.

2 months agoMAPI look into tnef attachments to detect protocol
Andre Heinecke [Mon, 18 Mar 2019 13:37:00 +0000 (14:37 +0100)]
MAPI look into tnef attachments to detect protocol

* src/mapihelp.cpp (mapi_get_first_attach_data): New.
(change_message_class_ipm_note_smime): Remove ms-tnef handling.
Add multipart/signed protocol support for smime.
Warn if encrypted fallback is used.
(change_message_class_ipm_note_smime_multipartsigned): Remove
ms-tnef handling.
(parse_header_data): New helper factored out form
(mapi_get_message_content_type): Handle ms-tnef wrapping.

--
If we have a mail with content-type ms-tnef we now
look into the tnef attachment to parse the protocol
for multipart/signed.

While Outlook makes the original content type available
through API (get_first_attach_mime_tag) it does not
provide the protocol.

As we need this information early on for display purposes
we now look into the attachment.

GnuPG-Bug-Id: T4403
GnuPG-Bug-Id: T4267

2 months agoAdd the generic MSGTYPE_SMIME in isSMIME_m
Andre Heinecke [Mon, 18 Mar 2019 13:33:57 +0000 (14:33 +0100)]
Add the generic MSGTYPE_SMIME in isSMIME_m

* src/mail.cpp (Mail::isSMIME_m): Add MSGTYPE_SMIME.

--
Might be a cause for
GnuPG-Bug-Id: T4403

but the real issue there are tnef attachments.

2 months agoFix a false positive memdbg warning
Andre Heinecke [Mon, 18 Mar 2019 13:32:46 +0000 (14:32 +0100)]
Fix a false positive memdbg warning

* src/mapihelp.cpp (get_first_attach_mime_tag): Note the
ref on mapitable.

2 months agoDo not allow decrypt permanently in case of errors
Andre Heinecke [Mon, 18 Mar 2019 11:51:39 +0000 (12:51 +0100)]
Do not allow decrypt permanently in case of errors

* src/mail.cpp (Mail::decryptPermanently_o): Do not
allow this in case an error occured.

--
Otherwise we save the error string!

2 months agoGet / Show Diagnostic audit log after crypt failed
Andre Heinecke [Mon, 18 Mar 2019 11:49:07 +0000 (12:49 +0100)]
Get / Show Diagnostic audit log after crypt failed

* src/cryptcontroller.cpp (CryptController::do_crypto):
Return audit log if available.
* src/cryptcontroller.h: Update accordingly.
* src/mail.cpp (do_crypt): Check for audit log and show
if available.

--
This might help to avoid "General Error" cases.

2 months agoUse localized seperator for categories
Andre Heinecke [Mon, 18 Mar 2019 11:13:20 +0000 (12:13 +0100)]
Use localized seperator for categories

* src/categorymanager.cpp (CategoryManager::getSeperator): New.
* src/oomhelp.cpp (remove_category, add_category): Use it.

--
Outlook actually localizes the seperator. So if you run
two Outlooks on the same account with different locale
settings you are out of luck,.. weird.

2 months agoExpose readRegStr in common.h
Andre Heinecke [Mon, 18 Mar 2019 11:11:09 +0000 (12:11 +0100)]
Expose readRegStr in common.h

* src/common.h (readRegStr): Add prototype.

--
This is a useful function.

2 months agoSplit enable / disable window into two functions
Andre Heinecke [Thu, 14 Mar 2019 08:11:18 +0000 (09:11 +0100)]
Split enable / disable window into two functions

* src/mail.cpp (Mail::enableWindow, Mail::disableWindow_o): New.
* src/mail.h: Update accordingly.

--
This avoids giving me a heart attack when I se an _o function
called from a different thread.

2 months agoReduce spammy trace output
Andre Heinecke [Wed, 27 Feb 2019 10:12:37 +0000 (11:12 +0100)]
Reduce spammy trace output

* src/mapihelp.cpp (parse_headers_cb): Don't trace.

2 months agoFix decrypt permanently category removal
Andre Heinecke [Wed, 27 Feb 2019 10:11:38 +0000 (11:11 +0100)]
Fix decrypt permanently category removal

* src/mail.cpp (Mail::decryptPermanently_o): Remove
categories before removing the crypto state.

--
Otherwise removeCategories_o thinks that there are no
categories set for us.

2 months agoAdd debug output to show if S/MIME was detected
Andre Heinecke [Wed, 27 Feb 2019 10:11:06 +0000 (11:11 +0100)]
Add debug output to show if S/MIME was detected

* src/mail.cpp (Mail::isSMIME_m): Print detected state.

2 months agoAdd code to print out keycache inserts
Andre Heinecke [Wed, 27 Feb 2019 10:10:18 +0000 (11:10 +0100)]
Add code to print out keycache inserts

* src/keycache.cpp: Add default off code to print keycache inserts.

3 months agoAdd decrypt permanently feature
Andre Heinecke [Fri, 22 Feb 2019 05:47:18 +0000 (06:47 +0100)]
Add decrypt permanently feature

* src/gpgoladdin.cpp (GpgolRibbonExtender::GetIDsOfNames),
(GpgolRibbonExtender::Invoke),
(GetCustomUI_MIME): Add decrypt permanently.
* src/mail.cpp (Mail::decryptPermanently_o): New.
* src/ribbon-callbacks.cpp (decrypt_permanently): Wire up.

3 months agoAdd new mapi helpers for decrypt permanently
Andre Heinecke [Fri, 22 Feb 2019 05:46:02 +0000 (06:46 +0100)]
Add new mapi helpers for decrypt permanently

* src/mapihelp.cpp (mapi_delete_gpgol_tags): New. delete
our tags.
(mapi_set_message_class): Explicitly set a message class.

3 months agoFix encoding of protected header subject
Andre Heinecke [Fri, 22 Feb 2019 05:45:13 +0000 (06:45 +0100)]
Fix encoding of protected header subject

* src/mimedataprovider.cpp (MimeDataProvider::finalize): Parse
the subject through rfc2047

3 months agoAdd minimalistic protected-headers support
Andre Heinecke [Thu, 21 Feb 2019 14:16:49 +0000 (15:16 +0100)]
Add minimalistic protected-headers support

* src/mail.cpp (Mail::parsing_done): Update subject if one
was taken from a protected header.
* src/mailitem-events.cpp (prop_blacklist): Ignore subject related
changes.
* src/mimedataprovider.cpp (t2body): Handle protected headers.
(MimeDataProvider::finalize): Convert subject to a string.
(MimeDataProvider::get_internal_subject): New.
* src/parsecontroller.cpp (ParseController::get_internal_subject):
New accessor.
* src/parsecontroller.h, src/mimedataprovider.h: Update accordingly.

--
This is still bad but a little less bad then it was before.
We still ignore to and from from the protected headers but at
least we show the subject now.1

3 months agoRead autocrypt header for autoimport
Andre Heinecke [Thu, 21 Feb 2019 12:09:50 +0000 (13:09 +0100)]
Read autocrypt header for autoimport

* src/common_indep.h (autocrypt_s): Data transfer struct.
* src/keycache.cpp (KeyCache::import_pgp_key_data): Fix and
add more debugging.
* src/mail.cpp (Mail::preProcessMessage_m): Check for autocrypt
headers even on non crypto mails.
(Mail::decryptVerify_o): Parse autocrypt header for crypto mails.
* src/mapihelp.cpp (get_message_content_type_cb): Renamed
to parse_headers_cb.
(ac_get_value): New helper.
(prepare_key_data): New helper.
(mapi_get_header_info): General function for additional header info.
* src/mapihelp.h: Update accordingly.
* src/parsecontroller.cpp (handle_autocrypt_info): New helper.
(ParseController::parse): Handle autocrypt info on demand.
* src/parsecontroller.h: Update accordingly.

--
Ideally we want to do the import in the parse step as it is
then in the background thread. But for unencrypted mails we
have to do in in the pre processing because afterwards we no
longer look at the unencrypted mail.

mapi_get_header_info is intended as a new one time parse function
to get some more info from the headers. For now it only supports
autocrypt header.

3 months agoAdd cast to MAKE_SHARED macro
Andre Heinecke [Thu, 21 Feb 2019 12:08:40 +0000 (13:08 +0100)]
Add cast to MAKE_SHARED macro

* src/oomhelp.h (MAKE_SHARED): Cast to IDispatch.

--
This allows to make shared stuff like IMessage.

3 months agoAdd whitespace removal helper to cpphelp
Andre Heinecke [Thu, 21 Feb 2019 12:07:15 +0000 (13:07 +0100)]
Add whitespace removal helper to cpphelp

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

3 months agoMinor string fix
Andre Heinecke [Thu, 21 Feb 2019 12:06:37 +0000 (13:06 +0100)]
Minor string fix

* src/addin-options.cpp: Remove period at the end of an option.

3 months agoFix crash when sending encrypted mail
Andre Heinecke [Thu, 21 Feb 2019 11:38:00 +0000 (12:38 +0100)]
Fix crash when sending encrypted mail

* src/cryptcontroller.cpp (CryptController::update_mail_mapi):
Check if att_table exists before accessing it.

--
This was a regression caused by cf221afd which never made
it into a release.

3 months agoCleanly remove gpgol_sigstatus
Andre Heinecke [Thu, 21 Feb 2019 09:18:53 +0000 (10:18 +0100)]
Cleanly remove gpgol_sigstatus

* src/mapihelp.cpp (get_gpgolsigstatus_tag),
(mapi_has_sig_status, mapi_test_sig_status, mapi_get_sig_status)
(mapi_set_sig_status): Removed.
(mapi_change_message_class): Dont mark non crypto messages.
* src/mimemaker.cpp (finalize_message restore_msg_from_moss):
Do not set sigstatus.

--
The sigstatus is not used by current code and is never
read. The save changes caused by the property required
a modification and additional sync for unencrypted messages. So
we need to remove setting it.

3 months agoHandle autoimport for attached pgp keys
Andre Heinecke [Mon, 11 Feb 2019 14:48:05 +0000 (15:48 +0100)]
Handle autoimport for attached pgp keys

* src/keycache.cpp (KeyCache::import_pgp_key_data): New.
* src/keycache.h: Update accordingly.
* src/parsecontroller.cpp (ParseController::parse): Check for
pgp-keys attachments and import them.

3 months agoImplement auto encrypt untrusted
Andre Heinecke [Mon, 11 Feb 2019 14:46:00 +0000 (15:46 +0100)]
Implement auto encrypt untrusted

* src/keycache.cpp (getEncryptionKeys): Handle new option.

--
This allows opportunistic encryption to any key in the
keyring. As this is problematic it is off by default.

3 months agoAdd / parse new automation options
Andre Heinecke [Mon, 11 Feb 2019 14:45:22 +0000 (15:45 +0100)]
Add / parse new automation options

* src/common_indep.h (opt): Add new fields.
* src/main.c (read_options): Read them.

3 months agoStore content-type for attachments
Andre Heinecke [Mon, 11 Feb 2019 14:44:15 +0000 (15:44 +0100)]
Store content-type for attachments

* src/attachment.cpp (get_content_type, set_content_type): New.
* src/mimedataprovider.cpp (create_attachment): Set it.
* src/attachment.h: Update accordingly.

3 months agoFix syntax error
Andre Heinecke [Mon, 11 Feb 2019 13:36:45 +0000 (14:36 +0100)]
Fix syntax error

* src/addin-options.cpp: Fix syntax.

3 months agoFix implicit fallthrough warnings
Andre Heinecke [Mon, 11 Feb 2019 13:35:52 +0000 (14:35 +0100)]
Fix implicit fallthrough warnings

* src/application-events.cpp: Fix unintentional fallthrough from
QUIT.
* src/mailitem-events.cpp: Mark reply fallthrough as intentional.

3 months agoUse better names for our own attachments
Andre Heinecke [Mon, 11 Feb 2019 13:26:48 +0000 (14:26 +0100)]
Use better names for our own attachments

* src/mapihelp.h (MIMEATTACHFILENAME, PGPBODYFILENAME): Use
better file names.

--
This helps users to understand / analyze issues when they
introspect or see the hidden attachments due to some bug.

3 months agoAdd strings for new config options
Andre Heinecke [Mon, 11 Feb 2019 13:26:22 +0000 (14:26 +0100)]
Add strings for new config options

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

4 months agoFix forwarding of sent mails
Andre Heinecke [Mon, 14 Jan 2019 09:15:25 +0000 (10:15 +0100)]
Fix forwarding of sent mails

* src/cryptcontroller.cpp (CryptController::update_mail_mapi):
Remove an existing MOSSTMPL if available.

--
Without this the MOSSTMPL was kept and we then had two
or more MOSSTMPLs. This resulted in undefined / buggy
behavior.

GnuPG-Bug-Id: T4321

4 months agoFix minor typo
Andre Heinecke [Mon, 14 Jan 2019 09:15:14 +0000 (10:15 +0100)]
Fix minor typo

--

4 months agoFix tooltip for bad signature
Andre Heinecke [Wed, 9 Jan 2019 09:07:26 +0000 (10:07 +0100)]
Fix tooltip for bad signature

* src/mail.cpp (Mail::getCryptoDetails_o): Handle bad signature
explicitly.

--
Otherwise the code would run into the key error checks and
would note wrongls that the UID does not match.

GnuPG-Bug-Id: T4299

4 months agopo: Auto update po files
Andre Heinecke [Mon, 7 Jan 2019 07:44:07 +0000 (08:44 +0100)]
po: Auto update po files

--