yoavs       2004/09/20 08:57:55

  Modified:    catalina/src/share/org/apache/catalina/realm JAASRealm.java
               webapps/docs changelog.xml
  Log:
  Bugzilla 30869 initial implementation.
  
  Revision  Changes    Path
  1.8       +33 -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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JAASRealm.java    28 Jul 2004 21:31:16 -0000      1.7
  +++ JAASRealm.java    20 Sep 2004 15:57:55 -0000      1.8
  @@ -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,32 @@
               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
  
  
  
  1.108     +3 -0      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.107
  retrieving revision 1.108
  diff -u -r1.107 -r1.108
  --- changelog.xml     17 Sep 2004 19:50:19 -0000      1.107
  +++ changelog.xml     20 Sep 2004 15:57:55 -0000      1.108
  @@ -37,6 +37,9 @@
         <fix>
           Give proper permission to the balancer app when running under the security 
manager. (jfarcand)
         </fix>
  +      <fix>
  +        <bug>30869</bug>: Make sure JAAS realm name is legal. (yoavs)
  +      </fix>
     </subsection>
   
     <subsection name="Coyote">
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to