[jboss-cvs] JBossAS SVN: r110355 - projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/main/java/org/jboss/security/auth/spi.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jan 13 14:31:17 EST 2011


Author: mmoyses
Date: 2011-01-13 14:31:17 -0500 (Thu, 13 Jan 2011)
New Revision: 110355

Modified:
   projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/main/java/org/jboss/security/auth/spi/LdapExtLoginModule.java
Log:
SECURITY-552: tweaking parse option

Modified: projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/main/java/org/jboss/security/auth/spi/LdapExtLoginModule.java
===================================================================
--- projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/main/java/org/jboss/security/auth/spi/LdapExtLoginModule.java	2011-01-13 19:02:09 UTC (rev 110354)
+++ projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/main/java/org/jboss/security/auth/spi/LdapExtLoginModule.java	2011-01-13 19:31:17 UTC (rev 110355)
@@ -251,6 +251,8 @@
          try
          {
             String username = getUsername();
+            if (trace)
+               log.trace("Binding username: " + username);
             createLdapInitContext(username, null);
             defaultRole();
          }
@@ -681,9 +683,13 @@
          int beginIndex = 0;
          if (usernameBeginString != null && !usernameBeginString.equals(""))
             beginIndex = username.indexOf(usernameBeginString) + usernameBeginString.length();
+         if (beginIndex == -1) // not allowed. reset
+            beginIndex = 0;
          int endIndex = username.length();
          if (usernameEndString != null && !usernameEndString.equals(""))
-            endIndex = username.indexOf(usernameEndString);
+            endIndex = username.substring(beginIndex).indexOf(usernameEndString);
+         if (endIndex == -1) // not allowed. reset
+            endIndex = username.length();
          username = username.substring(beginIndex, endIndex);
       }
       return username;



More information about the jboss-cvs-commits mailing list