1
0
mirror of https://github.com/dovecot/core.git synced 2026-10-23 22:08:58 +03:00

38138 Commits

Author SHA1 Message Date
Timo Sirainen
0897fb182d imap: LIST - Fix leaking mailbox list iterator if client disconnects
If writing a LIST reply line failed because the output stream was closed,
cmd_list_continue() returned without deinitializing the mailbox list
iterator. Besides leaking memory (around 75-140 kB per command with
150-600 folders), the iterator keeps references to the mailbox { }
settings of all autocreated mailboxes, which caused warnings when the
imap process exited:

  Warning: Leaked settings: mail-storage-settings.c:819

Broken by 69fe2beffa
2026-10-23 17:22:20 +00:00
Timo Sirainen
12b56c9082 lib-settings: Fix assert-crash with cached default overrides of filter arrays
Default setting overrides cached for settings roots without config have no
overrides_array, so array_default_added must be set the same way as in
settings_instance_overrides_add_filters().

Fixes assert-crash in test-smtp-submit:
Panic: file settings.c: line 2111 (settings_instance_override_add_default): assertion failed: (array_set->overrides_array != NULL)

Broken by 7978e7a5b5
2026-10-23 12:01:24 +00:00
Timo Sirainen
a5e161cebc config: settings-get.py - Don't use sys.stdout.reconfigure()
It requires Python 3.7, but e.g. RHEL 8 still has Python 3.6.

Broken by 7c72617a51
2026-10-23 06:20:30 +00:00
Timo Sirainen
1257d9cb85 config: Reformat settings-get.py 2026-10-23 09:16:53 +03:00
Timo Sirainen
6ea8da841a config: settings-get.py - Don't use assignment expressions
They require Python 3.8, but e.g. RHEL 8 still has Python 3.6.

Broken by c41bc27c04
2026-10-22 19:36:05 +00:00
Stephan Bosch
7b8041031d lib-sasl: dsasl-client-mech-scram - Implicitly upgrade non-PLUS SCRAM mechanism to PLUS
In case of server support, as required by RFC 5802, Section 6.
2026-10-22 18:26:06 +00:00
Stephan Bosch
ceb24b3d6a lib-sasl: sasl-server-mech-scram - Fix spurious downgrade attack error occurring on plaintext channel
Adds SASL_SERVER_REQUEST_FLAG_CBIND_AVAILABLE flag. It indicates whether the
channel that SASL is used on supports channel binding, i.e. it is using TLS. If
there's no TLS, the downgrade attack check is disabled.
2026-10-22 18:26:06 +00:00
Stephan Bosch
b075047e5b auth: auth-master-connection - Use auth_request_import_auth() for USER/PASS requests 2026-10-22 18:26:06 +00:00
Stephan Bosch
6299d13e6d doveadm: doveadm-auth - Provide available server SASL mechanisms to SASL client session 2026-10-22 18:26:06 +00:00
Stephan Bosch
719c511d7d doveadm: doveadm-auth - Don't initialize SASL client session until auth client is connected 2026-10-22 18:26:06 +00:00
Stephan Bosch
1f141c8269 doveadm: doveadm-auth - Move auth_connected()
This is a preparation for later commit.
2026-10-22 18:26:06 +00:00
Stephan Bosch
c66568d376 lib-sasl: sasl-server-mech-scram - Use the new auth_init() mech vfunc 2026-10-22 18:26:06 +00:00
Stephan Bosch
53269416fb lib-sasl: sasl-server - Add auth_init() mech vfunc 2026-10-22 18:26:06 +00:00
Stephan Bosch
f1e9dc24b3 lib-sasl: sasl-server - Rename auth_new() mech vfunc to auth_alloc() 2026-10-22 18:26:06 +00:00
Stephan Bosch
bbcebf091b lib-sasl: dsasl-client - Add dsasl_client_session_server_supports_mech() 2026-10-22 18:26:06 +00:00
Stephan Bosch
93bc2e3266 lib-sasl: dsasl-client - Add dsasl_client_session_channel_binding_available() 2026-10-22 18:26:06 +00:00
Stephan Bosch
84590087a7 lib-sasl: sasl-server - Add sasl_server*_mech_get_list() 2026-10-22 18:26:06 +00:00
Stephan Bosch
798a419d16 lib-storage: index: pop3c: Fix sharing the storage between namespaces
pop3c serialized its settings into unique_root_dir, which was then compared to
the new namespace's mail_path. That comparison could never succeed, so two pop3c
namespaces with identical settings always created separate mail_storages, and
"alias_for" between them failed with "Namespace <name> can't have alias_for= to
a different storage (different root dirs)".

An earlier imapc-related commit implemented storage_match() by comparing the
storage settings with settings_equal(), so the setting list no longer needs to
be kept in sync by hand. For the underlying pop3 client, the settings specific
to this client are compared as well. Also, the more generic SSL and SASL client
settings are compared, since they're used for the establishing the pop3c
connection. This means they're now looked up already when the storage is
created, so invalid ssl_client_* and client_auth_* settings fail namespace
initialization instead of the first connection attempt. These settings are
looked up from the namespace's list event, so storage_match() properly sees
namespace-scoped settings.

Unlike the old serialized string, mail_path isn't compared. The pop3c storage
holds no path-specific state, the index paths come from the mailbox list, so two
namespaces pointing to the same remote mailboxes can share the storage even if
their indexes are stored in different directories. A client that was created
disabled (e.g. for a shared namespace whose owner doesn't exist) is never
shared, and a namespace that must not access the remote never reuses a working
client.
2026-10-22 18:26:06 +00:00
Stephan Bosch
56d1562684 lib-auth-client: auth-client - Add auth_client_get_available_mech_names() 2026-10-22 18:26:06 +00:00
Stephan Bosch
93e1b16ddc lib-pop3-client: pop3c-client - Check basic SASL settings upon client creation 2026-10-22 18:26:06 +00:00
Stephan Bosch
128f7dc4fd lib-pop3-client: pop3c-client - Add full SASL support
The pop3 client is now configured as follows:

pop3c_host = imap.example.com
pop3c_port = 143
pop3c_ssl = pop3s

pop3c {
  ssl_client_require_valid_cert = no
  client_auth PLAIN {
    authid = master_user
    authzid = user
    password = frop
  }
}
2026-10-22 18:26:06 +00:00
Stephan Bosch
76a463cbf7 lib-pop3-client: pop3c-client - Fix STARTTLS support
It did not work at all and could never have worked.
2026-10-22 18:26:06 +00:00
Stephan Bosch
944ffce91f lib-pop3-client: pop3c-client - Use client_auth_settings
The pop3 client is now configured as follows:

pop3c_host = imap.example.com
pop3c_port = 143
pop3c_ssl = pop3s

pop3c {
  ssl_client_require_valid_cert = no
  client_auth_authid = master_user
  client_auth_authzid = user
  client_auth_password = frop
}

The following settings are renamed:

pop3c_user        -> pop3c/client_auth_authzid
pop3c_master_user -> pop3c/client_auth_authid
pop3c_password    -> pop3c/client_auth_password
2026-10-22 18:26:06 +00:00
Stephan Bosch
84c0053a32 lib-pop3-client: pop3c-client - Use ssl_client_require_valid_cert setting
The pop3 client is now configured as follows:

pop3c_host = imap.example.com
pop3c_port = 143
pop3c_ssl = pop3s

pop3c {
  ssl_client_require_valid_cert = no
}

The following setting is renamed:

pop3c_ssl_verify -> pop3c/ssl_client_require_valid_cert
2026-10-22 18:26:06 +00:00
Stephan Bosch
59e99c715d lib-pop3-client: pop3c-client - Load pop3c_settings directly
Remove intermediate struct pop3c_client_settings as a parameter to
pop3c_client_init() and load the settings directly from the provided event.
2026-10-22 18:26:06 +00:00
Stephan Bosch
b7e3832563 lib-pop3-client: Rename pop3c_settings to pop3c_client_settings
That struct already exists and is renamed out of the way as
pop3c_client_internal_settings. That old struct will disappear in a later
commit.
2026-10-22 18:26:06 +00:00
Stephan Bosch
959119641c lib-pop3-client: pop3c-client - Move settings for internal use to parameters 2026-10-22 18:26:06 +00:00
Stephan Bosch
7bb1aa4e1b lib-pop3-client: Add unit test 2026-10-22 18:26:06 +00:00
Stephan Bosch
d9752915ff lib-pop3-client: pop3c-client - Reset state upon disconnect
Makes reconnect possible if ever needed.
2026-10-22 18:26:06 +00:00
Stephan Bosch
0bae8419bb lib-pop3-client: pop3c-client - Drop dead dns_client_socket_path setting 2026-10-22 18:26:06 +00:00
Stephan Bosch
357a83aabb lib-pop3-client: pop3c-client - Allow calling pop3c_client_cmd*() when login is not finished
Particularly, CAPA command can still be pending while login callback is already
called.
2026-10-22 18:26:06 +00:00
Stephan Bosch
9a8fafeb8f lib-pop3-client: pop3c-client - Only log disconnect as error when commands are pending
Always log a debug message upon disconnect.
2026-10-22 18:26:06 +00:00
Stephan Bosch
3bb6b3615a lib-pop3-client: pop3c-client - Add pop3c_command_state_names 2026-10-22 18:26:06 +00:00
Stephan Bosch
72366051ff lib-pop3-client: pop3c-settings - Use pop3-protocol.h for default port 2026-10-22 18:26:06 +00:00
Stephan Bosch
15908f09c5 lib-pop3-client: pop3c-client - Handle unassigned settings properly 2026-10-22 18:26:06 +00:00
Stephan Bosch
5a3c1a4366 lib-pop3-client: pop3c-client - Make connect and command timeouts available as settings 2026-10-22 18:26:06 +00:00
Stephan Bosch
50c89fd179 lib-storage: index: pop3c: Move the client itself to src/lib-pop3-client 2026-10-22 18:26:06 +00:00
Stephan Bosch
d209382e0f lib-storage: index: pop3c: pop3c-settings - Change pop3c_user default to "%{owner_user}"
For consistency with imapc.
2026-10-22 18:26:06 +00:00
Stephan Bosch
acf7fa1d56 lib-imap-client: Split storage-specific settings off to lib-storage 2026-10-22 18:26:06 +00:00
Stephan Bosch
cf26f11a71 lib-imap-client: imapc-connection - Treat empty imapc_host setting same as IMAPC_PARAMETER_CLIENT_DISABLED flag 2026-10-22 18:26:06 +00:00
Stephan Bosch
bd43c8a245 lib-imap-client: imap-client - Add imapc_client_get_host() 2026-10-22 18:26:06 +00:00
Stephan Bosch
94e737cc43 lib-imap-client: test-imapc-client - Add tests for authentication success 2026-10-22 18:26:06 +00:00
Stephan Bosch
ff7b427afe lib-sasl: dsasl-client - Make PLAIN mechanism definition unavailable for direct access 2026-10-22 18:26:06 +00:00
Stephan Bosch
d7ef8f1b6b lib-sasl: dsasl-client - Make dsasl_client_mech_uses_password() private 2026-10-22 18:26:06 +00:00
Stephan Bosch
ef2937fcaa lib-sasl: dsasl-client - Drop dsasl_client_mech_get_name() 2026-10-22 18:26:06 +00:00
Stephan Bosch
a26ea6e71c lib-sasl: dsasl-client - Make dsasl_client_mech_find() private 2026-10-22 18:26:06 +00:00
Stephan Bosch
dea5d53003 lib-imap-client: imapc-connection - Obtain authentication settings exclusively from event
The imap client is now configured as follows:

imapc_host = imap.example.com
imapc_port = 143
imapc_ssl = no

imapc {
  client_auth PLAIN {
    authid = imap-frontend
    password = frop
  }
}

The following settings are renamed:

imapc_user        -> imapc/client_auth_authzid
imapc_master_user -> imapc/client_auth_authid
imapc_password    -> imapc/client_auth_password

The following settings are deprecated:

imapc_sasl_mechanisms
2026-10-22 18:26:06 +00:00
Stephan Bosch
b33dd3f62f lib-imap-client: imapc-client - Split off imap_client_settings_match() from imapc_storage_match() 2026-10-22 18:26:06 +00:00
Stephan Bosch
c8d9ea479b lib-imap-client: imapc-client - Drop useless override_password parameter 2026-10-22 18:26:06 +00:00
Stephan Bosch
2484acc5d7 lib-imap-client: imapc-client - Drop useless override_rawlog_dir parameter 2026-10-22 18:26:06 +00:00