[tpop3d-discuss][BUG]: auth_flatfile and local_part weirdness

Arkadiusz Miskiewicz arekm at pld-linux.org
Wed, 6 Jun 2007 12:06:04 +0200


Here is the problem:

append-domain: no
auth-pam-enable: no
auth-passwd-enable: no

auth-flatfile-enable: yes
auth-flatfile-passwd-file: somefile
auth-flatfile-mail-user: mail
auth-flatfile-mail-group: mail
mailbox: maildir:/var/mail/$(user)
lowercase-mailbox: yes
strip-domain: no

Now

user logs in as:

login: user
password: securepassword

Now,

/* Do we now have enough information to authenticate using USER/PASS? */
        if (!c->a && c->user && c->pass) {
            c->a =3D authcontext_new_user_pass(c->user, NULL, c->domain,=20
c->pass, c->remote_ip, c->local_ip);

calls

authcontext_new_user_pass()

with local_part being NULL, then the code is trying to find out real=20
local_part:

    l =3D local_part;
    d =3D domain;

    if (!local_part && domain) {
        int n;
        n =3D strcspn(user, DOMAIN_SEPARATORS);
        if (n > 0 && user[n]) {
            x =3D xstrdup(user);
            x[n] =3D 0;
            l =3D x;
            d =3D l + n + 1;
        } else
            l =3D NULL;
    }

Unfortunately since user doesn't contain full email address (it's just logi=
n)=20
then local_part (l) is set to NULL and then real authenticator is called:

aa->auth_new_user_pass(user, l, d, pass, clienthost, serverhost)

but flatfile driver has:

    if (!local_part) return NULL;

and we end up with every login being failure (even if it's correct) :-(

=2D-=20
Arkadiusz Mi=B6kiewicz        PLD/Linux Team
arekm / maven.pl            http://ftp.pld-linux.org/