OT: pam, md5, perl and passwords?
Greetings, OK, I'm clueless.. Clue Bats gleefully accepted. Can anyone enlighten me as to why either of these: #!/usr/bin/perl $salt = '$1$' . join '', ('.', '/', 0..9,'A'..'Z', 'a'..'z')[rand 64, rand 64]; # one.. print crypt('Foo',$salt) . "\n"; # two.. use Crypt::PasswdMD5; print unix_md5_crypt('Foo',$salt) . "\n"; __END__ Produce this: $1$Vv$Lqurj1.e0d9ZGHQPXeXpQ1 But the results aren't equivalent to the same password generated on a SuSE machine with pam md5 enabled for passwords: $1$AQlpW4Gt$MyR9lMWDoyjyRwP7n6r0C1 Is there a way to arrive at the equivalent in Perl? (I realize this isn't clp.misc but someone here is bound to know.. right? :-)) -- -Brian Clark | PGP is spoken here: 0xE4D0C7C8 Please, DO NOT carbon copy me on list replies.
@ 7:50:29 PM on 10/24/2001, Brian Clark wrote:
$salt = '$1$' . join '', ('.', '/', 0..9,'A'..'Z', 'a'..'z')[rand 64, rand 64];
D'oh, I think I figured it out. $salt = '$1$'; for(0 .. 6) { $salt .= join '', ('.', '/', 0..9,'A'..'Z', 'a'..'z')[rand 64]; } $salt .= '$'; $password = crypt("Foo",$salt); But, I was trying to feed it to useradd the same way you'd feed it crypt('non-md5-pass',$salt) with the -p argument. Feeding it $password above doesn't work. But if I vipw -s and give it the value of the above $password, the login works fine. I take it I'm an idiot and that isn't going to work like I want it to.. -- -Brian Clark | PGP is spoken here: 0xE4D0C7C8 Please, DO NOT carbon copy me on list replies.
participants (1)
-
Brian Clark