Re: [Exim] SMTP AUTH & MySQL problems SOLVED

Góra strony
Delete this message
Reply to this message
Autor: Atanos
Data:  
Dla: exim-users
Stare tematy: [Exim] SMTP AUTH & MySQL problems
Temat: Re: [Exim] SMTP AUTH & MySQL problems SOLVED
Well, after a few hours of hacking I finally managed to solve this
issue. Here are my authenticators if anyone is interested:

fixed_login:
 driver = plaintext
 public_name = LOGIN
 server_prompts = Username:: : Password::
 server_condition = "${if and { \
                      {!eq{$1}{}} \
                      {!eq{$2}{}} \
                      {crypteq{$2}{\\{md5\\}${lookup mysql{SELECT
password FROM accounts WHERE username='${local_part:$1}' AND
domainname='${domain:$1}'}{$value}fail}}} \
                      } {yes}{no}}"
 server_set_id = $1


fixed_plain:
 driver = plaintext
 public_name = PLAIN
 server_prompts = :
 server_condition = "${if and { \
                      {!eq{$2}{}} \
                      {!eq{$3}{}} \
                      {crypteq{$3}{\\{md5\\}${lookup mysql{SELECT
password FROM accounts WHERE username='${local_part:$2}' AND
domainname='${domain:$2}'}{$value}fail}}} \
                      } {yes}{no}}"
 server_set_id = $2



On Fri, 1 Nov 2002 11:17:59 +0200
Atanos <atanos@???> wrote:

> Hello list,
>
> I've been trying to get PLAIN and LOGIN SMTP auths working, so that
> they would compare the password to one stored in a MySQL database.
> However, I'm not at all sure how I'm supposed to accomplish this (need
> help with constructing server_condition for the auths). I'm using Exim
> 4.10 on Debian Woody.
>
> First of all, here's my database layout:
>
> mysql> desc accounts;
> +------------+--------------+------+-----+---------+-------+
> | Field      | Type         | Null | Key | Default | Extra |
> +------------+--------------+------+-----+---------+-------+
> | username   | varchar(128) |      |     |         |       |
> | domainname | varchar(64)  |      |     |         |       |
> | password   | varchar(32)  |      |     |         |       |
> +------------+--------------+------+-----+---------+-------+

>
> The username field is the same as $local_part. The domainname field is
> equal to $domain. I use this same table to do POP authentication with
> a patched Qpopper. The reason why I have username and domain in
> separate fields, is because I use virtual domains. Now, it would be
> great if users could use the same usernames and passwords to SMTP AUTH
> as they use with POP. For example, I would login with
> "atanos@???" and my password.
>
> The password field stores the passwords as MD5 hashes.
>
> Anyone kind enough to provide me with a working server_condition, or
> at least point me in the right direction?
>
> Oh, and I sometimes get errors like this in Exim's main log, usually
> when sending mail:
> "failed to open DB file /var/spool/exim/db/wait-remote_smtp: File
> exists"
> Any ideas what might be causing that?


Apparently this is only a problem on Debian(?). Deleted the files and
restarted Exim. Works.