SQL Authentication when the password contains spaces
Dear list,
I created a dovecot mysql user with a password containing spaces. When I try to run doveadm fetch (to test the sql authentication), I get the following error message in the logs:
Feb 11 17:37:32 auth: Fatal: sqlpool: Missing value in connect string: xxx
the connect line was:
connect = "host=localhost dbname=mail user=dovecot password=xxx xxx xxx"
The following code source taken from dovecot's github repo[1], suggests that the parsing relies on spaces as field separators.
static int driver_mysql_parse_connect_string(struct mysql_db *db, const char *connect_string, const char **error_r) { const char *const *args, *name, *value; const char **field;
db->ssl_cipher = "HIGH";
db->ssl_verify_server_cert = 1;
db->connect_timeout = SQL_CONNECT_TIMEOUT_SECS;
db->read_timeout = MYSQL_DEFAULT_READ_TIMEOUT_SECS;
db->write_timeout = MYSQL_DEFAULT_WRITE_TIMEOUT_SECS;
args = t_strsplit_spaces(connect_string, " ");
for (; *args != NULL; args++) {
value = strchr(*args, '=');
if (value == NULL) {
*error_r = t_strdup_printf("Missing value in connect string: %s",
*args);
return -1;
}
[...]
How do I supply the connection string in a suitable way?
References:
[1] dovecot source code on github https://github.com/dovecot/core/blob/main/src/lib-sql/driver-mysql.c#L194
Troubleshooting info:
Dovecot v2.3.19.1 (9b53102964) starting up for imap, lmtp, pop3 (core dumps disabled) on Debian 12
-- yassine -- sysadm +213-779 06 06 23 http://about.me/ychaouche Looking for side gigs.
On 11/02/2024 19:11 EET Yassine Chaouche a.chaouche@algerian-radio.dz wrote:
Dear list,
I created a dovecot mysql user with a password containing spaces. When I try to run doveadm fetch (to test the sql authentication), I get the following error message in the logs:
Feb 11 17:37:32 auth: Fatal: sqlpool: Missing value in connect string: xxx
the connect line was:
connect = "host=localhost dbname=mail user=dovecot password=xxx xxx xxx"
The following code source taken from dovecot's github repo[1], suggests that the parsing relies on spaces as field separators.
static int driver_mysql_parse_connect_string(struct mysql_db *db, const char *connect_string, const char **error_r) { const char *const *args, *name, *value; const char **field;
db->ssl_cipher = "HIGH"; db->ssl_verify_server_cert = 1; db->connect_timeout = SQL_CONNECT_TIMEOUT_SECS; db->read_timeout = MYSQL_DEFAULT_READ_TIMEOUT_SECS; db->write_timeout = MYSQL_DEFAULT_WRITE_TIMEOUT_SECS;
args = t_strsplit_spaces(connect_string, " "); for (; *args != NULL; args++) { value = strchr(*args, '='); if (value == NULL) { *error_r = t_strdup_printf("Missing value in connect string: %s", *args); return -1; } [...]
How do I supply the connection string in a suitable way?
References:
[1] dovecot source code on github https://github.com/dovecot/core/blob/main/src/lib-sql/driver-mysql.c#L194
Troubleshooting info:
Dovecot v2.3.19.1 (9b53102964) starting up for imap, lmtp, pop3 (core dumps disabled) on Debian 12
-- yassine -- sysadm
Would it be possible to use a password without spaces?
Aki
participants (2)
-
Aki Tuomi
-
Yassine Chaouche