yoavs 2004/09/20 09:11:51 Modified: catalina/src/share/org/apache/catalina/realm Tag: TOMCAT_5_0 JAASRealm.java webapps/docs Tag: TOMCAT_5_0 changelog.xml Log: Bugzilla 30869 initial implementation. Revision Changes Path No revision No revision 1.6.2.2 +32 -3 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/realm/JAASRealm.java Index: JAASRealm.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/realm/JAASRealm.java,v retrieving revision 1.6.2.1 retrieving revision 1.6.2.2 diff -u -r1.6.2.1 -r1.6.2.2 --- JAASRealm.java 21 Aug 2004 15:49:53 -0000 1.6.2.1 +++ JAASRealm.java 20 Sep 2004 16:11:47 -0000 1.6.2.2 @@ -189,10 +189,14 @@ public void setContainer(Container container) { super.setContainer(container); - String name=container.getName(); + if( appName==null ) { + String name=container.getName(); + name = makeLegalForJAAS(name); + appName=name; - log.info("Setting JAAS app name " + appName); + + log.info("Set JAAS app name " + appName); } } @@ -451,6 +455,31 @@ return (null); } } + /** + * Ensure the given name is legal for JAAS configuration. + * Added for Bugzilla 30869, made protected for easy customization + * in case my implementation is insufficient, which I think is + * very likely. + * + * @param src The name to validate + * @return A string that's a valid JAAS realm name + */ + protected String makeLegalForJAAS(final String src) { + String result = src; + + // Default name is "other" per JAAS spec + if(result == null) { + result = "other"; + } + + // Strip leading slash if present, as Sun JAAS impl + // barfs on it (see Bugzilla 30869 bug report). + if(result.startsWith("/")) { + result = result.substring(1); + } + + return result; + } // ------------------------------------------------------ Lifecycle Methods No revision No revision 1.70.2.35 +3 -1 jakarta-tomcat-catalina/webapps/docs/changelog.xml Index: changelog.xml =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/docs/changelog.xml,v retrieving revision 1.70.2.34 retrieving revision 1.70.2.35 diff -u -r1.70.2.34 -r1.70.2.35 --- changelog.xml 17 Sep 2004 19:52:04 -0000 1.70.2.34 +++ changelog.xml 20 Sep 2004 16:11:47 -0000 1.70.2.35 @@ -34,7 +34,6 @@ Use CatalinaDigester on shutdown so you can use a sytem property to configure the port. (funkman) </update> - <update> <fix> <bug>28914</bug>: threadPriority attribute ignored. (yoavs) </fix> @@ -73,6 +72,9 @@ </fix> <fix> Set the FORM notes even when caching so that clustering with SSO works properly. (remm) + </fix> + <fix> + <bug>30869</bug>: Make sure JAAS realm name is legal. (yoavs) </fix> </changelog> </subsection>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]