[tpop3d-discuss] MySQL Authentication

Chris Elsworth chris at shagged.org
Sat, 23 Jun 2001 18:55:48 +0100


Hi. Me again. :)

tpop3d has now compiled fine, and everything appears to work except MySQL 
authentication. Maildirs, mbox, and pam auth, are all fine.

I'm not sure I 100% understand the data I have to return from MySQL to 
make it work, so first of all, could anyone here confirm that this is the 
right info:

mysql> SELECT 
pop3_mbox.MailPath,pop3_mbox.UserName,pop3_mbox.Password,domain.UserID 
FROM pop3_mbox,domain WHERE pop3_mbox.UserName='mats' AND 
domain.DomainName='zakalwe.com' AND pop3_mbox.DomainID=domain.pop3_pwID;

this returns one match:

| MailPath                   | UserName | Password | UserID |
| /var/mail/zakalwe.com/mats | mats     | snip     |   1025 |

[where snip is an MD5 hash of a password, like $1$lJ$EN6ExaPgfp1d.T9w59/S4/ ]

That's what I've put into auth_mysql.c :

char user_pass_query_template[] =
"SELECT pop3_mbox.UserName,pop3_mbox.Password,pop3_mbox.MailPath,domain.UserID "
  "FROM pop3_mbox,domain "
 "WHERE pop3_mbox.UserName = '%s' "
   "AND domain.DomainName = '%s' "
   "AND pop3_mbox.DomainID = domain.pop3_pwID";

(same for APOP, even though I'm not currently using it)

But alas, I get:

auth_mysql_new_user_pass: mats@zakalwe.com failed login with wrong passwordauth_

Am I doing the right thing, returning the right information?

Thanks for any help (again, even though last time wasn't my fault) :)

-- 
Chris Elsworth  -  Software & Systems Developer  /  Systems Administrator 
girls = time x money (and time is money)         .       chrise@demon.net
      = money^2 (money is root of all evil)     . .    tel: 020 8371 1041 
      = _/(evil^2) = evil                   t h u s    mob: 07968 324 693