Fixed a NullPointerException case on Digest authentication.

Could occur when upgrading from a Debian package configured with Basic
authentication (as in release 1.92.9000) to a more recent one with
Digest authentication, without having re-encoded the admin password (for
example with dpkg-reconfigure).

As reported by eros on YaCy forum
(http://forum.yacy-websuche.de/viewtopic.php?f=23&t=5988#p33686).
pull/122/head
luccioman 8 years ago
parent b65a04087b
commit aa55d71cf5

@ -65,8 +65,11 @@ public class YaCyLegacyCredential extends Credential {
public boolean check(Object credentials) {
if (credentials instanceof Credential) { // for DIGEST auth
return ((Credential) credentials).check(c);
if(this.c == null) {
/* credential may be null after switching from BASIC to DIGEST authentication without re-encoding the password */
return false;
}
return ((Credential) credentials).check(this.c);
}
if (credentials instanceof String) { // for BASIC auth
final String pw = (String) credentials;

Loading…
Cancel
Save