Commit Graph

224 Commits (master)

Author SHA1 Message Date
Francis Lachapelle 4c814c9b9f feat(imap): add support for UID MOVE operation 2021-09-10 14:03:45 -04:00
Francis Lachapelle 0eb64db6e1 fix(mime): encode text parts individually
Fixes #5376
2021-08-25 14:57:37 -04:00
Francis Lachapelle 6a7d407bb5 fix(imap): force envelope subject to return a string 2021-08-24 15:14:10 -04:00
Francis Lachapelle b7d49f5f24 fix(imap): parse messages quota
Fixes #5365
2021-08-04 09:58:47 -04:00
Francis Lachapelle c808b54c6f fix(imap): don't unselect mailbox if none is selected 2021-06-15 16:33:37 -04:00
Francis Lachapelle 7040f004d4 fix(imap): flatten and sort inner threads
Fixes #3100
Fixes #4796
2021-06-09 14:26:42 -04:00
Francis Lachapelle 220e6fe3b7 fix(imap): new methods to move mailbox without using NSURL 2021-05-17 17:55:49 -04:00
Francis Lachapelle 7c2c490005 fix(mime): expose content-disposition in bodyInfo 2021-05-06 14:12:59 -04:00
Francis Lachapelle 60d393d659 fix(imap): flatten and sort inner threads
Fixes #3100
Fixes #4796
2021-03-01 20:41:50 -05:00
Francis Lachapelle b0a271aea0 fix(imap): flatten and sort inner threads
Fixes #3100
Fixes #4796
2021-03-01 17:18:27 -05:00
Ludovic Marcotte ed0a078454 fix(core): consider @ as a printable character 2020-10-15 09:32:00 -04:00
Ludovic Marcotte df94cafba6 fix(core): MIME generation resulting in broken S/MIME (fixes #4634) 2020-10-13 09:59:30 -04:00
Francis Lachapelle c5c23fd757 fix(mime): parse empty address in envelope
Fixes #5173
Fixes #5174
2020-09-25 13:52:35 -04:00
Francis Lachapelle 1ac9e39e8f fix(smtp): raise exception when server returns an error 2020-09-14 14:32:01 -04:00
Francis Lachapelle 50441eb222 fix(smtp): add defaults SMTPDebugEnabled
Instead of depending on ImapDebugEnabled, NGSmtpClient and NGSendMail
will log debugging information only if SMTPDebugEnabled is set.

Fixes #5129
2020-09-14 14:23:43 -04:00
Francis Lachapelle 579f73e6de fix(imap): ignore empty envelope addresses
Fixes #5142
2020-09-09 14:59:44 -04:00
Francis Lachapelle 4527e6a5c3 fix(mime): encode , / ; / : characters in headers
Fixes #5119
2020-08-14 09:56:58 -04:00
Nicolas Höft 5a4f363628 fix(core): NGMimeType: Fix unit tests
Add missing charsets in NGMimeType that are tested in the SOGo unit tests.
2020-08-02 15:09:41 +02:00
Nicolas Höft 4f280bf238 feat(core): Allow setting TLS verify mode for IMAP, SMTP, Sieve
Given the query parameter `tlsVerifyMode` one can specify the TLS
validation mode for IMAP, SMTP, and sieve protocols when the TLS
wrapper is enabled.

Possible options are:
  * tlsVerifyMode=allowInsecureLocalhost: This will disable peer verification
    if the remote host is on the local machine (localhost and similar)
  * tlsVerifyMode=none: Disable all TLS checks. This should be used for
    debugging only

Refs #5078
2020-08-02 15:09:41 +02:00
Nicolas Höft 4fb17374da feat(core): NGActiveSSLSocket: Allow setting peer verification for STARTTLS
Add a new initializer for NGActiveSSLSocket, `initWithConnectedActiveSocket`
with the purpose to be initialized on top of a connected socket. Moving
the function of grabbing the socket fd and options from outside into the
SSL socket implementation itself.

Also by passing the socket, we dont have to pass the host name explicitly
anymore, as we can get it from the socket itself.

The verifyMode selector can enable the full TLS checks (default), disable
them for localhost addresses, or disable peer verification completely.

Refs #5078
2020-08-02 15:09:41 +02:00
Francis Lachapelle 34dc27941e fix(imap): sanitize destination mailbox name in copy operations
Fixes #5095
2020-07-30 11:28:25 -04:00
Francis Lachapelle 8b1b1a0d83 fix(sieve): improve connection error remediation 2020-07-09 15:40:39 -04:00
Extra Fu 9138e796f0
Merge pull request #56 from the-nic/bugfix/5019-tls-hostname-v2
feat(core): Support hostname validation for openssl < 1.0.2 and gnutls<3.4.6
2020-07-03 14:43:15 -04:00
Johannes Kanefendt dbe2dc04ee Fixed set of printable characters in quoted printable according to RFC2047 2020-07-02 14:23:39 +02:00
Nicolas Höft a948deb767 Revert "Merge pull request #55 from inverse-inc/revert-52-bugfix/5019-tls-hostname"
This reverts commit e249ac8d41, reversing
changes made to 03316166cb.
2020-06-17 15:02:45 +02:00
Extra Fu dbd28bdac6
Revert "feat(core): Peer verification on TLS connections" 2020-06-16 13:22:04 -04:00
Nicolas Höft bc766e2463 feat(core): NGActiveSSLSocket: Check host name for GnuTLS
Implement peer verification for TLS connections also
for GnuTLS. It will load the default system CA root store,
and also send the Server Name Indication (SNI).

Fixes #5019
2020-06-12 18:02:28 +02:00
Nicolas Höft 0370e1bba4 feat(core): NGActiveSSLSocket: Implement peer verification for OpenSSL
Load system default CA trust store and verify the hostname of the
endpoint.
Simplify the SSL setup by reducing duplicate initialization code.

Require a host name argument now to be able to compare the host names
with.

Fixes #5019
2020-06-12 18:02:28 +02:00
Nicolas Höft 40bb586cf0 feat(smtp): Support STARTTLS
Following the implementations on IMAP and Sieve, implement STARTTLS
also for SMTP: A new TLS socket is built on the already open socket
which performs all TLS related actions. The SMTP client then
only has to talk on the TLS socket.

Note that after issuing STARTTLS command, we have to re-request the
supported server capabilities (i.e. send EHLO again and parse the
server response), because the announced AUTH mechanism may change.

Fixes #31
2020-05-11 10:21:53 +02:00
Nicolas Höft ec32774cc5 feat(smtp): Support smtps
Implement support for SMTPS. Remove some unused initialization
functions and add one expecting NSURL. From this url we can extract
the scheme: smtp:// or smtps://, whereas the former is unencrypted SMTP
and the latter refers to smtp in SSL/TLS wrapper mode (usually port 465).

As with IMAPS and STARTTLS for sieve, openssl or GnuTLS need to be present
for this to work.

Fixes #31
2020-05-11 10:21:53 +02:00
Francis Lachapelle c9712eb71a fix(sieve): parse code from Sieve response 2019-12-17 15:06:30 -05:00
Ludovic Marcotte 2e63326871 chore(core): use a bool instead of stupid string 2019-11-07 13:28:40 -05:00
Ludovic Marcotte dd8c873b0d (fix) ensure the From header is always the first one 2019-10-30 13:35:16 -04:00
Ludovic Marcotte f567f984bf (fix) don't trim illegal characters (fixes #4806) 2019-09-13 10:42:13 -04:00
Ludovic Marcotte 4c02b000d1 (fix) cleaned the IMAP separator mess 2019-09-04 13:42:10 -04:00
Ludovic Marcotte bf0441560d (fix) improve logging 2019-05-23 10:56:25 -04:00
Ludovic Marcotte 2ca5842d86 (fix) safety check to avoid exception 2019-02-14 14:15:22 -05:00
Francis Lachapelle 0f5d66fabe Fix parsing of quota root in IMAP server response
Fixes #4382
2018-02-06 15:31:45 -05:00
Ludovic Marcotte edc566a2d9 (fix) also set the bodyId in fake bodyInfo 2018-01-23 10:32:28 -05:00
Ludovic Marcotte 6d0a70d698 (fix) added missing commits for S/MIME support 2018-01-12 15:38:12 -05:00
Francis Lachapelle 9d336b288e Merge pull request #45 from imz/correct-mUTF7
correct mUTF7: 64th digit of the base is "," (RFC3501)
2017-10-10 08:34:01 -04:00
Ivan Zakharyaschev 45db3976d3 _{encodeTo,decodeOf}ModifiedUTF7(): 64th digit of the base is "," (RFC3501)
According to https://tools.ietf.org/html/rfc3501#section-5.1.3 ,
in comparison to Base64 encoding, "," should be used instead of "/"
as the greatest digit of the base.

Of course, this meant that the encodings used by an IMAP server (e.g.,
dovecot) and SOGo did not match when they were communicating with each
other.

For example, when SOGo attempts to create a folder whose encoding
includes the base64 "/" digit, it is not accepted as valid mUTF7 by
the IMAP server:

C[0x5649de0d5d30]: 5 LIST "" ""
S[0x5649de0f3640]: * LIST (\Noselect) "/" ""
S[0x5649de0f3640]: 5 OK List completed (0.001 + 0.040 + 0.039 secs).
C[0x5649de0d5d30]: 6 create "INBOX/&BD8EMAQ/BDA-"
S[0x5649de0f3640]: 6 NO Mailbox name is not valid mUTF-7 (0.001 + 0.000 secs).

In the other direction, when such a folder is listed by the IMAP
server, it appears with a ",", for example: "&BD8EMAQ/BDA-". And this
is not correctly decoded by SOGo due to the fact that "," is not known
to SOGo as a digit in this base and is mapped to -1 by the internal
table, which results in a wrong Unicode code.

An example of a Unicode string which would trigger this bug is a
string with U+043F CYRILLIC SMALL LETTER PE as the third letter:

$ printf '\x04\x3f\x04\x30\x04\x3f' | recode ucs-2..
$ printf '\x04\x3f\x04\x30\x04\x3f' | base64
BD8EMAQ/

Three two-byte Unicode (Cyrillic) characters correspond to eight 6-bit
base64 digits, the last one being "/":

U+043F                U+0430                 U+043F
0000 01|00 0011 1111  00|00 0100 0011 00|00  0000 0100 00|11 1111
      B|      D|       8|      E|      M|       A|      Q|      /|

This bug has been reported in:

https://sogo.nu/bugs/view.php?id=4308
https://bugzilla.altlinux.org/show_bug.cgi?id=32426
https://bugzilla.altlinux.org/show_bug.cgi?id=33722

and a part of the problem described in
https://sogo.nu/bugs/view.php?id=2318 must be caused by incorrect
mUTF7 encoding, too (and hence must have not been fixed completely
before):

And I see next messages when I try to open Cyrillic folder:
C[0x7fb2e23a77a0]: 5 select "&BBQEPgRBBEIEQwT/BEs-"
S[0x7fb2e21fb690]: 5 NO Invalid mailbox name: &BBQEPgRBBEIEQwT/BEs-

As can you see sogo sends wrong folder name:
received "&BBQEPgRBBEIEQwQ,BEs-"
sent "&BBQEPgRBBEIEQwT/BEs-"
2017-10-10 12:49:03 +03:00
Francis Lachapelle 1aeb286bc2 (IMAP) Remove parenthesis in AND qualifier 2017-05-25 15:46:14 -04:00
Ludovic Marcotte bc75598c5c (fix) expose the "method" method, you silly SOPE 2017-01-13 15:42:07 -05:00
Ludovic Marcotte e083bd9858 (fix) pick the right generator (fixes #3977) 2017-01-05 10:09:15 -05:00
Ludovic Marcotte c96d96d56f (fix) properly capitalize mail headers (fixes #1047) 2016-12-30 13:55:40 -05:00
Francis Lachapelle d047870b37 Use %u instead of %d in NGImap4Client
Fixes #3908
2016-11-21 13:11:42 -05:00
Ludovic Marcotte f503532011 (fix) attempt to make the annotation parser a bit more robust 2016-10-14 09:17:46 -04:00
Ludovic Marcotte 928842388d (fix) more safety checks around nil annotation values 2016-10-11 11:18:51 -04:00
Ludovic Marcotte d6a218e537 (fix) make sure we have a non-nil annotation when trying to populate the hash 2016-10-11 08:39:09 -04:00