]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
6 years agoReleased v2.3.6 release-2.3.6 2.3.6
Aki Tuomi [Mon, 29 Apr 2019 06:04:27 +0000 (09:04 +0300)] 
Released v2.3.6

6 years agoNEWS: Add news for 2.3.6
Aki Tuomi [Mon, 29 Apr 2019 06:01:44 +0000 (09:01 +0300)] 
NEWS: Add news for 2.3.6

6 years agoNEWS: Update news with missing entries from other branches
Aki Tuomi [Fri, 12 Apr 2019 14:57:32 +0000 (17:57 +0300)] 
NEWS: Update news with missing entries from other branches

6 years agofts-solr: Add soft_commit setting
John Fawcett [Wed, 24 Apr 2019 07:37:55 +0000 (10:37 +0300)] 
fts-solr: Add soft_commit setting

soft_commit=yes|no: send softCommit to the solr server, default yes is backwards compatible behaviour
If setting to no autoSoftCommit on solr should be set to something reasonable (e.g. 60 seconds)
in file solrconfig.xml

6 years agofts-solr: Add batch_size configuration option
John Fawcett [Wed, 24 Apr 2019 07:34:49 +0000 (10:34 +0300)] 
fts-solr: Add batch_size configuration option

batch_size: configure the number of emails sent in single requests to solr, default 1000

6 years agofts-solr: Only increment ctx->mails_since_flush after flush
Aki Tuomi [Mon, 29 Apr 2019 11:07:19 +0000 (14:07 +0300)] 
fts-solr: Only increment ctx->mails_since_flush after flush

Otherwise it gets wrongly increment before flush.

6 years agolib-smtp: smtp-server-cmd-auth - Fix AUTH response error handling so that it stops...
Stephan Bosch [Thu, 25 Apr 2019 07:51:32 +0000 (09:51 +0200)] 
lib-smtp: smtp-server-cmd-auth - Fix AUTH response error handling so that it stops reading more input.

Otherwise, it may try to read more data from the stream as the next AUTH
response, which causes an assert crash in the command parser later on. Even when
the parser finds no input from the stream, it will advance its state
towards AUTH response parsing, which is a problem when the next command is
subsequently being parsed.

Panic was:

Panic: file smtp-command-parser.c: line 438 (smtp_command_parse_next): assertion failed: (!parser->auth_response || parser->state.state == SMTP_COMMAND_PARSE_STATE_INIT || parser->state.state == SMTP_COMMAND_PARSE_STATE_ERROR)

6 years agosubmission-login: client-authenticate - Fix crash occurring when client disconnects...
Stephan Bosch [Tue, 12 Mar 2019 02:18:33 +0000 (03:18 +0100)] 
submission-login: client-authenticate - Fix crash occurring when client disconnects during authentication.

6 years agosubmission-login: Remove unused client->pending_starttls.
Stephan Bosch [Mon, 22 Apr 2019 22:13:46 +0000 (00:13 +0200)] 
submission-login: Remove unused client->pending_starttls.

6 years agolib: json - Escape invalid UTF-8 as unicode bytes
Aki Tuomi [Tue, 2 Apr 2019 10:09:48 +0000 (13:09 +0300)] 
lib: json - Escape invalid UTF-8 as unicode bytes

This prevents dovecot from crashing if invalid UTF-8 input
is given.

6 years agolib-smtp: smtp-client - Fix sending of duplicate QUIT command.
Stephan Bosch [Wed, 6 Feb 2019 21:34:32 +0000 (22:34 +0100)] 
lib-smtp: smtp-client - Fix sending of duplicate QUIT command.

The command name comparison function was broken after the command was sent. Made
the function robust against addition/removal of CRLF to the command line.

6 years agolib-smtp: client: Fix infinite loop in XCLIENT command interaction with server.
Stephan Bosch [Sun, 6 Jan 2019 15:22:02 +0000 (16:22 +0100)] 
lib-smtp: client: Fix infinite loop in XCLIENT command interaction with server.

The state regarding the fact that the XCLIENT command was already sent was not
recorded. So, after the HELO handshake, the client would send a new XCLIENT
command.

6 years agolib-smtp: client: command: Add debug message showing what commands are being sent...
Stephan Bosch [Sun, 6 Jan 2019 15:21:29 +0000 (16:21 +0100)] 
lib-smtp: client: command: Add debug message showing what commands are being sent to the server.

6 years agoglobal: Use array_push_front
Aki Tuomi [Fri, 11 Jan 2019 10:42:15 +0000 (12:42 +0200)] 
global: Use array_push_front

Re-run of 70540d8b3e0799113fa4c47e3b778efb4679f24f due to
bad spatch usage

6 years agoglobal: Rename array_first and array_last to array_front and back
Aki Tuomi [Mon, 14 Jan 2019 12:00:36 +0000 (14:00 +0200)] 
global: Rename array_first and array_last to array_front and back

This is more consistent with other languages

6 years agoglobal: Use array_pop_front
Aki Tuomi [Fri, 11 Jan 2019 10:41:48 +0000 (12:41 +0200)] 
global: Use array_pop_front

Re-run of 9b726934956ed9ca02077a82f7b2a1d74b7c9146 due to
bad spatch usage.

6 years agoglobal: Use array_pop_back
Aki Tuomi [Fri, 11 Jan 2019 10:41:28 +0000 (12:41 +0200)] 
global: Use array_pop_back

Re-run of 48c70592eb36b1263ad63e3c1dca8a0b5aff09ba due to
wrong spatch usage.

6 years agoglobal: Use array_push_back instead of array_append
Aki Tuomi [Fri, 11 Jan 2019 10:40:59 +0000 (12:40 +0200)] 
global: Use array_push_back instead of array_append

6 years agoglobal: Really change array_idx(A, 0) to array_first(A)
Aki Tuomi [Thu, 10 Jan 2019 10:11:24 +0000 (12:11 +0200)] 
global: Really change array_idx(A, 0) to array_first(A)

Was only partially done in 27b2b51943e0f9440483abeae4c9f5805b236db9

6 years agoglobal: Use array_last instead of array_idx
Aki Tuomi [Fri, 4 Jan 2019 13:16:44 +0000 (15:16 +0200)] 
global: Use array_last instead of array_idx

@@
expression E;
@@

-array_idx(E, array_count(E) - 1)
+array_last(E)

@@
expression E;
@@

-array_idx_modifiable(E, array_count(E) - 1)
+array_last_modifiable(E)

6 years agoglobal: Use array_pop_back
Aki Tuomi [Fri, 4 Jan 2019 12:01:53 +0000 (14:01 +0200)] 
global: Use array_pop_back

@@
expression A;
@@

-array_delete(A, array_count(A)-1, 1)
+array_pop_back(A)

And manually fixing the few missed ones

6 years agoglobal: Use array_pop_front
Aki Tuomi [Fri, 4 Jan 2019 11:59:36 +0000 (13:59 +0200)] 
global: Use array_pop_front

@@
expression A;
@@

-array_delete(A, 0, 1)
+array_pop_front(A)

6 years agoglobal: Use array_push_front
Aki Tuomi [Fri, 4 Jan 2019 11:58:46 +0000 (13:58 +0200)] 
global: Use array_push_front

@@
expression A,I;
@@

-array_insert(A, 0, I, 1)
+array_push_front(A, I)

6 years agoglobal: Use array_push_back
Aki Tuomi [Fri, 4 Jan 2019 11:58:08 +0000 (13:58 +0200)] 
global: Use array_push_back

@@
expression A,I;
@@

-array_append(A, I, 1)
+array_push_back(A, I)

6 years agoglobal: Use array_first instead of array_idx
Aki Tuomi [Fri, 4 Jan 2019 11:56:10 +0000 (13:56 +0200)] 
global: Use array_first instead of array_idx

@@
expression A;
@@

-array_idx(A, 0)
+array_first(A)

@@
expression A;
@@

-array_idx_modifiable(A, 0)
+array_first_modifiable(A)

6 years agolib: array - Add helpers for dealing with some common array usecases
Aki Tuomi [Wed, 2 Jan 2019 11:29:32 +0000 (13:29 +0200)] 
lib: array - Add helpers for dealing with some common array usecases

Adds macros for accessing first and last item, pushing and popping
and also adding/removing first item.

Note that pop and shift do not return item.

6 years agolib: array - Fix asserts to work correctly on 32-bit systems
Aki Tuomi [Fri, 4 Jan 2019 14:01:01 +0000 (16:01 +0200)] 
lib: array - Fix asserts to work correctly on 32-bit systems

6 years agolib-oauth2: Don't crash when http response has no payload
Martti Rannanjärvi [Fri, 22 Mar 2019 06:11:21 +0000 (08:11 +0200)] 
lib-oauth2: Don't crash when http response has no payload

6 years agolib-oauth2: Remove obsolete files.
Sergey Kitov [Wed, 20 Mar 2019 12:20:44 +0000 (14:20 +0200)] 
lib-oauth2: Remove obsolete files.

6 years agolib-oauth2: Refactor oauth request code.
Sergey Kitov [Mon, 11 Feb 2019 14:37:53 +0000 (16:37 +0200)] 
lib-oauth2: Refactor oauth request code.

Use one parameterized function instead of three copy-paste functions.

6 years agolib-oauth2: Add client_id and client_secret to introspect request
Sergey Kitov [Thu, 14 Mar 2019 13:53:41 +0000 (15:53 +0200)] 
lib-oauth2: Add client_id and client_secret to introspect request

6 years agoauth: Fix deinitialization of multiple passdbs.
Sergey Kitov [Mon, 18 Mar 2019 13:27:43 +0000 (15:27 +0200)] 
auth: Fix deinitialization of multiple passdbs.

6 years agolib: Use uintptr_t in PTR_OFFSET and POINTER_CAST
Aki Tuomi [Sun, 14 Jan 2018 17:21:36 +0000 (19:21 +0200)] 
lib: Use uintptr_t in PTR_OFFSET and POINTER_CAST

Use uintptr_t instead of pointers.

Fixes clang 6.0 warning: arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension

6 years agolib-http: http-client-connection - Create function for obtaining client settings...
Stephan Bosch [Wed, 20 Feb 2019 21:19:03 +0000 (22:19 +0100)] 
lib-http: http-client-connection - Create function for obtaining client settings reliably.

This fixes and prevents segfaults occurring when settings are needed while the
connection is detached. In that case, the shared client context settings need
to be used rather than the client settings. Before, the attachment of a peer was
assumed for obtaining the settings when it actually could be absent in rare
cases, causing a NULL dereference.

6 years agolib-http: http-client-connection - Make sure the request timeout is stopped when...
Stephan Bosch [Thu, 14 Feb 2019 21:02:03 +0000 (22:02 +0100)] 
lib-http: http-client-connection - Make sure the request timeout is stopped when no more request are pending.

6 years agolib-http: http-client-connection - Descend event from client context rather than...
Stephan Bosch [Thu, 14 Feb 2019 20:16:26 +0000 (21:16 +0100)] 
lib-http: http-client-connection - Descend event from client context rather than client.

The connection is potentially switched between clients often causing the
client event prefix to make no sense.

6 years agofts: Fix buffer overflow when reading oversized fts header
Timo Sirainen [Tue, 5 Feb 2019 03:25:13 +0000 (19:25 -0800)] 
fts: Fix buffer overflow when reading oversized fts header

6 years agolib-storage: Fix buffer overflow when reading oversized hdr-pop3-uidl header
Timo Sirainen [Tue, 5 Feb 2019 03:23:02 +0000 (19:23 -0800)] 
lib-storage: Fix buffer overflow when reading oversized hdr-pop3-uidl header

6 years agolib-program-client: Run local client tests with valgrind --trace-children=no.
Stephan Bosch [Fri, 2 Feb 2018 17:35:49 +0000 (18:35 +0100)] 
lib-program-client: Run local client tests with valgrind --trace-children=no.

Before, valgrind was omitted entirely.

6 years agolib-program-client: test-program-client-local: Properly deallocate all streams for...
Stephan Bosch [Fri, 2 Feb 2018 17:37:23 +0000 (18:37 +0100)] 
lib-program-client: test-program-client-local: Properly deallocate all streams for big I/O test.

6 years agocore: Update README.md to fix broken RFC links
Michael Slusarz [Thu, 14 Mar 2019 16:54:30 +0000 (10:54 -0600)] 
core: Update README.md to fix broken RFC links

6 years agolib: Panic on most epoll_ctl() failures
Timo Sirainen [Fri, 8 Mar 2019 10:34:29 +0000 (12:34 +0200)] 
lib: Panic on most epoll_ctl() failures

Anything except ENOSPC or ENOMEM points to a bug in code. Getting core dump
from those helps debugging.

6 years agoauth: Add client_secret setting
Sergey Kitov [Fri, 1 Mar 2019 08:57:40 +0000 (10:57 +0200)] 
auth: Add client_secret setting

6 years agoauth: Fix for processing oauth2 responses with 4xx HTTP status.
Sergey Kitov [Fri, 1 Mar 2019 08:57:22 +0000 (10:57 +0200)] 
auth: Fix for processing oauth2 responses with 4xx HTTP status.

6 years agolib-oauth2: Provide a unit test for the JSON response payload parser.
Stephan Bosch [Sun, 9 Dec 2018 20:18:22 +0000 (21:18 +0100)] 
lib-oauth2: Provide a unit test for the JSON response payload parser.

6 years agolib-oauth2: Fix assert panic occurring while skipping ignored object and array fields.
Stephan Bosch [Sun, 9 Dec 2018 20:14:29 +0000 (21:14 +0100)] 
lib-oauth2: Fix assert panic occurring while skipping ignored object and array fields.

Fixed by using json_parse_skip(), rather than json_parse_skip_next(). The latter
is not suitable for skipping a value that is already partially parsed by
json_parse_next().

Panic was:

Panic: file json-parser.c: line 668 (json_parse_skip_next): assertion failed: (parser->state == JSON_STATE_OBJECT_COLON || parser->state == JSON_STATE_OBJECT_VALUE || parser->state == JSON_STATE_ARRAY_VALUE || parser->state == JSON_STATE_ARRAY_NEXT)

6 years agolib-oauth2: Fix asynchronous parsing of JSON response payload.
Stephan Bosch [Sun, 9 Dec 2018 20:08:53 +0000 (21:08 +0100)] 
lib-oauth2: Fix asynchronous parsing of JSON response payload.

The problem was caused by the fact that req->field_name was reset in the
beginning of oauth2_parse_json(), which is continuously called when more payload
can be read from the input stream. This leads to corruption of the parser state
machine each time parsing is continued.

To fix this issue, the field_name is now reset only when the parsing commences.

6 years agolib: json-parser: Add unit test on skipping various object member fields.
Stephan Bosch [Sun, 9 Dec 2018 19:27:10 +0000 (20:27 +0100)] 
lib: json-parser: Add unit test on skipping various object member fields.

This both tests skipping fields based on their member key and based on their
value types; i.e., after calling json_parse_next() for the object member value.

6 years agolib: json-parser: Add support for skipping a value that is already partially parsed.
Stephan Bosch [Sun, 9 Dec 2018 19:24:28 +0000 (20:24 +0100)] 
lib: json-parser: Add support for skipping a value that is already partially parsed.

Adds json_parse_skip(), which skips the remainder of the value parsed earlier by
json_parse_next(). This is needed when values need to be skipped by their value
type rather than their object member key.

6 years agolib-storage: pop3c - Copy SSL settings correctly
Aki Tuomi [Wed, 27 Feb 2019 13:25:06 +0000 (15:25 +0200)] 
lib-storage: pop3c - Copy SSL settings correctly

When attempting to use pop3c with immediate SSL, it would
crash due to invalid memory access during connection setup.
Also the SSL mode is not copied so SSL handshake is not attempted
at later stage.

Was broken in 01435c38e7 and ebcf7d6c92

6 years agoauth: Fix processing of wrong password for oauth2 password grant
Sergey Kitov [Wed, 27 Feb 2019 13:39:34 +0000 (15:39 +0200)] 
auth: Fix processing of wrong password for oauth2 password grant

6 years agodoc: Add Solr 7.7 configuration files
Stephan Bosch [Tue, 26 Feb 2019 01:26:00 +0000 (03:26 +0200)] 
doc: Add Solr 7.7 configuration files

The schema for 7.7 is based on work by Daniel Miller <dmiller@amfes.com>.

6 years agofts-solr: Add rawlog support
Martti Rannanjärvi [Tue, 26 Feb 2019 01:07:25 +0000 (03:07 +0200)] 
fts-solr: Add rawlog support

6 years agofts-solr: Use fts_solr_settings struct in solr_connection_init()
Martti Rannanjärvi [Mon, 25 Feb 2019 17:51:27 +0000 (19:51 +0200)] 
fts-solr: Use fts_solr_settings struct in solr_connection_init()

6 years agodoveadm: server-connection - Remove redundant ssl verification
Aki Tuomi [Mon, 25 Feb 2019 14:40:46 +0000 (16:40 +0200)] 
doveadm: server-connection - Remove redundant ssl verification

Certificate validation is done by lib-ssl-iostream already,
don't do it here again.

Fixes ssl_client_require_valid_cert=no for doveadm sync

6 years agodoveadm: Make sure SSL settings are always available
Aki Tuomi [Mon, 25 Feb 2019 14:46:59 +0000 (16:46 +0200)] 
doveadm: Make sure SSL settings are always available

6 years agolib-ssl-iostream: Add comment about using ssl_iostream_check_cert_validity
Aki Tuomi [Mon, 25 Feb 2019 16:07:45 +0000 (18:07 +0200)] 
lib-ssl-iostream: Add comment about using ssl_iostream_check_cert_validity

6 years agolib-ssl-iostream: Add comment about verifying certs in callbacks
Aki Tuomi [Mon, 25 Feb 2019 15:22:57 +0000 (17:22 +0200)] 
lib-ssl-iostream: Add comment about verifying certs in callbacks

6 years agolib-ssl-iostream: Call ssl_iostream_check_cert_validity as default
Aki Tuomi [Mon, 25 Feb 2019 15:44:09 +0000 (17:44 +0200)] 
lib-ssl-iostream: Call ssl_iostream_check_cert_validity as default

Unless callback is specified, call ssl_iostream_check_cert_validity
instead of ssl_iostream_cert_match_name to make sure we perform
same checks consistently.

6 years agodoveadm-server: Load SSL settings
Aki Tuomi [Sun, 17 Feb 2019 21:02:16 +0000 (23:02 +0200)] 
doveadm-server: Load SSL settings

Otherwise operations that might use ssl can lead
into invalid memory access.

6 years agoauth: Add caching to passdb-oauth.
Sergey Kitov [Thu, 14 Feb 2019 14:03:02 +0000 (16:03 +0200)] 
auth: Add caching to passdb-oauth.

6 years agoauth: Add support for oauth2 password grant
Sergey Kitov [Tue, 5 Feb 2019 07:43:09 +0000 (09:43 +0200)] 
auth: Add support for oauth2 password grant

6 years agolib-oauth2: Implement password grant authentication.
Sergey Kitov [Tue, 5 Feb 2019 07:45:07 +0000 (09:45 +0200)] 
lib-oauth2: Implement password grant authentication.

6 years agolib-oauth2: Take http_client_request_url_str in use for oauth2 requests.
Sergey Kitov [Thu, 31 Jan 2019 08:36:49 +0000 (10:36 +0200)] 
lib-oauth2: Take http_client_request_url_str in use for oauth2 requests.

6 years agolib-http: Expose origin_url of the struct http_client_request
Sergey Kitov [Thu, 31 Jan 2019 08:31:43 +0000 (10:31 +0200)] 
lib-http: Expose origin_url of the struct http_client_request

6 years agosubmission-login: Only overwrite XCLIENT fields in the client when a value is assigned.
Stephan Bosch [Wed, 13 Feb 2019 21:21:21 +0000 (22:21 +0100)] 
submission-login: Only overwrite XCLIENT fields in the client when a value is assigned.

Before, omitted fields in the XCLIENT command would cause the values in the
client to be reset to the equivalent of zero.

6 years agolib-smtp: Mark default as unreached in smtp_client_command_abort
Aki Tuomi [Fri, 8 Feb 2019 18:47:42 +0000 (20:47 +0200)] 
lib-smtp: Mark default as unreached in smtp_client_command_abort

Satisfies static analyzers

6 years agolib-smtp: smtp-client-command - Avoid calling the callback for the DATA command durin...
Stephan Bosch [Thu, 7 Feb 2019 01:37:27 +0000 (02:37 +0100)] 
lib-smtp: smtp-client-command - Avoid calling the callback for the DATA command during submission.

This causes a race condition in which the command object is already freed when
it is returned from smtp_client_command_data_submit(). This scenario occurs when
reading data for the first BDAT command fails.

6 years agolib-smtp: smtp-client - Send correct size value for BDAT command when the data lacks CR.
Stephan Bosch [Wed, 6 Feb 2019 19:54:26 +0000 (20:54 +0100)] 
lib-smtp: smtp-client - Send correct size value for BDAT command when the data lacks CR.

The addition of CR was ignored in the size specification because the original
unaltered stream was used for the size calculations.

6 years agolib: istreams - Don't lose IO pending state when unsetting and setting io
Timo Sirainen [Tue, 22 Jan 2019 20:45:33 +0000 (22:45 +0200)] 
lib: istreams - Don't lose IO pending state when unsetting and setting io

This makes sure that the pending state stays even after io_remove() when
io_add_istream() is again called.

6 years agolib: Fix i_stream_set_input_pending() when IO is set later
Timo Sirainen [Tue, 22 Jan 2019 10:59:57 +0000 (12:59 +0200)] 
lib: Fix i_stream_set_input_pending() when IO is set later

After i_stream_set_io() is called to set the IO, it should already be marked
as pending.

This fixes at least running imaptest with SSL.

6 years agolib: Add io_is_pending()
Timo Sirainen [Tue, 22 Jan 2019 20:43:53 +0000 (22:43 +0200)] 
lib: Add io_is_pending()

6 years agolib-index: Add mail_index_append_finish_uids_full()
Timo Sirainen [Wed, 23 Jan 2019 15:22:27 +0000 (17:22 +0200)] 
lib-index: Add mail_index_append_finish_uids_full()

6 years agolib-index: mail_index_append_finish_uids() cleanup: remove unnecessary if check
Timo Sirainen [Wed, 23 Jan 2019 15:29:22 +0000 (17:29 +0200)] 
lib-index: mail_index_append_finish_uids() cleanup: remove unnecessary if check

It was pretty confusing, and it was always TRUE.

6 years agodoveadm: Use doveadm_get_ssl_settings
Aki Tuomi [Thu, 15 Nov 2018 12:47:32 +0000 (14:47 +0200)] 
doveadm: Use doveadm_get_ssl_settings

6 years agodoveadm: dsync - use mail_storage_settings_init_ssl_client_settings
Aki Tuomi [Thu, 15 Nov 2018 12:46:44 +0000 (14:46 +0200)] 
doveadm: dsync - use mail_storage_settings_init_ssl_client_settings

6 years agolib-storage: mail-user - Use mail_storage_settings_init_ssl_client_settings
Aki Tuomi [Thu, 15 Nov 2018 12:42:28 +0000 (14:42 +0200)] 
lib-storage: mail-user - Use mail_storage_settings_init_ssl_client_settings

6 years agomail-storage: Add mail_storage_settings_init_ssl_client_settings
Aki Tuomi [Thu, 15 Nov 2018 12:40:46 +0000 (14:40 +0200)] 
mail-storage: Add mail_storage_settings_init_ssl_client_settings

Simplifies following commits

6 years agodoveadm: Use master service SSL settings
Aki Tuomi [Thu, 15 Nov 2018 12:35:36 +0000 (14:35 +0200)] 
doveadm: Use master service SSL settings

6 years agolib-smtp: client: Fix dead assignment in smtp_client_command_pipeline_is_open().
Stephan Bosch [Tue, 22 Jan 2019 21:06:38 +0000 (22:06 +0100)] 
lib-smtp: client: Fix dead assignment in smtp_client_command_pipeline_is_open().

Found by scan-build.

6 years agolib-smtp: command: Move main loop from sub-function to smtp_client_command_send_more...
Stephan Bosch [Sun, 9 Dec 2018 11:13:59 +0000 (12:13 +0100)] 
lib-smtp: command: Move main loop from sub-function to smtp_client_command_send_more() itself.

This reduces code indent in smtp_client_command_do_send_more() (the
sub-function) and it turns the inifite for loop into a nice conditional
while loop.

6 years agolib-smtp: test-smtp-client-errors: Test early DATA command success and error replies.
Stephan Bosch [Sun, 11 Nov 2018 22:32:15 +0000 (23:32 +0100)] 
lib-smtp: test-smtp-client-errors: Test early DATA command success and error replies.

Early success for the DATA command is treated as a protocol error, while early
failure is allowed. Both situations are tested in a new scenario for the
test-smtp-client-errors unit test.

6 years agolib-smtp: client: Fix handling of non-blocking command payload stream.
Stephan Bosch [Sun, 11 Nov 2018 22:25:50 +0000 (23:25 +0100)] 
lib-smtp: client: Fix handling of non-blocking command payload stream.

By inference, this fixes the handling of non-blocking transaction payload as
well. No io was created when the payload stream returned no data.

6 years agolib-smtp: test-smtp-client-errors: Add test scenario for premature success replies.
Stephan Bosch [Sun, 11 Nov 2018 19:30:25 +0000 (20:30 +0100)] 
lib-smtp: test-smtp-client-errors: Add test scenario for premature success replies.

Such replies are sent immediately along with the reply of the previous command.
So, the reply is sent before the corresponding command is even submitted. This
tests whether the client handles this erroneous situation correctly.

6 years agolib-smtp: test-smtp-payload: Add option to test payload exchange with small socket...
Stephan Bosch [Thu, 16 Aug 2018 20:34:53 +0000 (22:34 +0200)] 
lib-smtp: test-smtp-payload: Add option to test payload exchange with small socket buffers.

This is not part of the normal `make check` procedure, since using small socket
buffers makes the test extremely slow.

6 years agolib-smtp: client: Allow receiving replies before command data stream is sent completely.
Stephan Bosch [Wed, 15 Aug 2018 16:29:11 +0000 (18:29 +0200)] 
lib-smtp: client: Allow receiving replies before command data stream is sent completely.

This avoids unnecessary problems with servers that reply somewhat early to DATA
and BDAT commands. For one, early failure replies are now handled properly.
Also, race conditions at the client between sending the closing CRLF.CRLF and
receiving the DATA reply are no longer causing problems.

6 years agolib-smtp: client: Put moving a command from the queue to the wait list in a separate...
Stephan Bosch [Sun, 9 Dec 2018 10:34:56 +0000 (11:34 +0100)] 
lib-smtp: client: Put moving a command from the queue to the wait list in a separate function.

6 years agolib-smtp: client: Put determining the status of the command pipeline in a separate...
Stephan Bosch [Thu, 16 Aug 2018 20:15:36 +0000 (22:15 +0200)] 
lib-smtp: client: Put determining the status of the command pipeline in a separate function.

6 years agolib-smtp: client: Put sending the command line in a separate function.
Stephan Bosch [Thu, 16 Aug 2018 20:07:08 +0000 (22:07 +0200)] 
lib-smtp: client: Put sending the command line in a separate function.

6 years agolib-smtp: client: Don't put connection in TRANSACTION state unless there's a transaction.
Stephan Bosch [Mon, 21 Jan 2019 21:21:03 +0000 (22:21 +0100)] 
lib-smtp: client: Don't put connection in TRANSACTION state unless there's a transaction.

Fixes hang occurring when connection is ready before transaction is started.

6 years agoquota: Rename quota_set_resource() error_r to client_error_r
Martti Rannanjärvi [Mon, 21 Jan 2019 08:50:24 +0000 (10:50 +0200)] 
quota: Rename quota_set_resource() error_r to client_error_r

Don't pass on the error from dict_init() to client, though.

6 years agoimap-acl: Rename error_r sent to client as client_error_r
Martti Rannanjärvi [Mon, 21 Jan 2019 11:01:27 +0000 (13:01 +0200)] 
imap-acl: Rename error_r sent to client as client_error_r

6 years agolib-imap-urlauth: Rename error_r sent to clients as client_error_r
Martti Rannanjärvi [Mon, 21 Jan 2019 11:00:09 +0000 (13:00 +0200)] 
lib-imap-urlauth: Rename error_r sent to clients as client_error_r

6 years agolib-imap-storage: Rename error_r sent to clients as client_error_r
Martti Rannanjärvi [Mon, 21 Jan 2019 10:59:45 +0000 (12:59 +0200)] 
lib-imap-storage: Rename error_r sent to clients as client_error_r

6 years agoimap,lib-storage: Rename error_r sent to clients as client_error_r
Martti Rannanjärvi [Mon, 21 Jan 2019 10:41:20 +0000 (12:41 +0200)] 
imap,lib-storage: Rename error_r sent to clients as client_error_r

6 years agosubmission-login: proxy: Fix omission of spaces between XCLIENT command parameters.
Anton Dollmaier [Thu, 27 Sep 2018 21:00:22 +0000 (23:00 +0200)] 
submission-login: proxy: Fix omission of spaces between XCLIENT command parameters.

It would send for example:

> XCLIENT ADDR=10.0.1.2PORT=39074

The other end will obviously not accept this.

--
Commit message modified by Stephan Bosch

6 years agolib-smtp: client: BDAT command: Make sure the message contains CRLF consistently.
Stephan Bosch [Sat, 8 Sep 2018 18:54:54 +0000 (20:54 +0200)] 
lib-smtp: client: BDAT command: Make sure the message contains CRLF consistently.

Before, only messages sent using DATA command guaranteed consistent CRLF,
because these are sent using o_stream_dot(), which does that internally. For the
BDAT command, the message was sent as-is, which is not always accepted by MTAs.

6 years agolib-smtp: client: BDAT command: Ensure data stream max buffer size is appropriate...
Stephan Bosch [Fri, 26 Oct 2018 10:15:45 +0000 (12:15 +0200)] 
lib-smtp: client: BDAT command: Ensure data stream max buffer size is appropriate when stream size is unknown.

When stream size is unknown, the chunk size are determined by what can be
buffered in the data input stream immediately. If it's maximum buffer size is
(much) smaller than the maximum chunk size, the maximum chunk size is never
achieved.

6 years agolib-smtp: server: Fix forwarding a multi-line reply.
Stephan Bosch [Fri, 26 Oct 2018 14:17:06 +0000 (16:17 +0200)] 
lib-smtp: server: Fix forwarding a multi-line reply.

A multi-line reply had the '-' on the first line stripped upon sending, which
makes clients see two separate responses rather than just one. This was caused
by the fact that forwarded replies had the last_line field not set properly,
in which case the '-' was substituted on the first line, rather than the last.
The fix makes a forwarded reply indistinguishable from a normally created reply
by also allowing for amending the reply with additional lines using
smtp_server_reply_add_text().

6 years agolib-smtp: test-smtp-reply: Test whether parsed valid replies can be written back...
Stephan Bosch [Fri, 26 Oct 2018 13:50:17 +0000 (15:50 +0200)] 
lib-smtp: test-smtp-reply: Test whether parsed valid replies can be written back to the original input.

In some cases, the parser mangles the input a little to substitute invalid
characters. In those cases, the expected output is stated explicitly.