On Thu, Jul 05, 2001 at 02:03:05PM -0000, [EMAIL PROTECTED] wrote:
> Have you got an example of password you use ? (I wonder if I use the 
> right syntax...) or an ldif file  for a user, with hashed password and 
> it cleartext equivalent ?

Quoting Dan: "This is Unix, stop acting so helpless".

Due to the heat I'm glad enough to share my password crypt function (perl):

sub crypt_passwd {
    my($passwd) = @_;    
    @times=gmtime;
    srand($times[0] * $times[1] | $$);
    @alpha = ('a'..'z');
    $salt = @alpha[rand(25)] . @alpha[rand(25)];
    $passwd = crypt($passwd, $salt);
    return $passwd;
}

then you can just write the result to the LDIF like

print "UserPassword: {crypt}" . crypt_password($cleartextpassword) . "\n";

-- 
* Henning Brauer, [EMAIL PROTECTED], http://www.bsws.de *
* Roedingsmarkt 14, 20459 Hamburg, Germany               *
Unix is very simple, but it takes a genius to understand the simplicity.
(Dennis Ritchie)

Reply via email to