Hello Giovanni,

When doing a login the username is always stripped from its domain part.
For my setup (sqlite-based) I worked around this in the following manner
(only important sections):
smtpd.conf:
table authdb sqlite:/etc/mail/auth.conf

accept from any for domain <authdb> virtual <authdb> userbase <authdb>
deliver to maildir
"%{user.directory}/Maildir/%{dest.domain}/%{dest.user:strip}"

auth.conf:
dbpath          /etc/mail/storage.db

query_alias SELECT recipient FROM alias WHERE user=?;

query_domain SELECT SUBSTR(user, INSTR(user, '@')+1) FROM alias WHERE
SUBSTR(user, INSTR(user, '@')+1)=? GROUP BY SUBSTR(user, INSTR(user,
'@')+1);

query_credentials SELECT email, password FROM users WHERE email=?;

query_userinfo SELECT uid, gid, home AS directory FROM users WHERE
REPLACE(email, '@', '_')=?;

sqlite schema:
CREATE TABLE users (
        email           VARCHAR(128) NOT NULL PRIMARY KEY,
        password        VARCHAR(64) NOT NULL DEFAULT '!',
        uid             INT NOT NULL,
        gid             INT NOT NULL,
        home            VARCHAR(256)
);
CREATE TABLE alias (
        user            VARCHAR(64) NOT NULL,
        recipient       VARCHAR(128) NOT NULL
);

Where recipient in alias can either be another email address or a
username where the '@' is replaced by an '_'.

Sincerely,

Martijn van Duren


On Wed, 2014-08-20 at 10:38 +0200, Giovanni Bechis wrote:
> Hi,
> I am trying to configure an smtpd server with mysql as userbase, on my 
> database the mailbox schema is the following (simplified):
> id            1
> login         [email protected]
> email         [email protected]
> uid           5000
> gid           5000
> maildir               /var/vmail/paclan.it/giovanni
> 
> With the following conf the table_lookup tries to find a record with 
> login=giovanni instead of [email protected], is there a way to tell 
> that the login field contains an email ?
>  Thanks
>   Giovanni



-- 
You received this mail because you are subscribed to [email protected]
To unsubscribe, send a mail to: [email protected]

Reply via email to