Integrator OpenLDAPService Multiple Filters

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
jyoung
Posts: 694
Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA

Integrator OpenLDAPService Multiple Filters

Post 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"
LANSAGuru
Posts: 69
Joined: Thu Mar 24, 2016 5:31 am

Re: Integrator OpenLDAPService Multiple Filters

Post 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)'
jyoung
Posts: 694
Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA

Re: Integrator OpenLDAPService Multiple Filters

Post 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
Post Reply