Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=37984
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 1 Jul 2009 22:13:33 +0000 (22:13 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 1 Jul 2009 22:13:33 +0000 (22:13 +0000)
Strip {MD5} as well as {SHA} from digested passwords

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@790405 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/realm/JNDIRealm.java

index 2206e43..f1c95fd 100644 (file)
@@ -1419,10 +1419,10 @@ public class JNDIRealm extends RealmBase {
 
         boolean validated = false;
         if (hasMessageDigest()) {
-            // iPlanet support if the values starts with {SHA1}
+            // Some directories prefix the password with the hash type
             // The string is in a format compatible with Base64.encode not
             // the Hex encoding of the parent class.
-            if (password.startsWith("{SHA}")) {
+            if (password.startsWith("{MD5}") || password.startsWith("{SHA}")) {
                 /* sync since super.digest() does this same thing */
                 synchronized (this) {
                     password = password.substring(5);