]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
7 years agolib-ssl-iostream: Add stream/context comments to all ssl_iostream_settings
Timo Sirainen [Mon, 30 Oct 2017 10:06:01 +0000 (12:06 +0200)] 
lib-ssl-iostream: Add stream/context comments to all ssl_iostream_settings

7 years agologin-proxy: Use iostream-proxy API to perform proxying
Timo Sirainen [Sun, 29 Oct 2017 22:44:41 +0000 (00:44 +0200)] 
login-proxy: Use iostream-proxy API to perform proxying

7 years agolib: Add o_stream_get_last_write_time()
Timo Sirainen [Sun, 29 Oct 2017 22:59:01 +0000 (00:59 +0200)] 
lib: Add o_stream_get_last_write_time()

7 years agolib: Add i_stream_get_last_read_time()
Timo Sirainen [Sun, 29 Oct 2017 22:49:15 +0000 (00:49 +0200)] 
lib: Add i_stream_get_last_read_time()

7 years agologin-proxy: Move client fd closing to client_unref()
Timo Sirainen [Wed, 1 Nov 2017 21:53:42 +0000 (23:53 +0200)] 
login-proxy: Move client fd closing to client_unref()

7 years agologin-common: Move code in client_destroy_internal_failure() to its only caller
Timo Sirainen [Wed, 1 Nov 2017 19:15:53 +0000 (21:15 +0200)] 
login-common: Move code in client_destroy_internal_failure() to its only caller

No need to have a function that has only a single caller.

7 years agologin-common: Avoid using client_destroy_success() when mail_max_userip_connections...
Timo Sirainen [Wed, 1 Nov 2017 19:09:56 +0000 (21:09 +0200)] 
login-common: Avoid using client_destroy_success() when mail_max_userip_connections is reached

This was currently the only way how data != NULL here.

This change destroys ssl_proxy on client_destroy() instead of
client_unref(), but that doesn't make much of a practical difference. This
new behavior is a bit more correct though.

7 years agoiostream-openssl: Refactor stream sync code
Aki Tuomi [Tue, 4 Oct 2016 12:36:06 +0000 (15:36 +0300)] 
iostream-openssl: Refactor stream sync code

When doing input or stream sync, specify
the type of operation that we are doing
to make sure we do IO correctly.

7 years agolib-ssl-iostream: Set error on clean connection closing during handshake.
Timo Sirainen [Sun, 5 Nov 2017 16:07:28 +0000 (18:07 +0200)] 
lib-ssl-iostream: Set error on clean connection closing during handshake.

Set the error to "SSL connection closed during handshake".

7 years agolib-ssl-iostream: Cleanup disconnection handling
Timo Sirainen [Sun, 5 Nov 2017 16:06:10 +0000 (18:06 +0200)] 
lib-ssl-iostream: Cleanup disconnection handling

Avoid code duplication. Set error to "Connection closed" if there's no
other error.

7 years agodoveadm: Remove dead code
Timo Sirainen [Sun, 5 Nov 2017 15:47:15 +0000 (17:47 +0200)] 
doveadm: Remove dead code

ret can never be >0 at this point. If there are any unexpected JSON
elements, doveadm_http_server_json_parse_v1() returns -1.

7 years agodirector: Make sure HOST-RESET-USERS isn't used with max_moving_users=0
Timo Sirainen [Sun, 5 Nov 2017 21:51:56 +0000 (23:51 +0200)] 
director: Make sure HOST-RESET-USERS isn't used with max_moving_users=0

The reset command would just hang in that case. doveadm would never have
sent this, so this is just an extra sanity check.

7 years agodirector: Show in process title how many users are being kicked.
Timo Sirainen [Sun, 5 Nov 2017 21:27:36 +0000 (23:27 +0200)] 
director: Show in process title how many users are being kicked.

7 years agodirector: Show in process title how many requests are being delayed.
Timo Sirainen [Sun, 5 Nov 2017 21:01:56 +0000 (23:01 +0200)] 
director: Show in process title how many requests are being delayed.

7 years agodirector: Log an error if login process sends unexpected reply to KICK* commands
Timo Sirainen [Mon, 6 Nov 2017 08:57:03 +0000 (10:57 +0200)] 
director: Log an error if login process sends unexpected reply to KICK* commands

7 years agodirector: Log whenever HOST-RESET-USERS is used
Timo Sirainen [Sun, 5 Nov 2017 20:53:23 +0000 (22:53 +0200)] 
director: Log whenever HOST-RESET-USERS is used

7 years agodirector: Include used CPU secs in director connection log messages
Timo Sirainen [Sun, 5 Nov 2017 20:38:27 +0000 (22:38 +0200)] 
director: Include used CPU secs in director connection log messages

It's counting the process's full CPU seconds used since the handshake
started, so it's not specific to the connection itself. Still, this is
likely to be very useful in debugging whether a slow handshake was due
to CPU usage or something else.

7 years agodirector: Deduplicate code into director_connection_set_connected()
Timo Sirainen [Sun, 5 Nov 2017 20:37:27 +0000 (22:37 +0200)] 
director: Deduplicate code into director_connection_set_connected()

7 years agodirector: Include peak output buffer size in director connection log messages
Timo Sirainen [Sun, 5 Nov 2017 20:27:41 +0000 (22:27 +0200)] 
director: Include peak output buffer size in director connection log messages

7 years agocassandra: Include the used timestamp in logged queries
Timo Sirainen [Sat, 4 Nov 2017 12:33:52 +0000 (14:33 +0200)] 
cassandra: Include the used timestamp in logged queries

7 years agocassandra: Rename cassandra_sql_statement.pending_timestamp to just timestamp
Timo Sirainen [Mon, 6 Nov 2017 09:00:06 +0000 (11:00 +0200)] 
cassandra: Rename cassandra_sql_statement.pending_timestamp to just timestamp

7 years agolib-storage: When copying mails, copy also empty cache fields
Timo Sirainen [Mon, 6 Nov 2017 16:59:34 +0000 (18:59 +0200)] 
lib-storage: When copying mails, copy also empty cache fields

This mainly means that it copies cache fields for nonexistent message
headers. Those are still important, because otherwise Dovecot doesn't know
whether they exist or not.

7 years agodirector: Don't block too long when sending users during director handshake
Timo Sirainen [Sun, 5 Nov 2017 23:30:13 +0000 (01:30 +0200)] 
director: Don't block too long when sending users during director handshake

All the other work is blocked while the users are being sent.

7 years agoauth: Disabling SMTP authentication in vpopmail users with NO_SMTP flag
Taizo Ito [Wed, 26 Jul 2017 09:34:59 +0000 (18:34 +0900)] 
auth: Disabling SMTP authentication in vpopmail users with NO_SMTP flag

7 years agolib: str_parse/to_*int*() - minor optimization
Timo Sirainen [Sun, 5 Nov 2017 19:36:55 +0000 (21:36 +0200)] 
lib: str_parse/to_*int*() - minor optimization

7 years agodirector: Avoid str_printfa() in director_connection_send_users()
Timo Sirainen [Sat, 4 Nov 2017 13:29:29 +0000 (15:29 +0200)] 
director: Avoid str_printfa() in director_connection_send_users()

Optimizes the CPU usage.

7 years agodirector: Avoid str_printfa() in login_host_callback()
Timo Sirainen [Sat, 4 Nov 2017 00:17:55 +0000 (02:17 +0200)] 
director: Avoid str_printfa() in login_host_callback()

Optimizes the CPU usage.

7 years agodirector: Change request callback to take mail_host parameter
Timo Sirainen [Sat, 4 Nov 2017 00:05:26 +0000 (02:05 +0200)] 
director: Change request callback to take mail_host parameter

This allows accessing the IP address both as struct and as string without
any conversions.

7 years agodirector: Use *_host.ip_str to avoid net_ip2addr() calls
Timo Sirainen [Fri, 3 Nov 2017 23:59:27 +0000 (01:59 +0200)] 
director: Use *_host.ip_str to avoid net_ip2addr() calls

7 years agodirector: Add director_host.ip_str
Timo Sirainen [Fri, 3 Nov 2017 23:51:25 +0000 (01:51 +0200)] 
director: Add director_host.ip_str

This avoids having to use net_ip2addr() all the time to convert it into a
string.

7 years agodirector: Add mail_host.ip_str
Timo Sirainen [Fri, 3 Nov 2017 23:49:29 +0000 (01:49 +0200)] 
director: Add mail_host.ip_str

This avoids having to use net_ip2addr() all the time to convert it into a
string.

7 years agodirector: Use t_strsplit_tabescaped_inplace() for director connection input
Timo Sirainen [Fri, 3 Nov 2017 23:48:41 +0000 (01:48 +0200)] 
director: Use t_strsplit_tabescaped_inplace() for director connection input

7 years agolib: net_addr2ip() - Optimize for parsing IPv4 addresses
Timo Sirainen [Fri, 3 Nov 2017 23:43:41 +0000 (01:43 +0200)] 
lib: net_addr2ip() - Optimize for parsing IPv4 addresses

7 years agolib: net_ip2addr() - Optimize by allocating destination memory immediately
Timo Sirainen [Fri, 3 Nov 2017 23:42:37 +0000 (01:42 +0200)] 
lib: net_ip2addr() - Optimize by allocating destination memory immediately

It doesn't really matter if we allocate a few extra bytes.

7 years agolib: *_strsplit() - implement more efficient version for a single separator char
Timo Sirainen [Fri, 3 Nov 2017 23:40:24 +0000 (01:40 +0200)] 
lib: *_strsplit() - implement more efficient version for a single separator char

7 years agolib: test-strfuncs - Improve *_strsplit*() unit tests
Timo Sirainen [Sun, 5 Nov 2017 19:30:30 +0000 (21:30 +0200)] 
lib: test-strfuncs - Improve *_strsplit*() unit tests

7 years agolib: Implement t_strsplit_tabescaped_inplace()
Timo Sirainen [Fri, 3 Nov 2017 23:39:38 +0000 (01:39 +0200)] 
lib: Implement t_strsplit_tabescaped_inplace()

This is a more efficient version of t_strsplit_tabescaped(), which modifies
the input string instead of duplicating it.

7 years agolib: test-strescape - Refactor the unit test to use an array of tests
Timo Sirainen [Sun, 5 Nov 2017 19:14:41 +0000 (21:14 +0200)] 
lib: test-strescape - Refactor the unit test to use an array of tests

7 years agolib: t_strsplit_tabescaped() - don't create unnecessary data stack mempool
Timo Sirainen [Fri, 3 Nov 2017 23:37:19 +0000 (01:37 +0200)] 
lib: t_strsplit_tabescaped() - don't create unnecessary data stack mempool

unsafe_data_stack_pool is more efficient to use

7 years agolib: str_tabunescape() - optimize initial escape char lookup
Timo Sirainen [Fri, 3 Nov 2017 23:35:44 +0000 (01:35 +0200)] 
lib: str_tabunescape() - optimize initial escape char lookup

strchr() is faster than looping ourself.

7 years agodirector: Don't recreate timeout on every user lookup
Timo Sirainen [Fri, 3 Nov 2017 23:34:02 +0000 (01:34 +0200)] 
director: Don't recreate timeout on every user lookup

Recreate it only when the timeout should change.

7 years agodirector: Fix off-by-one when checking if user weakness is stuck
Timo Sirainen [Sun, 5 Nov 2017 21:11:25 +0000 (23:11 +0200)] 
director: Fix off-by-one when checking if user weakness is stuck

When the weakness was exactly at the second, the weakness wasn't detected
and the next expiration timeout was removed entirely. This shouldn't have
caused any bigger problems, because another user lookup on the following
second would have then detected the weakness, removed the user and restored
the next expiration timeout.

7 years agombox: Add assert to make static analyzer happier
Timo Sirainen [Sun, 5 Nov 2017 15:49:52 +0000 (17:49 +0200)] 
mbox: Add assert to make static analyzer happier

7 years agolib-http: Remove dead code
Timo Sirainen [Sun, 5 Nov 2017 15:46:03 +0000 (17:46 +0200)] 
lib-http: Remove dead code

This code branch became dead after 22ee6e1e6193299034ab99f77a650290de2fd6ca

7 years agolib-ssl-iostream: Fix alt cert support
Aki Tuomi [Fri, 3 Nov 2017 15:28:57 +0000 (17:28 +0200)] 
lib-ssl-iostream: Fix alt cert support

It was only partially implemented in 0577701d04beea222fc49a7318851ddcea3b99d3

7 years agolib: istream - Avoid panic in snapshot() with nonpersistent buffers
Timo Sirainen [Wed, 1 Nov 2017 22:00:00 +0000 (00:00 +0200)] 
lib: istream - Avoid panic in snapshot() with nonpersistent buffers

7 years agolib: istream - Don't leak snapshot memory if close() triggers a read
Timo Sirainen [Thu, 2 Nov 2017 20:57:00 +0000 (22:57 +0200)] 
lib: istream - Don't leak snapshot memory if close() triggers a read

Also move the line_str freeing just before stream is freed. That didn't
cause any known memory leaks though.

7 years agolib: istream-jsonstr - Fix potential infinite loop if parent stream's max_buffer_size...
Timo Sirainen [Thu, 2 Nov 2017 21:24:38 +0000 (23:24 +0200)] 
lib: istream-jsonstr - Fix potential infinite loop if parent stream's max_buffer_size is tiny

7 years agoglobal: i_stream_read_memarea() - Remove impossible ret==-2 checks
Timo Sirainen [Thu, 2 Nov 2017 21:22:14 +0000 (23:22 +0200)] 
global: i_stream_read_memarea() - Remove impossible ret==-2 checks

If the stream's buffer is empty, i_stream_read_memarea() would have already
assert-crashed at this point.

7 years agoimap, pop3: Don't access login_set.*_socket_path after they're freed from data stack
Timo Sirainen [Thu, 2 Nov 2017 21:01:20 +0000 (23:01 +0200)] 
imap, pop3: Don't access login_set.*_socket_path after they're freed from data stack

Call master_login_init() before master_service_init_finish(), which frees
all the data stack done in initialization.

This didn't normally cause any visible problems, because data stack wasn't
currently being used in a way that the strings were invalidated. However,
it was causing failures if --enable-devel-checks was used.

7 years agoconfig: Properly fix ssl-parameters.dat handling
Aki Tuomi [Thu, 2 Nov 2017 13:45:09 +0000 (15:45 +0200)] 
config: Properly fix ssl-parameters.dat handling

It was done only partially right in a70d867d1fe3584149811c65eb6213deb72be824

7 years agologin-common: client_unref() - always set client pointer to NULL
Timo Sirainen [Wed, 1 Nov 2017 19:44:54 +0000 (21:44 +0200)] 
login-common: client_unref() - always set client pointer to NULL

This is the common coding practise elsewhere as well.

7 years agopop3-login: Cleanup - uncork output unconditionally before client_unref()
Timo Sirainen [Wed, 1 Nov 2017 19:44:23 +0000 (21:44 +0200)] 
pop3-login: Cleanup - uncork output unconditionally before client_unref()

7 years agologin-common: Remove unnecessary client_ref/unref from STARTTLS handling
Timo Sirainen [Wed, 1 Nov 2017 19:41:18 +0000 (21:41 +0200)] 
login-common: Remove unnecessary client_ref/unref from STARTTLS handling

There used to be code between them that could have destroyed the connection,
but that was removed long time ago.

7 years agodoveadm: Send hostname without ":port" as TLS SNI name for outgoing SSL connections.
Timo Sirainen [Tue, 31 Oct 2017 21:51:53 +0000 (23:51 +0200)] 
doveadm: Send hostname without ":port" as TLS SNI name for outgoing SSL connections.

7 years agoconfig: Do not run ssl_dh check always
Aki Tuomi [Thu, 2 Nov 2017 10:00:42 +0000 (12:00 +0200)] 
config: Do not run ssl_dh check always

Do it only when CONFIG_DUMP_FLAG_CHECK_SETTINGS is set. Fixes

"Warning: You can generate it with: dd if=ssl-parameters.dat bs=1 skip=88..."

7 years agodict-redis: Include last_reply in communications failure error
Aki Tuomi [Mon, 3 Jul 2017 08:17:16 +0000 (11:17 +0300)] 
dict-redis: Include last_reply in communications failure error

This way it's possible to determine what went wrong.

7 years agodict-redis: Added support for authentication.
Timo Sirainen [Fri, 24 Jun 2016 09:09:31 +0000 (12:09 +0300)] 
dict-redis: Added support for authentication.

Patch by David Zambonini

7 years agolib: i_stream_w_buffer_realloc() - avoid passing NULL to memcpy()
Timo Sirainen [Wed, 1 Nov 2017 23:34:11 +0000 (01:34 +0200)] 
lib: i_stream_w_buffer_realloc() - avoid passing NULL to memcpy()

It happened only with size=0, so it shouldn't have mattered much.

7 years agoimap-proxy: Don't discard the first pipelined command after LOGIN
Timo Sirainen [Wed, 1 Nov 2017 22:03:57 +0000 (00:03 +0200)] 
imap-proxy: Don't discard the first pipelined command after LOGIN

7 years agolib-storage: imapc - Fix spelling mistakes
Aki Tuomi [Wed, 1 Nov 2017 17:10:19 +0000 (19:10 +0200)] 
lib-storage: imapc - Fix spelling mistakes

Original work by @jsoref

7 years agolib-fs: Fix spelling mistakes
Aki Tuomi [Wed, 1 Nov 2017 17:10:07 +0000 (19:10 +0200)] 
lib-fs: Fix spelling mistakes

Original work by @jsoref

7 years agotest-quota: Fix spelling mistakes
Aki Tuomi [Wed, 1 Nov 2017 17:09:55 +0000 (19:09 +0200)] 
test-quota: Fix spelling mistakes

Original work by @jsoref

7 years agolazy-expunge: Fix spelling mistakes
Aki Tuomi [Wed, 1 Nov 2017 17:09:43 +0000 (19:09 +0200)] 
lazy-expunge: Fix spelling mistakes

Original work by @jsoref

7 years agoplugin-fts: Fix spelling mistakes
Aki Tuomi [Wed, 1 Nov 2017 17:09:28 +0000 (19:09 +0200)] 
plugin-fts: Fix spelling mistakes

Original work by @jsoref

7 years agofts-squat: Fix spelling mistakes
Aki Tuomi [Wed, 1 Nov 2017 17:09:15 +0000 (19:09 +0200)] 
fts-squat: Fix spelling mistakes

Original work by @jsoref

7 years agoimap: Fix spelling mistakes
Aki Tuomi [Wed, 1 Nov 2017 17:09:04 +0000 (19:09 +0200)] 
imap: Fix spelling mistakes

Original work by @jsoref

7 years agodirector: Fix spelling mistakes
Aki Tuomi [Wed, 1 Nov 2017 17:08:54 +0000 (19:08 +0200)] 
director: Fix spelling mistakes

Original work by @jsoref

7 years agomech-apop: Fix spelling mistake
Aki Tuomi [Wed, 1 Nov 2017 17:08:40 +0000 (19:08 +0200)] 
mech-apop: Fix spelling mistake

Original work by @jsoref

7 years agoman: Fix spelling mistakes
Aki Tuomi [Wed, 1 Nov 2017 17:08:30 +0000 (19:08 +0200)] 
man: Fix spelling mistakes

Original work by @jsoref

7 years agoglobal: Fix spelling mistakes in comments
Aki Tuomi [Wed, 1 Nov 2017 17:07:26 +0000 (19:07 +0200)] 
global: Fix spelling mistakes in comments

Original work by @andreasschulze and @jsoref

7 years agofts-lucene: Do not clobber return value
Aki Tuomi [Wed, 1 Nov 2017 16:04:57 +0000 (18:04 +0200)] 
fts-lucene: Do not clobber return value

Found by scanbuild

7 years agodirector: Show each director connection in doveadm DIRECTOR-LIST
Timo Sirainen [Thu, 26 Oct 2017 10:56:25 +0000 (13:56 +0300)] 
director: Show each director connection in doveadm DIRECTOR-LIST

Previously the host was shown only once, regardless of how many connections
it had. This especially helps when there are just two directors, but also
can be useful when showing incoming/outgoing connections that are still
in handshaking phase.

7 years agodoveadm director ring status: Add more fields related to connection status
Timo Sirainen [Thu, 26 Oct 2017 11:10:51 +0000 (14:10 +0300)] 
doveadm director ring status: Add more fields related to connection status

7 years agodirector: Track show long the last ring sync took.
Timo Sirainen [Thu, 26 Oct 2017 11:18:50 +0000 (14:18 +0300)] 
director: Track show long the last ring sync took.

7 years agodirector: Track connections' last ping time
Timo Sirainen [Thu, 26 Oct 2017 11:07:56 +0000 (14:07 +0300)] 
director: Track connections' last ping time

7 years agodirector: Add director_connection_get_status()
Timo Sirainen [Thu, 26 Oct 2017 10:07:30 +0000 (13:07 +0300)] 
director: Add director_connection_get_status()

Can be used to access connection-specific status information.

7 years agodirector: Fix updating director connection's last_output timestamp
Timo Sirainen [Thu, 26 Oct 2017 10:02:32 +0000 (13:02 +0300)] 
director: Fix updating director connection's last_output timestamp

It was previously updated only in ostream's flush callback, which was called
only when there were a lot of output. This only caused the "last output"
timestamp in disconnection log lines to be wrong.

7 years agodoveadm director: Parse timestamp parameters with str_to_time()
Timo Sirainen [Thu, 26 Oct 2017 09:44:34 +0000 (12:44 +0300)] 
doveadm director: Parse timestamp parameters with str_to_time()

7 years agodirector: Close director connection immediately when output buffer is full
Timo Sirainen [Wed, 25 Oct 2017 14:22:42 +0000 (17:22 +0300)] 
director: Close director connection immediately when output buffer is full

Only the ostream was closed, which didn't actually cause the disconnection
until the other side closed the connection.

7 years agodirector: Add director_output_buffer_size setting
Timo Sirainen [Wed, 25 Oct 2017 14:18:03 +0000 (17:18 +0300)] 
director: Add director_output_buffer_size setting

This allows configuring the max buffer size for outgoing connections.
Previously it was hardcoded to 10 MB, which wasn't necessarily enough for
very busy directors.

7 years agolib-ssl-iostream: Verify SSL server's hostname against cert if it's non-NULL
Timo Sirainen [Tue, 31 Oct 2017 21:37:44 +0000 (23:37 +0200)] 
lib-ssl-iostream: Verify SSL server's hostname against cert if it's non-NULL

The hostname verification was skipped when handshake-callback wasn't used.
All of the existing code used the callback though, so this doesn't fix
any bugs.

7 years agolib-ssl-iostream: Fix checking cert validity when handshake callback isn't used
Timo Sirainen [Tue, 31 Oct 2017 17:49:56 +0000 (19:49 +0200)] 
lib-ssl-iostream: Fix checking cert validity when handshake callback isn't used

7 years agolib-ssl-iostream: Split host to connected_host and sni_host
Timo Sirainen [Wed, 1 Nov 2017 10:58:46 +0000 (12:58 +0200)] 
lib-ssl-iostream: Split host to connected_host and sni_host

Using the same variable for both was causing confusion.

7 years agoglobal: start relying on [io]_stream_close(NULL) being a no-op
Josef 'Jeff' Sipek [Fri, 22 Sep 2017 08:38:10 +0000 (11:38 +0300)] 
global: start relying on [io]_stream_close(NULL) being a no-op

Cleanup performed with the following semantic patch (and a bit of
hand-editing):

@@
expression E;
@@

- if (E != NULL) {
-  i_stream_close(E);
- }
+ i_stream_close(E);

@@
expression E;
@@

- if (E != NULL) {
-  o_stream_close(E);
- }
+ o_stream_close(E);

7 years agolib: [io]_stream_close(NULL) should be no-ops
Josef 'Jeff' Sipek [Fri, 22 Sep 2017 08:29:35 +0000 (11:29 +0300)] 
lib: [io]_stream_close(NULL) should be no-ops

7 years agolib-index: Fix -Wstrict-bool warnings with --enable-devel-checks
Timo Sirainen [Wed, 1 Nov 2017 12:40:51 +0000 (14:40 +0200)] 
lib-index: Fix -Wstrict-bool warnings with --enable-devel-checks

7 years agoglobal: Use i_stream_read_memarea() wherever possible
Timo Sirainen [Fri, 27 Oct 2017 18:20:36 +0000 (21:20 +0300)] 
global: Use i_stream_read_memarea() wherever possible

7 years agolib: i_stream_compress() - assert-crash if trying to compress shared memarea
Timo Sirainen [Fri, 27 Oct 2017 18:32:10 +0000 (21:32 +0300)] 
lib: i_stream_compress() - assert-crash if trying to compress shared memarea

The caller is always expected to check the refcount before calling this.

7 years agolib: i_stream_read() - Add buffer validity checks if DEBUG is enabled
Timo Sirainen [Fri, 27 Oct 2017 18:22:04 +0000 (21:22 +0300)] 
lib: i_stream_read() - Add buffer validity checks if DEBUG is enabled

7 years agolib: i_stream_read() - Use snapshots
Timo Sirainen [Fri, 27 Oct 2017 18:17:23 +0000 (21:17 +0300)] 
lib: i_stream_read() - Use snapshots

This guarantees that data returned by i_stream_get_data() won't be freed
until the next i_stream_read() returns >0. This is mainly important,
because often the error handling for <=0 doesn't update the buffer
pointers correctly and it leads to complicated bugs where already freed
memory is attempted to be read (but never written).

7 years agolib: Use ISTREAM_CREATE_FLAG_NOOP_SNAPSHOT where useful
Timo Sirainen [Fri, 27 Oct 2017 18:13:40 +0000 (21:13 +0300)] 
lib: Use ISTREAM_CREATE_FLAG_NOOP_SNAPSHOT where useful

7 years agolib: Add ISTREAM_CREATE_FLAG_NOOP_SNAPSHOT flag
Timo Sirainen [Fri, 27 Oct 2017 18:13:20 +0000 (21:13 +0300)] 
lib: Add ISTREAM_CREATE_FLAG_NOOP_SNAPSHOT flag

7 years agoglobal: Add flags parameter to i_stream_create() and set it to 0
Timo Sirainen [Fri, 27 Oct 2017 18:08:26 +0000 (21:08 +0300)] 
global: Add flags parameter to i_stream_create() and set it to 0

This just changes the API - the following changes add the new flag.

7 years agolib-ssl-iostream: Simplify istream-openssl
Timo Sirainen [Fri, 27 Oct 2017 18:28:51 +0000 (21:28 +0300)] 
lib-ssl-iostream: Simplify istream-openssl

Partially reverts 739125f23e3312045e620014812fe2249a309cc4. This is no
longer needed because of the io_set_pending() changes.

7 years agolib-compression: Use i_stream_try_alloc*()
Timo Sirainen [Fri, 27 Oct 2017 17:49:07 +0000 (20:49 +0300)] 
lib-compression: Use i_stream_try_alloc*()

7 years agolib: Add i_stream_try_alloc_avoid_compress()
Timo Sirainen [Fri, 27 Oct 2017 17:45:41 +0000 (20:45 +0300)] 
lib: Add i_stream_try_alloc_avoid_compress()

7 years agolib-compression: istream-lz4 - Use i_stream_alloc()
Timo Sirainen [Fri, 27 Oct 2017 17:38:49 +0000 (20:38 +0300)] 
lib-compression: istream-lz4 - Use i_stream_alloc()

7 years agolib-mail: istream-attachment-extractor - Don't modify buffer during failure
Timo Sirainen [Thu, 26 Oct 2017 15:36:09 +0000 (18:36 +0300)] 
lib-mail: istream-attachment-extractor - Don't modify buffer during failure

If i_stream_read() returns -1 because the attachment file couldn't be
created, don't add the trailing data to the main istream. It's not useful,
and the following extra checks will cause it to assert-crash.

7 years agolib: istream-mmap - Use memarea API
Timo Sirainen [Fri, 8 Sep 2017 11:59:37 +0000 (14:59 +0300)] 
lib: istream-mmap - Use memarea API