I have the following snippet of code:
Expand|Select|Wrap|Line Numbers
- sub getPasswordStatus {
- my ($login, $password) = @_;
- my$quotedLogin = quotemeta($login);
- my $Passwd;
- if( $password && $password !~ /\?{7,7}/ ) {
- if ($password =~ m/^NO PASSWORD$/i){ # No password
- $Passwd = 'empty';
- } elsif ($password =~ /^PASSWORD$/i){
- $Passwd = 'password';
- } elsif ($password =~ /^$quotedLogin$/i){
- $Passwd = 'login';
- } else {
- $Passwd = 'weak';
- }
- } else {
- $Passwd = 'ok';
- }
- return $Passwd;
- }
Use of uninitialized value in string eq at lib/Pwc/Policy.pm line 24.
It's worth noting that it always happens for the same passwords, which are always using the same scheme: an upper case letter, then a few lower case letters and finally some numbers (for example "Alcatel1"). But some other passwords _using this very same scheme_ don't produce the error (for example "Algerie1").
Even more interestingly, the error is only generated for the first test, not the others on line 26 and 28, although the passwords causing this error obviously don't match the first test and thus should go through the others.
I tried to change the test on line 23 to "if( defined $password && $password !~ /\?{7,7}/ )", but it doesn't change anything and it shouldn't actually because if $password is undefined, then "$password" is false, and we don't enter in the guilty block.
I've also tried to change the regular expression match to a simple "eq", but I have the exact same behaviour.
I'm really puzzled on this bug. My leaning goes toward a Perl bug... Any idea to prove me I'm wrong?
Thank you very much for you help.
Best regards,