Bug 652800

Summary: Unable to use parentheses in search filters for LDAP configuration
Product: [JBoss] JBoss Operations Network Reporter: Marc Shirley <mshirley>
Component: Core ServerAssignee: RHQ Project Maintainer <rhq-maint>
Status: CLOSED ERRATA QA Contact: Sunil Kondkar <skondkar>
Severity: low Docs Contact:
Priority: unspecified    
Version: JON 3.1.2CC: fbrychta, jshaughn, loleary, miburman, skondkar, spinder, tfonteyn
Target Milestone: ER01Keywords: Improvement, TestCaseNeeded
Target Release: JON 3.3.3   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-30 12:41:16 EDT Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Description Flags
Screenshot none

Description Marc Shirley 2010-11-12 14:53:16 EST
Description of problem:
Currently, if parentheses are specified within the Group Search Filter, the LDAP search will return no results.  Removing the parentheses results in the correct results being returned.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. In LDAP configuration, set Group Search Filter property to below example, or equivalent for the LDAP environment:
Actual results:
No results are returned when attempting to assign LDAP groups to roles .

Expected results:
Expect that LDAP groups would be retrieved in the same manner as when the Group Search Filter does not use parentheses, such as in below example:
Comment 1 Charles Crouch 2010-12-01 17:39:46 EST
It would be nice to be a little more lax in this case since I would expect the extra brackets are ignored by most ldap query tools, and we should aim to act similarly here.
Comment 2 Charles Crouch 2011-09-30 13:47:44 EDT
FutureFeature Improvement
Comment 3 Tom Fonteyne 2013-07-19 08:00:09 EDT
We have hit this now also with JON 3.1.2 and newer versions of Java.

In older versions of Java this failed silently and no groups were returned.

In newer versions, we tested with 1.6.0_45 and 1.7.0_17, Java actually will throw an exception:

ERROR [org.rhq.enterprise.server.resource.group.LdapGroupManagerBean] The ldap group filter defined is invalid
javax.naming.directory.InvalidSearchFilterException: invalid attribute description; remaining name 'dc=jbossuk,dc=redhat,dc=com'
        at com.sun.jndi.ldap.Filter.encodeSimpleFilter(Filter.java:446)
        at com.sun.jndi.ldap.Filter.encodeFilter(Filter.java:146)
        at com.sun.jndi.ldap.Filter.encodeFilterString(Filter.java:74)
Comment 4 Jay Shaughnessy 2014-06-30 15:47:02 EDT
Simeon, any idea of this was ever enhaced?
Comment 5 Simeon Pinder 2014-09-17 09:13:38 EDT
We have not yet fixed/relaxed this handling.  It should just be a matter of checking for brackets and not adding them when they are already there with the underlying query.  I suspect the customers would like to add more complicated LDAP group logic here. Currently focused on JON 3.3 so not sure how soon we'll get to this.
Comment 7 Larry O'Leary 2015-01-05 12:52:42 EST
This is considered a bug as parenthesis are a standard part of a directory search query. The problem here is that JBoss ON is adding parenthesis when it shouldn't. As comment 5 indicates, the expected behavior here is if no parenthesis are provided by the user/configuration, they get implicitly added.
Comment 8 Michael Burman 2015-06-24 14:12:29 EDT
This looks like a duplicate of BZ 784164, which was fixed. Can someone verify that the bug really exists in JON 3.3?
Comment 9 Sunil Kondkar 2015-07-14 05:08:18 EDT
Verified on JBoss ON 3.3.3 ER01 build and Windows server 2008 active directory.

In LDAP configuration, set Group Search Filter property to (objectclass=group)
The LDAP configuration is saved successfully without exception.

Results are returned while attempting to assign LDAP groups to roles. Also verified that the results filter in available groups is working. Please refer the attached screenshot.
Comment 10 Sunil Kondkar 2015-07-14 05:09:08 EDT
Created attachment 1051704 [details]
Comment 11 Sunil Kondkar 2015-07-14 05:26:17 EDT
Test case added:
Comment 13 errata-xmlrpc 2015-07-30 12:41:16 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.