]> WPIA git - gigi.git/blobdiff - lib/jetty/org/eclipse/jetty/util/security/Credential.java
updating jetty to jetty-9.2.16.v2016040
[gigi.git] / lib / jetty / org / eclipse / jetty / util / security / Credential.java
index 1feb604790f464a2b062c2f17d32564f230c1248..660116f545c0cdb1896eb4d47233782b3082ee3e 100644 (file)
@@ -1,6 +1,6 @@
 //
 //  ========================================================================
-//  Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
+//  Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd.
 //  ------------------------------------------------------------------------
 //  All rights reserved. This program and the accompanying materials
 //  are made available under the terms of the Eclipse Public License v1.0
@@ -160,17 +160,19 @@ public abstract class Credential implements Serializable
                         digest = __md.digest();
                     }
                     if (digest == null || digest.length != _digest.length) return false;
+                    boolean digestMismatch = false;
                     for (int i = 0; i < digest.length; i++)
-                        if (digest[i] != _digest[i]) return false;
-                    return true;
+                        digestMismatch |= (digest[i] != _digest[i]);
+                    return !digestMismatch;
                 }
                 else if (credentials instanceof MD5)
                 {
                     MD5 md5 = (MD5) credentials;
                     if (_digest.length != md5._digest.length) return false;
+                    boolean digestMismatch = false;
                     for (int i = 0; i < _digest.length; i++)
-                        if (_digest[i] != md5._digest[i]) return false;
-                    return true;
+                        digestMismatch |= (_digest[i] != md5._digest[i]);
+                    return !digestMismatch;
                 }
                 else if (credentials instanceof Credential)
                 {