Mercurial > dovecot > original-hg > dovecot-1.2
changeset 7080:19bd363bcf5d HEAD
Added default_file and default_group settings for MySQL.
Patch by Luca Longinotti
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 01 Jan 2008 19:35:49 +0200 |
parents | d45c3058b91a |
children | ab81d6801423 |
files | doc/dovecot-sql-example.conf src/lib-sql/driver-mysql.c |
diffstat | 2 files changed, 16 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/dovecot-sql-example.conf Tue Jan 01 18:48:09 2008 +0200 +++ b/doc/dovecot-sql-example.conf Tue Jan 01 19:35:49 2008 +0200 @@ -42,6 +42,9 @@ # ssl_ca, ssl_ca_path - Set either one or both to enable SSL # ssl_cert, ssl_key - For sending client-side certificates to server # ssl_cipher - Set minimum allowed cipher security (default: HIGH) +# default_file - Read options from the given file instead of +# the default my.cnf location +# default_group - Read options from the given group (default: client) # # You can connect to UNIX sockets by using host: host=/var/run/mysql.sock # Note that currently you can't use spaces in parameters.
--- a/src/lib-sql/driver-mysql.c Tue Jan 01 18:48:09 2008 +0200 +++ b/src/lib-sql/driver-mysql.c Tue Jan 01 19:35:49 2008 +0200 @@ -31,6 +31,7 @@ pool_t pool; const char *user, *password, *dbname, *unix_socket; const char *ssl_cert, *ssl_key, *ssl_ca, *ssl_ca_path, *ssl_cipher; + const char *def_file, *def_group; unsigned int port, client_flags; ARRAY_DEFINE(connections, struct mysql_connection); @@ -106,6 +107,14 @@ host = conn->host; } + if (db->def_file != NULL) + mysql_options(conn->mysql, MYSQL_READ_DEFAULT_FILE, db->def_file); + + if (db->def_group != NULL) + mysql_options(conn->mysql, MYSQL_READ_DEFAULT_GROUP, db->def_group); + else + mysql_options(conn->mysql, MYSQL_READ_DEFAULT_GROUP, "client"); + if (!conn->ssl_set && (db->ssl_ca != NULL || db->ssl_ca_path != NULL)) { #ifdef HAVE_MYSQL_SSL mysql_ssl_set(conn->mysql, db->ssl_key, db->ssl_cert, @@ -229,6 +238,10 @@ field = &db->ssl_ca_path; else if (strcmp(name, "ssl_cipher") == 0) field = &db->ssl_cipher; + else if (strcmp(name, "default_file") == 0) + field = &db->def_file; + else if (strcmp(name, "default_group") == 0) + field = &db->def_group; else i_fatal("mysql: Unknown connect string: %s", name);