[Dovecot] dovecot-cvs/mysql-5.0.18 OLD/PASSWORD problem

John Wong johnw at wonghome.net
Mon Feb 6 18:05:25 EET 2006


i use openbsd/i386, dovecot-cvs(today), mysql-5.0.18

today, i change the mysql_dbuser_password form OLD_PASSWORD to PASSWORD
then dovecot can't connect to mysql-server

shell$> mysql -u root -p
mysql$> SET PASSWORD FOR 'db_user'@'localhost' = PASSWORD('db_pw');
now, dovecot CAN NOT connect to mysql-server

shell$> mysql -u root -p
mysql$> SET PASSWORD FOR 'db_user'@'localhost' = OLD_PASSWORD('db_pw');
now, dovecot CAN connect to mysql-server and everything work fine

i patched src/lib-sql/driver-mysql.c to test, use something like:
i_error("host(%s), db->user(%s), db->password(%s), db->dbname(%s) ....);
before mysql_real_connect(), then see the maillog, the
db->user/password/dbname is correct

maillog:
auth-worker(default): conn->mysql is NOT NULL
auth-worker(default): host((null)), db->user(db_user),
db->password(db_pw), db->dbname(dbname), db->port(0),
unix_socket(/mysql.sock), db->client_flags(0)
auth-worker(default): failed: (1)
auth-worker(default): mysql: Connect failed to (null) (dbname): Access
denied for user 'db_user'@'localhost' (using password: YES) - waiting
for 1 seconds before retry

i wrote a small c program to test, it can success connect to mysql,
use same user/password/dbname, with both OLD_PASSWORD/PASSWORD

why dovecot can't to connect to mysql-server with PASSWORD?
help please, thank you


-------------- next part --------------
base_dir = /var/dovecot/
ssl_cert_file = /etc/ssl/certs/mail.crt
ssl_key_file = /etc/ssl/private/mail.key
disable_plaintext_auth = no
login_dir = /var/dovecot/login
login_user = _dovecot
valid_chroot_dirs = /var/spool/postfix/var
default_mail_env = maildir:%h/%u
mmap_no_write = yes
protocol imap {
  imap_client_workarounds = delay-newmail outlook-idle netscape-eoh tb-extra-mailbox-sep
}
protocol pop3 {
  pop3_uidl_format = %08Xu%08Xv
  pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
}
auth default {
  mechanisms = plain
  passdb sql {
    args = /etc/dovecot-sql.conf
  }
  userdb static {
    args = uid=32765 gid=32765 home=/var/spool/postfix/var/./mail
  }
  user = _dovecot-auth
  chroot = /var/dovecot/auth
  socket listen {
    client {
      path = /var/spool/postfix/private/dovecot-auth
      mode = 0600
      user = _postfix
    }
  }
}
-------------- next part --------------
driver = mysql
connect = host=/mysql.sock dbname=dbname user=db_user password=db_pw

default_pass_scheme = PLAIN-MD5
password_query = SELECT password FROM users WHERE userid = '%n' AND %Ls = '1' AND active = '1'
-------------- next part --------------
--- src/lib-sql/driver-mysql.c.orig	Mon Feb  6 23:07:42 2006
+++ src/lib-sql/driver-mysql.c	Mon Feb  6 23:39:36 2006
@@ -112,11 +112,17 @@
 	}
 
 	alarm(MYSQL_CONNECT_FAILURE_TIMEOUT);
+	i_error("conn->mysql is %s NULL", conn->mysql == NULL ? "" : "NOT");
+	i_error("host(%s), db->user(%s), db->password(%s), db->dbname(%s), "
+		"db->port(%u), unix_socket(%s), db->client_flags(%u)",
+		host, db->user, db->password, db->dbname, db->port, unix_socket,
+		db->client_flags);
 	failed = mysql_real_connect(conn->mysql, host, db->user, db->password,
 				    db->dbname, db->port, unix_socket,
 				    db->client_flags) == NULL;
 	alarm(0);
 	if (failed) {
+		i_error("failed: (%i)", (int)failed);
 		if (conn->connect_failure_count > 0) {
 			/* increase delay between reconnections to this
 			   server */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sql-connect.c
Type: text/x-csrc
Size: 1096 bytes
Desc: not available
Url : http://dovecot.org/pipermail/dovecot/attachments/20060207/7f052073/sql-connect-0001.c


More information about the dovecot mailing list