]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
9 years agodirector: Code cleanup - move enum user_kill_state to director.h
Timo Sirainen [Thu, 20 Oct 2016 13:41:23 +0000 (16:41 +0300)] 
director: Code cleanup - move enum user_kill_state to director.h

This will be needed by following commits

9 years agolib-lda: Add back subject sanitization to mail sending.
Timo Sirainen [Tue, 25 Oct 2016 20:47:13 +0000 (23:47 +0300)] 
lib-lda: Add back subject sanitization to mail sending.

Broken by acfda38b75d0f0e899ef692fef01593bd56ed85e

9 years agodirector: Fix HOST-RESET-USERS with host parameter.
Timo Sirainen [Tue, 25 Oct 2016 18:20:54 +0000 (21:20 +0300)] 
director: Fix HOST-RESET-USERS with host parameter.

The logic was reversed: It should flush the specified host, not some other
host. Broken by 11ee3b40320a31669bd717fecbe1e332dad4fd84

9 years agodoveadm director dump: Fixed output to include LFs
Timo Sirainen [Mon, 24 Oct 2016 22:03:05 +0000 (01:03 +0300)] 
doveadm director dump: Fixed output to include LFs

Otherwise all the output will be mixed up in the same line.

9 years agodirector: Execute director_flush_socket only from one director.
Timo Sirainen [Mon, 24 Oct 2016 21:48:08 +0000 (00:48 +0300)] 
director: Execute director_flush_socket only from one director.

Having each director do it would be redundant since they're all supposed to
be performing the same flush task to the same backend.

9 years agodirector: Improve debug logging output.
Timo Sirainen [Mon, 24 Oct 2016 21:32:59 +0000 (00:32 +0300)] 
director: Improve debug logging output.

9 years agodirector: Fix user move hangs when another move is triggered early.
Timo Sirainen [Mon, 24 Oct 2016 21:25:38 +0000 (00:25 +0300)] 
director: Fix user move hangs when another move is triggered early.

Running "doveadm director flush" before the previous flush hadn't fully
finished could have caused users to hang until their move timeout:

director: Error: Finishing user 3249070169 move timed out, its state may now be inconsistent (state=waiting-for-everyone)

9 years agodirector: Prevent race conditions by adding USER_KILL_STATE_FLUSHING
Timo Sirainen [Mon, 24 Oct 2016 21:22:20 +0000 (00:22 +0300)] 
director: Prevent race conditions by adding USER_KILL_STATE_FLUSHING

In theory it's possible that a user is freed during a flush and added back
before flush is finished, possibly even being moved again. This check makes
sure that we don't finish such move unless we're actually at the correct
flushing state. (If there's another flush also running for the user it'll
be ignored.)

This is also useful for logging purposes.

9 years agodirector: If user host conflict is detected, make sure new host is sent back.
Timo Sirainen [Mon, 24 Oct 2016 21:13:23 +0000 (00:13 +0300)] 
director: If user host conflict is detected, make sure new host is sent back.

USER-KICK-HASH was sent, but the sender didn't get back a USER reply with
the new host. This could have increased how long user's host differred in
directors.

Avoids repeating this error:
Error: User hash 2957018085 is being redirected to two hosts: 10.0.0.30 and 10.0.0.201 (old_ts=1477338836)

9 years agodoveadm director flush: Added --max-parallel parameter.
Timo Sirainen [Mon, 24 Oct 2016 19:42:43 +0000 (22:42 +0300)] 
doveadm director flush: Added --max-parallel parameter.

9 years agodirector: HOST-RESET-USERS moves users more slowly now.
Timo Sirainen [Mon, 24 Oct 2016 19:41:25 +0000 (22:41 +0300)] 
director: HOST-RESET-USERS moves users more slowly now.

By default only 100 users can be moved in parallel. This can be overridden
with HOST-RESET-USERS parameter.

This delaying is especially useful when director_flush_socket is used to
avoid huge floods to the script service. Even without the socket it's still
good for avoiding unnecessary load spikes when all users are kicked at once
and they reconnect back at the same time.

9 years agodirector: If user move times out, log the state it was in at the time.
Timo Sirainen [Mon, 24 Oct 2016 21:11:50 +0000 (00:11 +0300)] 
director: If user move times out, log the state it was in at the time.

9 years agodirector: Log user's kill_state with a human-readable string.
Timo Sirainen [Mon, 24 Oct 2016 19:39:56 +0000 (22:39 +0300)] 
director: Log user's kill_state with a human-readable string.

9 years agodoveadm director: Invalid parameters cause doveadm to fail silently.
Timo Sirainen [Mon, 24 Oct 2016 19:27:30 +0000 (22:27 +0300)] 
doveadm director: Invalid parameters cause doveadm to fail silently.

doveadm_cmd_context.cmd doesn't point directly to doveadm_cmd_director.

9 years agodirector: Fix sending up/down state in handshakes.
Timo Sirainen [Mon, 24 Oct 2016 19:22:28 +0000 (22:22 +0300)] 
director: Fix sending up/down state in handshakes.

They were never sent, because HOSTs were sent before director had waited for
the remote to send its version number. So sender thought that the remote's
minor_version was too old and it didn't send the up/down state at all.

This caused errors like:

Warning: director(10.0.0.30:9090/left): Host 10.0.0.30 is being updated before previous update had finished (up -> down) - setting to state=down vhosts=100
Error: director(10.0.0.30:9090/left): Director 10.0.0.30 SYNC request hosts don't match us - resending hosts (seq=6, remote hosts_hash=262126213, my hosts_hash=2458934259)

9 years agodirector: If SYNCs are received during handshake, send them later.
Timo Sirainen [Mon, 24 Oct 2016 18:58:03 +0000 (21:58 +0300)] 
director: If SYNCs are received during handshake, send them later.

This fixes delays during handshake:
Error: Ring SYNC appears to have got lost, resending

9 years agodirector: Code cleanup - Give tab-unescaped args to all doveadm command handlers.
Timo Sirainen [Mon, 24 Oct 2016 17:21:36 +0000 (20:21 +0300)] 
director: Code cleanup - Give tab-unescaped args to all doveadm command handlers.

9 years agodirector: USER-MOVE didn't handle non-hash username correctly.
Timo Sirainen [Mon, 24 Oct 2016 17:20:09 +0000 (20:20 +0300)] 
director: USER-MOVE didn't handle non-hash username correctly.

The entire command line was being hashed instead of just the username.

9 years agodirector: Make sure IP address parsing works in DIRECTOR-ADD/REMOVE
Timo Sirainen [Mon, 24 Oct 2016 17:16:57 +0000 (20:16 +0300)] 
director: Make sure IP address parsing works in DIRECTOR-ADD/REMOVE

We were passing the entire string through to net_addr2ip(). It seems that
inet_aton() stops at whitespace though, so this wasn't actually causing
errors at least on Linux.

9 years agodirector: Code cleanup - moved command handling to its own function.
Timo Sirainen [Mon, 24 Oct 2016 17:08:54 +0000 (20:08 +0300)] 
director: Code cleanup - moved command handling to its own function.

9 years agodirector: Show in process title how many users are being moved.
Timo Sirainen [Mon, 24 Oct 2016 17:07:26 +0000 (20:07 +0300)] 
director: Show in process title how many users are being moved.

9 years agodirector: Code cleanup - Finish user move always in the same function.
Timo Sirainen [Mon, 24 Oct 2016 17:00:40 +0000 (20:00 +0300)] 
director: Code cleanup - Finish user move always in the same function.

9 years agodirector: Call state_change_callback on user move timeout.
Timo Sirainen [Mon, 24 Oct 2016 16:59:54 +0000 (19:59 +0300)] 
director: Call state_change_callback on user move timeout.

9 years agodirector: Code cleanup - allow commands handlers to stop processing input
Timo Sirainen [Fri, 21 Oct 2016 09:50:56 +0000 (12:50 +0300)] 
director: Code cleanup - allow commands handlers to stop processing input

Now returning 0 exits the input reading without disconnecting client.

9 years agolib-mail: Add tests for dec/hexdec encoded entities
Aki Tuomi [Tue, 25 Oct 2016 10:27:29 +0000 (13:27 +0300)] 
lib-mail: Add tests for dec/hexdec encoded entities

9 years agolib-mail: Support decimal/hexadecimal encoded entities
Aki Tuomi [Tue, 25 Oct 2016 09:48:23 +0000 (12:48 +0300)] 
lib-mail: Support decimal/hexadecimal encoded entities

Add support for &#nnn; and &#xnnn; entities.

9 years agoimap-login: Skip NIL value in ID handler
Aki Tuomi [Tue, 25 Oct 2016 07:29:50 +0000 (10:29 +0300)] 
imap-login: Skip NIL value in ID handler

NIL value can cause hard crash, depending what
the key is. For x-proxy-ttl, NIL will crash
on any system, x-originating-ip will crash on
some nss versions (e.g. centos 6.7).

Migitating factor here is that the NIL value is only
accepted from trusted network.

9 years agolib-compression: Added unit tests for reading .gz files
Timo Sirainen [Mon, 24 Oct 2016 15:52:24 +0000 (18:52 +0300)] 
lib-compression: Added unit tests for reading .gz files

9 years agolib-compression: Added file uncompression support for test-compression
Timo Sirainen [Mon, 24 Oct 2016 15:31:53 +0000 (18:31 +0300)] 
lib-compression: Added file uncompression support for test-compression

This can be useful for debugging.

9 years agolib-compress: Don't assume too early that gz file continues after a trailer.
Timo Sirainen [Mon, 24 Oct 2016 15:29:06 +0000 (18:29 +0300)] 
lib-compress: Don't assume too early that gz file continues after a trailer.

Some istreams don't have EOF immediately set after the gz trailer. This
fixes errors like "missing gz trailer at 1675"

9 years agoistream-zlib: "missing gz trailer" error message was wrong.
Timo Sirainen [Mon, 24 Oct 2016 14:15:00 +0000 (17:15 +0300)] 
istream-zlib: "missing gz trailer" error message was wrong.

9 years agolib: With FILE_LOCK_SLOW_WARNING_MSECS log a warning also when keeping lock for long.
Timo Sirainen [Mon, 24 Oct 2016 12:59:07 +0000 (15:59 +0300)] 
lib: With FILE_LOCK_SLOW_WARNING_MSECS log a warning also when keeping lock for long.

This can help catching which process kept the lock for too long.

9 years agoconfigure: Fixed checking if OpenSSL is too old for lib-dcrypt
Timo Sirainen [Mon, 24 Oct 2016 13:01:43 +0000 (16:01 +0300)] 
configure: Fixed checking if OpenSSL is too old for lib-dcrypt

EVP_PKEY_CTX_set_ec_paramgen_curve_nid() is a macro, so it can't be checked
with AC_CHECK_LIB().

9 years agolib: Fix compiler warnings in test-ioloop
Timo Sirainen [Mon, 24 Oct 2016 13:05:00 +0000 (16:05 +0300)] 
lib: Fix compiler warnings in test-ioloop

Fixes:
test-ioloop.c:72: error: ignoring return value of ‘write’, declared with attribute warn_unused_result

9 years agolib-http: Add ioloop and lock wait information to timeout messages.
Timo Sirainen [Mon, 24 Oct 2016 10:08:47 +0000 (13:08 +0300)] 
lib-http: Add ioloop and lock wait information to timeout messages.

It'll now log for example:
9007 Request timed out (Request sent 7.087 secs ago, 0.076 in other ioloops, 7.012 in locks, connected 7.087 secs ago)

Which points out that the problem wasn't really with the HTTP, but with
locking. This likely should be fixed in some way also in lib-http so that
it gives a bit of extra time for reading the request, but that's a separate
fix.

9 years agodict-client: Fix logging how much time was spent in other ioloops in slow lookup...
Timo Sirainen [Mon, 24 Oct 2016 09:17:44 +0000 (12:17 +0300)] 
dict-client: Fix logging how much time was spent in other ioloops in slow lookup warnings.

The warning's idea is to show why the lookup could have been slow. We
differentiate between time spent in dict_wait() waiting only for the
dict result and time spent in other ioloops waiting for potentially other
things as well (and time spent waiting for locks during this time).

The previous code didn't work right when multiple ioloops were used, which
happened sometimes.

Also changed %u to %d just in case some calculation is wrong. It's nicer to
get a slightly negative value rather than a huge positive one.

9 years agolib: Added ioloop_global_wait_usecs
Timo Sirainen [Mon, 24 Oct 2016 09:16:48 +0000 (12:16 +0300)] 
lib: Added ioloop_global_wait_usecs

This is helpful when multiple ioloops aren't used and
io_loop_get_wait_usecs() can't be easily used for all of them.

9 years agolib: Add FILE_LOCK_SLOW_WARNING_MSECS environment.
Timo Sirainen [Mon, 24 Oct 2016 11:05:58 +0000 (14:05 +0300)] 
lib: Add FILE_LOCK_SLOW_WARNING_MSECS environment.

Log a warning if any locking takes longer than the specified number of
milliseconds. This can be enabled globally with:

import_environment = $import_environment FILE_LOCK_SLOW_WARNING_MSECS=1000

9 years agolib-index: Fix potential error when reading from uncommitted cache transaction
Timo Sirainen [Mon, 24 Oct 2016 10:28:44 +0000 (13:28 +0300)] 
lib-index: Fix potential error when reading from uncommitted cache transaction

If dovecot.index.cache is compressed during the transaction, the new cache
fields mapping doesn't necessarily match what is in the transaction.

Fixes:
Error: Corrupted index cache file .../dovecot.index.cache: field index too large (27 >= 17)

Although there may be other cache corruption errors it also fixes.

9 years agolib-index: Fix potential assert-crash when reading cache
Timo Sirainen [Mon, 24 Oct 2016 09:25:48 +0000 (12:25 +0300)] 
lib-index: Fix potential assert-crash when reading cache

Fixes:
Panic: file mail-cache-lookup.c: line 258 (mail_cache_lookup_iter_next): assertion failed: (ctx->offset != 0)

Broken by d33fc6c584718efd46159e1d8f46488b9dfc66f5

9 years agomaster: If chrooted service's core wasn't dumped, suggest to unset the chroot.
Timo Sirainen [Mon, 24 Oct 2016 09:23:49 +0000 (12:23 +0300)] 
master: If chrooted service's core wasn't dumped, suggest to unset the chroot.

9 years agolib: Add test for ioloop fd polling
Aki Tuomi [Mon, 24 Oct 2016 08:34:05 +0000 (11:34 +0300)] 
lib: Add test for ioloop fd polling

9 years agolib: Fix kqueue io_loop_get_wait_time usage
Aki Tuomi [Mon, 24 Oct 2016 07:13:42 +0000 (10:13 +0300)] 
lib: Fix kqueue io_loop_get_wait_time usage

The code needs to take into consideration,
when there is no IO to be waited, but possibly
there is io_set_pending used, or just timeouts.

9 years agolib: Ensure tv_r gets set in io_loop_get_wait_time
Aki Tuomi [Mon, 24 Oct 2016 07:08:42 +0000 (10:08 +0300)] 
lib: Ensure tv_r gets set in io_loop_get_wait_time

If this does not get reset here to 0 it can cause
errors or unpredictable behaviour in select/kqueue
polling, such as very long delays.

9 years agodirector: Fix crash handling director_flush_socket when user is freed.
Timo Sirainen [Sat, 22 Oct 2016 19:45:48 +0000 (22:45 +0300)] 
director: Fix crash handling director_flush_socket when user is freed.

9 years agodirector: Support flush socket
Aki Tuomi [Thu, 13 Oct 2016 13:11:48 +0000 (16:11 +0300)] 
director: Support flush socket

This allows specifying an URI to execute
on user kill. It can be of form
exec:/path/to/bin, unix:/path/to/socket or
tcp:ip:port

The location is sent FLUSH username-hash
per killed user. You can execute some
action there, and you are expected to
return '+\nOK\n' as reply once you are
done.

9 years agoconfigure: Improved checking if OpenSSL is too old for lib-dcrypt
Timo Sirainen [Sat, 22 Oct 2016 10:00:08 +0000 (13:00 +0300)] 
configure: Improved checking if OpenSSL is too old for lib-dcrypt

Some OpenSSL versions had EC_KEY_new, but not other needed functions.

9 years agoprogram-client-unix: Don't retry connecting to UNIX socket.
Timo Sirainen [Fri, 21 Oct 2016 11:58:57 +0000 (14:58 +0300)] 
program-client-unix: Don't retry connecting to UNIX socket.

Especially with async connections this will just block the whole process
when there are errors.

9 years agodirector: Fix shutdown_clients=no to not break
Timo Sirainen [Fri, 21 Oct 2016 11:34:47 +0000 (14:34 +0300)] 
director: Fix shutdown_clients=no to not break

The director process must shut down even with with shutdown_clients=no.
Otherwise the two director processes will try to keep competing with each
others and log errors like:

director: Warning: Director 10.0.0.123:9090/right disconnected us with reason: Replacing with new incoming connection
director: Warning: Director 10.0.0.123:9090/right disconnected us with reason: Replacing with 10.0.0.124:9090

9 years agodoveadm: Rewind input early enough
Aki Tuomi [Fri, 21 Oct 2016 10:55:42 +0000 (13:55 +0300)] 
doveadm: Rewind input early enough

Command input needs to be rewinded earlier
in doveadm_mail_next_user.

9 years agolib-program-client: Change program_client_create() API to return error string.
Timo Sirainen [Fri, 21 Oct 2016 08:05:23 +0000 (11:05 +0300)] 
lib-program-client: Change program_client_create() API to return error string.

9 years agoimap-hibernate: Fix "DONE" handling.
Timo Sirainen [Thu, 20 Oct 2016 21:25:20 +0000 (00:25 +0300)] 
imap-hibernate: Fix "DONE" handling.

1. If only "DONE\r\n" was sent, it randomly failed with BAD because of
out-of-bounds buffer read.

2. If "DONE\r\n" was followed by a command tag but no space afterwards, we
kept waiting for the input to continue. But since the DONE was already sent,
we should break the IDLE already at that point without any further waiting.

9 years agolib: Added unit tests for string tabescaping.
Timo Sirainen [Thu, 20 Oct 2016 15:09:09 +0000 (18:09 +0300)] 
lib: Added unit tests for string tabescaping.

9 years agoglobal: Replaced t_strsplit_tab() calls with t_strsplit_tabescaped()
Timo Sirainen [Thu, 20 Oct 2016 14:45:44 +0000 (17:45 +0300)] 
global: Replaced t_strsplit_tab() calls with t_strsplit_tabescaped()

This is useful especially in auth code to support LFs in extra fields.

Other pieces of code were also tab-escaping strings, but never unescaping
them. Usually it didn't matter, because nobody would use the escaped
characters. Still, the code wasn't exactly behaving correctly.

One downside to this change is that it's now possible to pass through TABs,
CRs and LFs through the various protocols. In theory this shouldn't cause
any problems, but combined with other bugs this could trigger some security
problems.

9 years agoglobal: Code cleanup - Use t_strsplit_tabescaped() to avoid str_tabunescape()
Timo Sirainen [Thu, 20 Oct 2016 14:21:59 +0000 (17:21 +0300)] 
global: Code cleanup - Use t_strsplit_tabescaped() to avoid str_tabunescape()

9 years agoglobal: Try to initialize var_expand_tab[] directly.
Timo Sirainen [Thu, 20 Oct 2016 09:39:27 +0000 (12:39 +0300)] 
global: Try to initialize var_expand_tab[] directly.

This avoids accidents with the array numbering being wrong.

9 years agoglobal: Use i_strchr_to_next() wherever useful.
Timo Sirainen [Thu, 20 Oct 2016 09:08:15 +0000 (12:08 +0300)] 
global: Use i_strchr_to_next() wherever useful.

9 years agolib: Added i_strchr_to_next()
Timo Sirainen [Thu, 20 Oct 2016 09:08:09 +0000 (12:08 +0300)] 
lib: Added i_strchr_to_next()

9 years agopop3: Fix pop3_logout_format=%{deleted_size} expansion when there are no deletions
Timo Sirainen [Thu, 20 Oct 2016 09:24:44 +0000 (12:24 +0300)] 
pop3: Fix pop3_logout_format=%{deleted_size} expansion when there are no deletions

Should be "0", not empty string.

9 years ago%{auth_domain} shouldn't include the leading '@'
Timo Sirainen [Thu, 20 Oct 2016 09:06:25 +0000 (12:06 +0300)] 
%{auth_domain} shouldn't include the leading '@'

9 years agolib-ldap: Fixed compiling with OpenBSD
Timo Sirainen [Thu, 20 Oct 2016 15:31:27 +0000 (18:31 +0300)] 
lib-ldap: Fixed compiling with OpenBSD

9 years agoauth: Escape local_name
Aki Tuomi [Thu, 20 Oct 2016 13:30:49 +0000 (16:30 +0300)] 
auth: Escape local_name

9 years agologin-common: Include local_name in login_var_expand_table
Aki Tuomi [Thu, 20 Oct 2016 13:06:27 +0000 (16:06 +0300)] 
login-common: Include local_name in login_var_expand_table

This way it can be used in login_log_format

9 years agolib-storage: Fixed a boolean expression.
Stephan Bosch [Thu, 20 Oct 2016 13:54:40 +0000 (15:54 +0200)] 
lib-storage: Fixed a boolean expression.

Problem found with clang -Wstrict-bool.

9 years agolib-program-client: Fixed boolean expressions.
Stephan Bosch [Thu, 20 Oct 2016 13:46:01 +0000 (15:46 +0200)] 
lib-program-client: Fixed boolean expressions.

Problems found with clang -Wstrict-bool.

9 years agolib-program-client: Gave variables pointing to a program-client more logical names.
Stephan Bosch [Thu, 20 Oct 2016 13:41:54 +0000 (15:41 +0200)] 
lib-program-client: Gave variables pointing to a program-client more logical names.

Was still based on when it was called the script-client.

9 years agoauth: Fixed assert-crash on invalid auth-client input
Timo Sirainen [Thu, 20 Oct 2016 13:30:58 +0000 (16:30 +0300)] 
auth: Fixed assert-crash on invalid auth-client input

For example if client sends invalid input like:
auth: Error: BUG: Authentication client sent unknown command: XYZ

Fixes crash:
auth: Panic: key not found from hash

9 years agodovecot-config: Added dovecot_statedir
Timo Sirainen [Thu, 20 Oct 2016 11:23:20 +0000 (14:23 +0300)] 
dovecot-config: Added dovecot_statedir

9 years agoAdded "doveadm process status"
Timo Sirainen [Thu, 20 Oct 2016 10:30:36 +0000 (13:30 +0300)] 
Added "doveadm process status"

This allows asking for processes' current status in master process.

9 years agoAdded "doveadm service status"
Timo Sirainen [Thu, 20 Oct 2016 10:12:34 +0000 (13:12 +0300)] 
Added "doveadm service status"

This allows asking for services' current status in master process.

9 years agodoveadm-master: Code cleanup - simplify sending command args to master.
Timo Sirainen [Thu, 20 Oct 2016 10:22:47 +0000 (13:22 +0300)] 
doveadm-master: Code cleanup - simplify sending command args to master.

This also escapes the parameters to make sure nothing bad can be sent.

9 years agodoveadm service stop: Convert to doveadm v2 API
Timo Sirainen [Thu, 20 Oct 2016 10:11:19 +0000 (13:11 +0300)] 
doveadm service stop: Convert to doveadm v2 API

9 years agodoveadm service stop: Code cleanup - Prepare for other service commands.
Timo Sirainen [Thu, 20 Oct 2016 10:10:56 +0000 (13:10 +0300)] 
doveadm service stop: Code cleanup - Prepare for other service commands.

9 years agodoveadm service stop: Moved command handling to doveadm-master.c
Timo Sirainen [Thu, 20 Oct 2016 10:09:09 +0000 (13:09 +0300)] 
doveadm service stop: Moved command handling to doveadm-master.c

It's talking to master process, and there will be other non-service commands
that talk to the master process in the same way.

9 years agodoveadm user: If lookup fails, don't write it to the same line as header.
Timo Sirainen [Tue, 11 Oct 2016 09:43:20 +0000 (12:43 +0300)] 
doveadm user: If lookup fails, don't write it to the same line as header.

9 years agodoveadm-server: Show incoming connection's IP and running command is process title.
Timo Sirainen [Wed, 19 Oct 2016 18:49:30 +0000 (21:49 +0300)] 
doveadm-server: Show incoming connection's IP and running command is process title.

9 years agoauth: Pass local_name to auth-request
Aki Tuomi [Mon, 17 Oct 2016 21:37:32 +0000 (00:37 +0300)] 
auth: Pass local_name to auth-request

This allows using local_name in various places,
such as passdb/userdb queries.

9 years agologin proxy: Hanging outgoing SSL connections caused using already-freed memory
Timo Sirainen [Thu, 20 Oct 2016 07:11:53 +0000 (10:11 +0300)] 
login proxy: Hanging outgoing SSL connections caused using already-freed memory

This mainly happened when login proxy closed the connection due to connect
timeout. The ssl-proxy still had a reference and existed for a longer time.
If SSL handshake still succeeded afterwards, it now called
login_proxy_ssl_handshaked(), which accessed the already-freed proxy and
likely crashed.

Fixed the ssl-client proxy code specifically. Alternatively ssl_proxy_free()
could be calling ssl_proxy_destroy() always, but since ssl-server side of
the code seems to have been working fine, I don't want to accidentally
break it.

9 years agolib-program-client: Linking fix.
Timo Sirainen [Thu, 20 Oct 2016 07:59:23 +0000 (10:59 +0300)] 
lib-program-client: Linking fix.

9 years agoFixed copyright notice.
Stephan Bosch [Wed, 19 Oct 2016 21:07:58 +0000 (23:07 +0200)] 
Fixed copyright notice.

9 years agolib-program-client: Deduplicate flush statement
Aki Tuomi [Wed, 19 Oct 2016 18:03:39 +0000 (21:03 +0300)] 
lib-program-client: Deduplicate flush statement

It can be done below by splitting the else if
into separate if statement.

9 years agolib-program-client: Correctly handle error code
Aki Tuomi [Wed, 19 Oct 2016 18:03:24 +0000 (21:03 +0300)] 
lib-program-client: Correctly handle error code

9 years agolib: Copy target_uid from restrict_access_settings
Aki Tuomi [Wed, 19 Oct 2016 17:40:22 +0000 (20:40 +0300)] 
lib: Copy target_uid from restrict_access_settings

One cannot assign to set->uid, causing compile error.

9 years agolib-program-client: Try drop setuid root by default
Aki Tuomi [Wed, 19 Oct 2016 16:02:22 +0000 (19:02 +0300)] 
lib-program-client: Try drop setuid root by default

But not if root privileges are asked for.

9 years agolib: Add drop_setuid_root for restrict_access
Aki Tuomi [Wed, 19 Oct 2016 15:44:35 +0000 (18:44 +0300)] 
lib: Add drop_setuid_root for restrict_access

drop_setuid_root, when set to true, will detect
and try to drop getuid()==0. This is done by
recovering current effective UID to set->uid
if set->uid == -1, and then doing seteuid(0).
It will also drop out any other extra privileges,
such as extra groups not requested for.

9 years agolib-storage: clean up mailbox_list_create to improve readability
Josef 'Jeff' Sipek [Wed, 12 Oct 2016 18:57:51 +0000 (14:57 -0400)] 
lib-storage: clean up mailbox_list_create to improve readability

There is no reason to use mailbox_list_driver_find() here instead of
mailbox_list_find_class() as (1) we do not need the index into the list
driver array, and (2) dealing with double-pointers is harder than regular
pointers.

9 years agopush-notification: Error handling fix and cleanups.
Timo Sirainen [Wed, 19 Oct 2016 16:41:51 +0000 (19:41 +0300)] 
push-notification: Error handling fix and cleanups.

9 years agodovecot-ldap.conf.ext: Updated sasl_bind comment.
Timo Sirainen [Wed, 19 Oct 2016 15:25:15 +0000 (18:25 +0300)] 
dovecot-ldap.conf.ext: Updated sasl_bind comment.

9 years agolib-program-client: Fix memory access problem
Aki Tuomi [Wed, 19 Oct 2016 13:31:01 +0000 (16:31 +0300)] 
lib-program-client: Fix memory access problem

9 years agolib-program-client: Fix local tests
Aki Tuomi [Wed, 19 Oct 2016 13:06:22 +0000 (16:06 +0300)] 
lib-program-client: Fix local tests

9 years agolib-program-client: Whitespace fixes
Aki Tuomi [Mon, 17 Oct 2016 06:50:30 +0000 (09:50 +0300)] 
lib-program-client: Whitespace fixes

9 years agolib-program-client: Disable valgrind
Aki Tuomi [Mon, 17 Oct 2016 11:19:40 +0000 (14:19 +0300)] 
lib-program-client: Disable valgrind

For local test, we can't use valgrind,
it's too unreliable (breaks execution sometimes).

9 years agolib-program-client: Add support for iostream-dot
Aki Tuomi [Mon, 17 Oct 2016 11:13:28 +0000 (14:13 +0300)] 
lib-program-client: Add support for iostream-dot

This is also made mandatory for TCP client.

9 years agolib-program-client: Make sure we delay output in test
Aki Tuomi [Mon, 17 Oct 2016 08:48:16 +0000 (11:48 +0300)] 
lib-program-client: Make sure we delay output in test

This is to ensure that the client does not prematurely
disconnect before output is sent.

9 years agolib-program-client: Move version string to define
Aki Tuomi [Mon, 17 Oct 2016 06:46:22 +0000 (09:46 +0300)] 
lib-program-client: Move version string to define

9 years agolib-program-client: Add URI based constructor
Aki Tuomi [Thu, 13 Oct 2016 12:32:49 +0000 (15:32 +0300)] 
lib-program-client: Add URI based constructor

9 years agolib-program-client: Add tests for TCP client
Aki Tuomi [Mon, 17 Oct 2016 06:44:33 +0000 (09:44 +0300)] 
lib-program-client: Add tests for TCP client

9 years agolib-program-client: Add TCP client support
Aki Tuomi [Mon, 17 Oct 2016 06:44:14 +0000 (09:44 +0300)] 
lib-program-client: Add TCP client support

9 years agolib-program-client: Add switch_ioloop vfunc
Aki Tuomi [Mon, 17 Oct 2016 06:35:14 +0000 (09:35 +0300)] 
lib-program-client: Add switch_ioloop vfunc

This lets program-client backends do their own
special io loop switching.

9 years agolib-program-client: Use milliseconds in idle timeout
Aki Tuomi [Sat, 15 Oct 2016 10:59:45 +0000 (13:59 +0300)] 
lib-program-client: Use milliseconds in idle timeout