dovecot: Added default_file and default_group settings for MySQL.
dovecot at dovecot.org
dovecot at dovecot.org
Tue Jan 1 19:35:52 EET 2008
details: http://hg.dovecot.org/dovecot/rev/19bd363bcf5d
changeset: 7080:19bd363bcf5d
user: Timo Sirainen <tss at iki.fi>
date: Tue Jan 01 19:35:49 2008 +0200
description:
Added default_file and default_group settings for MySQL.
Patch by Luca Longinotti
diffstat:
2 files changed, 16 insertions(+)
doc/dovecot-sql-example.conf | 3 +++
src/lib-sql/driver-mysql.c | 13 +++++++++++++
diffs (50 lines):
diff -r d45c3058b91a -r 19bd363bcf5d doc/dovecot-sql-example.conf
--- 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.
diff -r d45c3058b91a -r 19bd363bcf5d src/lib-sql/driver-mysql.c
--- 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 @@ struct mysql_db {
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);
@@ -105,6 +106,14 @@ static bool driver_mysql_connect(struct
unix_socket = NULL;
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
@@ -229,6 +238,10 @@ static void driver_mysql_parse_connect_s
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);
More information about the dovecot-cvs
mailing list