git-cvsserver: protect against NULL in crypt(3)
Some versions of crypt(3) will return NULL when passed an unsupported hash type (ex: OpenBSD with DES), so check for undef instead of using it directly. Also use this to probe the system and select a better hash function in the tests, so it can pass successfully. Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com> [jc: <CAPUEspjqD5zy8TLuFA96usU7FYi=0wF84y7NgOVFqegtxL9zbw@mail.gmail.com>] Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
a7775c7eb8
commit
bffcb4d9d6
@ -222,10 +222,11 @@ if ($state->{method} eq 'pserver') {
|
||||
open my $passwd, "<", $authdb or die $!;
|
||||
while (<$passwd>) {
|
||||
if (m{^\Q$user\E:(.*)}) {
|
||||
if (crypt(descramble($password), $1) eq $1) {
|
||||
my $hash = crypt(descramble($password), $1);
|
||||
if (defined $hash and $hash eq $1) {
|
||||
$auth_ok = 1;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
close $passwd;
|
||||
|
||||
|
Reference in New Issue
Block a user