[Dovecot] Failed authentication to a mysql database (bug or PEBKAC?)

Michael Gabb megamimi at gmx.de
Mon Aug 15 12:21:30 EEST 2005


Hi Timo,

Timo Sirainen schrieb:
> On Tue, 2005-08-09 at 11:20 +0200, Michael Gabb wrote:
> 
>>My connect string is as follows:
>>connect = host=/var/lib/mysql/mysql.sock user=my_user
>>password=my_password dbname=my_dbname
> 
> 
> This should work. Assuming of course that it's all in one line. Hmm. Are
> you sure that all the spaces in the line are actually spaces and not
> just something that look like spaces?
> 

This was all double and triple checked by me.

I patched to code of driver-mysql.c to see whats going on:
==============
temp_logfile = fopen("/tmp/mysql_connect.log", "w");
        if (temp_logfile != NULL){
                fprintf(temp_logfile, "Connecting with the following
settings:"
                        "User -> \"%s\", Password -> \"%s\"\n" ,
db->user, db->password);
                fflush(temp_logfile);
                fclose(temp_logfile);
        }
==============
(pretty ugly in this mail, but it schould be clear, what the code does...)

I inserted this few lines just before the "mysql_real_connect()" and
alle I get ist correct output (means: "User -> my_user, Password ->
my_password")

> Maybe check with strace if it's actually sending the password to mysql?
> Something like: strace -o log -f dovecot
> 
I did this. Here's the relevant section:
===================
24558 fcntl64(7, F_GETFL)               = 0x2 (flags O_RDWR)
24558 connect(7, {sa_family=AF_FILE, path="/var/lib/mysql/mysql.sock"},
110) = 0
24558 setsockopt(7, SOL_IP, IP_TOS, [8], 4) = -1 EOPNOTSUPP (Operation
not suppor
ted)
24558 setsockopt(7, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
24558 read(7, "9\0\0\0", 4)             = 4
24558 read(7, "\n4.1.10a-log\0J\0\0\0C5|529g}\0,\242\10\2\0\0"..., 57) = 57
24558 stat64("/usr/share/mysql/charsets/Index.xml",
{st_mode=S_IFREG|0644, st_siz
e=17147, ...}) = 0
24558 open("/usr/share/mysql/charsets/Index.xml", O_RDONLY|O_LARGEFILE) = 8
24558 read(8, "<?xml version=\'1.0\' encoding=\"ut"..., 17147) = 17147
24558 close(8)                          = 0
24558 write(7,
"F\0\0\1\r\242\0\0\0\0\0@\10\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 74)
= 74
24558 read(7, "K\0\0\2", 4)             = 4
24558 read(7, "\377\25\4#28000Access denied for user "..., 75) = 75
24558 shutdown(7, 2 /* send and receive */) = 0
24558 close(7)                          = 0
=====================
I don't see anything special here (although I might be false... I don't
have that much experience with mysql, strace and dovecot).

I hope that brings us any further. Hopefully we can get this going since
my boss gets a little bit nervous about the amount of time I'm working
on this...

Kinf regards,
Michael

-- 
www.megamimi.de.vu


More information about the dovecot mailing list