Page 1 of 1

Integrator OpenLDAPService Multiple Filters

Posted: Fri Jun 09, 2017 6:35 am
by jyoung
When using the SEARCH command on the OpenLDAPService, is it possible to specify multiple filters?

For example, I can run a command like this and it works (apologies for the ********* people get a little sensitive about this info getting exposed).

Code: Select all

#JSMXCMD := "SEARCH DN(OU=*********,OU=*********,OU=*********,DC=*********,DC=com) FILTER(objectClass=user) SCOPE(*SUB) SERVICE_LIST(dn)"
The LDAP ActiveDirectory documentation that I have found shows that you can format multiple attribute filters like

Code: Select all

(&(objectClass=person)(objectClass=user))
where the two filters get "AND'd" together.

Doing so in the above JSMXCMD however returns a "Filter Error". Not only that but the TRACE output seems to show that it gets cut off.

Code: Select all

Process    : *COMPONENT
Function   : *COMP
Partition  : SYS
Job Name   : JOB012876
Job User   : JRYOUNG
Job Number : 012876
Command    : SEARCH DN(OU=*********,OU=********,OU=**********,DC=********,DC=com) SERVICE_LIST(dn) FILTER(&(objectClass=user) ) SCOPE(*SUB) (objectClass=person)
Name   : OU=*********,OU=*********,OU=*********,DC=*********,DC=com
Scope  : sub
Filter : &(objectClass=user
Create search constraints
Alias dereference : never
Maximum search results : 1000
Search for results
Command    : ERROR "Filter Error"

Re: Integrator OpenLDAPService Multiple Filters

Posted: Thu Jan 04, 2018 7:57 am
by LANSAGuru
Joe,

The corruption is because the command is getting confused by the nested parenthesis.

See this from the doco..

http://docs.lansa.com/14/en/lansa093/in ... t=escaping

So a simple command

#JSMCMD := 'SEARCH DN(o=ibmteldir) FILTER(objectclass=person) SCOPE(*SUB) SERVICE_LIST(DN)'

With nested parenthesis () you need to use some double quotes

#JSMCMD := 'SEARCH DN(o=ibmteldir) FILTER("(&(objectCategory=person)(objectClass=user))") SCOPE(*SUB) SERVICE_LIST(DN)'

Re: Integrator OpenLDAPService Multiple Filters

Posted: Thu Jan 04, 2018 8:04 am
by jyoung
Ugh, you are right.

I updated the code to use double quotes:

Code: Select all

#JSMXCMD := ('SEARCH DN(&1) FILTER("&2") SCOPE(*SUB) SERVICE_LIST(DN)').Substitute( #SearchDN #Filter )
And it works fine.

Thanks,
Joe