[
http://jira.jboss.com/jira/browse/JBAS-3438?page=comments#action_12341066 ]
R←mi Flament commented on JBAS-3438:
------------------------------------
Here is a patch which correct the problem (at least in our configuration) :
### Eclipse Workspace Patch 1.0
#P jbosssx
Index: src/main/org/jboss/security/auth/spi/LdapExtLoginModule.java
===================================================================
RCS file:
/cvsroot/jboss/jbosssx/src/main/org/jboss/security/auth/spi/LdapExtLoginModule.java,v
retrieving revision 1.7
diff -u -r1.7 LdapExtLoginModule.java
--- src/main/org/jboss/security/auth/spi/LdapExtLoginModule.java 5 May 2006 20:55:08
-0000 1.7
+++ src/main/org/jboss/security/auth/spi/LdapExtLoginModule.java 11 Aug 2006 13:54:26
-0000
@@ -404,7 +404,19 @@
while (results.hasMore())
{
SearchResult sr = (SearchResult) results.next();
- String dn = sr.getName() + "," + rolesCtxDN;
+ String dn = null;
+ String srName = sr.getName();
+
+ // JBAS-3438
+ if (srName.endsWith("\""))
+ {
+ dn = srName.substring(0,srName.length() - 1) + "," + rolesCtxDN +
"\"";
+ }
+ else
+ {
+ dn = srName + "," + rolesCtxDN;
+ }
+
String[] attrNames = {roleAttributeID};
Attributes result = ctx.getAttributes(dn, attrNames);
if( result != null && result.size() > 0 )
LdapExtLoginModule does not handle roles containing '/'
correctly
-----------------------------------------------------------------
Key: JBAS-3438
URL:
http://jira.jboss.com/jira/browse/JBAS-3438
Project: JBoss Application Server
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: Security
Affects Versions: JBossAS-4.0.3 SP1
Environment: RedHat Enterprise, JDK 5, Microsoft Active Directory
Reporter: Keith Johnston
Assigned To: Scott M Stark
Attachments: ldap-jboss.patch
File: /jbosssx/src/main/org/jboss/security/auth/spi/LdapExtLoginModule.java (revision
1.7)
Method: protected void rolesSearch(InitialLdapContext ctx, SearchControls constraints,
String user, String userDN, int recursionMax, int nesting)
Line: 407 "String dn = sr.getName() + "," + rolesCtxDN;"
Summary:
Under some conditions the string returned by sr.getName() may include inverted commas
("). When the dn variable is created by concatenating sr.getName() with rolesCtxDN
the inverted comma is placed in the middle of the dn string. When ctx.getAttributes(dn,
attrNames) is called (on line 409) an InvalidNameException is thrown. The exception is
generated by the javax.naming.NameImpl, reporting "close quote appears before end of
component".
Conditions:
This problem seems to occur when a '/' character is present in the name of the
search result. In other words, under MS active directory if the name is of the form
'abc/def' it will be returned surrounded by inverted commas ie
'"abc/def"'.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira