[Exim] Re: Courier userdb md5 passwords?

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Miquel van Smoorenburg
Date:  
À: exim-users
Sujet: [Exim] Re: Courier userdb md5 passwords?
In article <Pine.LNX.4.33.0201252032250.29849-100000@???>,
Dave C. <djc@???> wrote:
>I'm trying to setup SMTP AUTH, but I need a way to check passwords from
>within exim. exim's ${md5... expansion seems to output the md5sum in an
>entriely different format. I've tried ${crypteq\{md5\} but it doesnt
>pass that either..
>Does anyone have any idea how I can do this?


It's probably the output of the systems crypt() function. BSD uses
that md5 variation by default. Linux has support for it in glibc too.
You can pass a DES hashed or bsd-md5-hashed string to crypt() [as
the salt part] from glibc and it will use the correct algorithm.

So if you see a string starting with $1$ chances are pretty big that
the systems crypt() function knows what to do with it just fine,
so you can use the standard strcmp(crypted, crypt(plaintext, crypted))
in C or exims crypteq() which just calls the system crypt() if I am
not mistaken.

>I've included a sample password/crypted combination below, if someone
>can give me an exim expansion that will succeed for it I'd be much
>obliged.. I will of course continue hacking away at it myself.
>password:
>test123
>courier 'userdb' md5 hashed string:
>$1$eYrvxTAm$Wz4Wkxe5exy/5VhkuTnYH0


int main()
{
    printf("%s\n", crypt("test123", "$1$eYrvxTAm$Wz4Wkxe5exy/5VhkuTnYH0"));
    return 0;
}
% ./a.out
$1$eYrvxTAm$Wz4Wkxe5exy/5VhkuTnYH0


Mike.