From: <jbo...@li...> - 2005-11-28 21:49:52
|
Author: rem...@jb... Date: 2005-11-28 16:49:46 -0500 (Mon, 28 Nov 2005) New Revision: 1658 Modified: trunk/labs/jbossweb/src/share/classes/org/apache/catalina/authenticator/DigestAuthenticator.java Log: - Patch for bugzilla 37132. Modified: trunk/labs/jbossweb/src/share/classes/org/apache/catalina/authenticator/DigestAuthenticator.java =================================================================== --- trunk/labs/jbossweb/src/share/classes/org/apache/catalina/authenticator/DigestAuthenticator.java 2005-11-28 20:46:40 UTC (rev 1657) +++ trunk/labs/jbossweb/src/share/classes/org/apache/catalina/authenticator/DigestAuthenticator.java 2005-11-28 21:49:46 UTC (rev 1658) @@ -1,5 +1,5 @@ /* - * Copyright 1999,2004 The Apache Software Foundation. + * Copyright 1999,2004-2005 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,7 +43,7 @@ * * @author Craig R. McClanahan * @author Remy Maucherat - * @version $Revision: 303620 $ $Date: 2005-01-07 10:45:19 +0100 (ven., 07 janv. 2005) $ + * @version $Revision: 349499 $ $Date: 2005-11-28 21:49:42 +0100 (lun., 28 nov. 2005) $ */ public class DigestAuthenticator @@ -221,10 +221,9 @@ return (null); authorization = authorization.substring(7).trim(); + // Bugzilla 37132: http://issues.apache.org/bugzilla/show_bug.cgi?id=37132 + String[] tokens = authorization.split(",(?=(?:[^\"]*\"[^\"]*\")+$)"); - StringTokenizer commaTokenizer = - new StringTokenizer(authorization, ","); - String userName = null; String realmName = null; String nOnce = null; @@ -235,8 +234,11 @@ String response = null; String method = request.getMethod(); - while (commaTokenizer.hasMoreTokens()) { - String currentToken = commaTokenizer.nextToken(); + for (int i = 0; i < tokens.length; i++) { + String currentToken = tokens[i]; + if (currentToken.length() == 0) + continue; + int equalSign = currentToken.indexOf('='); if (equalSign < 0) return null; |