Mercurial > dovecot > original-hg > dovecot-1.2
changeset 2288:5633733e6ec1 HEAD
Added mysql description to example config file. Changed mysql default
settings.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 06 Jul 2004 09:06:00 +0300 |
parents | df0b936ae3ed |
children | 83df1d1bbb05 |
files | dovecot-example.conf src/auth/db-mysql.c |
diffstat | 2 files changed, 17 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/dovecot-example.conf Tue Jul 06 08:55:46 2004 +0300 +++ b/dovecot-example.conf Tue Jul 06 09:06:00 2004 +0300 @@ -429,6 +429,7 @@ # vpopmail: vpopmail library # ldap <config path>: LDAP, see doc/dovecot-ldap.conf # pgsql <config path>: a PostgreSQL database, see doc/dovecot-pgsql.conf + # mysql <config path>: a MySQL database, see doc/dovecot-mysql.conf userdb = passwd # Where password database is kept: @@ -440,6 +441,7 @@ # vpopmail: vpopmail authentication # ldap <config path>: LDAP, see doc/dovecot-ldap.conf # pgsql <config path>: a PostgreSQL database, see doc/dovecot-pgsql.conf + # mysql <config path>: a MySQL database, see doc/dovecot-mysql.conf passdb = pam # User to use for the process. This user needs access to only user and
--- a/src/auth/db-mysql.c Tue Jul 06 08:55:46 2004 +0300 +++ b/src/auth/db-mysql.c Tue Jul 06 09:06:00 2004 +0300 @@ -19,12 +19,12 @@ static struct setting_def setting_defs[] = { DEF(SET_STR, db_host), - DEF(SET_STR, db_port), + DEF(SET_INT, db_port), DEF(SET_STR, db_unix_socket), DEF(SET_STR, db), DEF(SET_STR, db_user), DEF(SET_STR, db_passwd), - DEF(SET_STR, db_client_flags), + DEF(SET_INT, db_client_flags), DEF(SET_STR, password_query), DEF(SET_STR, user_query), DEF(SET_STR, default_pass_scheme) @@ -32,12 +32,12 @@ struct mysql_settings default_mysql_settings = { MEMBER(db_host) "localhost", - MEMBER(db_port) "0", - MEMBER(db_unix_socket) "/var/tmp/mysql.sock", - MEMBER(db) "email_accounts", - MEMBER(db_user) "dovecot", - MEMBER(db_passwd) "changeme", - MEMBER(db_client_flags) "0", + MEMBER(db_port) 3306, + MEMBER(db_unix_socket) NULL, + MEMBER(db) NULL, + MEMBER(db_user) NULL, + MEMBER(db_passwd) NULL, + MEMBER(db_client_flags) 0, MEMBER(password_query) "SELECT password FROM users WHERE userid = '%u'", MEMBER(user_query) "SELECT home, uid, gid FROM users WHERE userid = '%u'", MEMBER(default_pass_scheme) "PLAIN-MD5" @@ -96,10 +96,9 @@ if (!mysql_real_connect(conn->mysql, conn->set.db_host, conn->set.db_user, conn->set.db_passwd, conn->set.db, - atoi(conn->set.db_port), + conn->set.db_port, conn->set.db_unix_socket, - strtoul(conn->set.db_client_flags, - NULL, 10))) { + conn->set.db_client_flags)) { i_error("MYSQL: Can't connect to database %s: %s", conn->set.db, mysql_error(conn->mysql)); return FALSE; @@ -163,6 +162,11 @@ if (!settings_read(config_path, NULL, parse_setting, NULL, conn)) exit(FATAL_DEFAULT); + if (conn->set.db == NULL) + i_fatal("MYSQL: db variable isn't set in config file"); + if (conn->set.user == NULL) + i_fatal("MYSQL: user variable isn't set in config file"); + (void)mysql_conn_open(conn); conn->next = mysql_connections;