Try both Unix crypt and Stefan's new MD5 encoding for authentication.
This commit is contained in:
parent
7041bf08e7
commit
c88ac35c17
1 changed files with 12 additions and 3 deletions
|
@ -31,9 +31,18 @@ public class CryptFile {
|
||||||
users.clear ();
|
users.clear ();
|
||||||
String realpw = users.getProperty (username);
|
String realpw = users.getProperty (username);
|
||||||
if (realpw != null) {
|
if (realpw != null) {
|
||||||
// check if password matches
|
try {
|
||||||
String cryptpw = Crypt.crypt (realpw, pw);
|
// check if password matches
|
||||||
return realpw.equals (cryptpw);
|
// first we try with unix crypt algorithm
|
||||||
|
String cryptpw = Crypt.crypt (realpw, pw);
|
||||||
|
if (realpw.equals (cryptpw))
|
||||||
|
return true;
|
||||||
|
// then try MD5
|
||||||
|
if (realpw.equals (MD5Encoder.encode (pw)))
|
||||||
|
return true;
|
||||||
|
} catch (Exception x) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (parentFile != null)
|
if (parentFile != null)
|
||||||
return parentFile.authenticate (username, pw);
|
return parentFile.authenticate (username, pw);
|
||||||
|
|
Loading…
Add table
Reference in a new issue