The following (perl :-)-code might clarify:
#!/usr/bin/perl
open PASSWD, "/etc/passwd";
while (<PASSWD>) {
($user,$crypt,$pid,$gid,$fullname,$home,$shell) = split /:/;
$passwd{$crypt} = $user;
}
close PASSWD;
$User = <STDIN>;
$Password = <STDIN>;
$Salt = substr ($User,0,2);
$Crypt = crypt ($User, $Salt);
if ( exists($passwd{$Salt}) and $passwd{$Salt} eq $User ) {
print "Access granted\n";
} else {
print "Access denied\n";
}
__END__
Marc
--
Marc Mutz <[EMAIL PROTECTED]> http://marc.mutz.com/
University of Bielefeld, Dep. of Mathematics / Dep. of Physics
PGP-keyID's: 0xd46ce9ab (RSA), 0x7ae55b9e (DSS/DH)