ldapsearch() is not giving results

Certified Associate Developer

Hello,

I am trying to fetch the users or details of particular user from AD and I am using ldapsearch() to achieve this, but I am facing issues to fetch the results

 

I have created 'scsExternalSystemKey' ad.test with below details

username:<full DN>

password:<password>

 

ldapsearch(
  config: {
    scsExternalSystemKey: "ad.test",
    usePerUserCredentials: false,
    url: "ldap://<IP>:389/DC=PSIAPPIAN,DC=com"
    
  },
  searchFilter: "(&(ObjectClass=organizationalPerson)(uid=administrator)",
  attributes: {},
  pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: - 1
  )
)

 

Output:


LdapResponse
    success: true
    result: DataSubset
        startIndex: 1
        batchSize: -1
        sort: null (List of SortInfo)
        totalCount: 0
        data: null (List of Variant)
        identifiers: null (List of Variant)
    error: null (Text)

 

I have tried multiple filters to fetch the result but none are working. Highly appreciated if I get any pointers on this. Thanks in advance.

  Discussion posts and replies are publicly visible

Parents
  • kaushikr276 , Please add the list of attributes which you want to query from the LDAP server in the attributes parameter and try, 

    Eg. 

    ldapsearch(
      config: {
        scsExternalSystemKey: "ad.test",
        usePerUserCredentials: false,
        url: "ldap://<IP>:389/DC=PSIAPPIAN,DC=com"
        
      },
      searchFilter: "(&(ObjectClass=organizationalPerson)(uid=administrator)",
      attributes: {"givenName", "sn", "sAMAccountName", "mail"},
      pagingInfo: a!pagingInfo(
        startIndex: 1,
        batchSize: - 1
      )
    )

  • If this doesn't help,

    1. In the Config dictionary, add the baseDn parameter (eg. "OU=123,DC=xyz,DC=com")
    2. In the Config dictionary, add the timeout parameter and specify a higher value (eg. 10000) 
    3. Test the LDAP filter TEXT in a LDAP browser and make sure that you actually have a result for the given search filter in the specified OU and DC
    4. If your resultset is expected to be huge, try to reduce the volume of the result by adding additional filters. so that any kind of timeout if occurring can be avoided. 
  • 0
    Certified Associate Developer
    in reply to Raghuvaran Nagarajan

    raghuvarann Thanks for the reply, I tried adding attributes to search. I also made changes in config dictionary by adding timeout parameter, but it doesn't work (even search of single user also not giving result)

    When I do search in jxplorer and other tools I get desired result.

    And also I tried to add baseDN param in config but it gives me connection issue but when I append baseDN in URL it's able to connect.

    for eg in config.
    url: "ldap://<IP>:389/DC=PSIAPPIAN,DC=com" (This works)

    url: "ldap://<IP>:389"
    baseDN="DC=PSIAPPIAN,DC=com" (Fail to connect)

    I have also tried with configuring OU.
     
    Not sure where m I going wrong?

  •  

    Can you please share the masked code of your ldapsearch() function to help me understand the problem better? 

    Thanks,

    Raghu

  • 0
    Certified Associate Developer
    in reply to Raghuvaran Nagarajan
    Third-Party Credentials
    -----------------------
    UserName: CN=admin,OU=Dev,DC=PSIAPPIAN,DC=com
    Password: <pwd>

    Request:
    =ldapsearch(
    config: {
    scsExternalSystemKey: "ldap.test",
    usePerUserCredentials: false,
    timeout: 10000,
    url: "ldap://<IP>:389/OU=Dev,DC=PSIAPPIAN,DC=com"
    /*baseDN: "DC=PSIAPPIAN,DC=com"*/
    },
    searchFilter: "(objectClass=person)",
    /*searchFilter:"(&(objectCategory=*)(cn=admin))"*/
    attributes: {"givenName", "sn", "sAMAccountName", "mail"},
    pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: - 1
    )
    )

    Response:
    success: true
    result: DataSubset
    startIndex: 1
    batchSize: -1
    sort: null (List of SortInfo)
    totalCount: 0
    data: null (List of Variant)
    identifiers: null (List of Variant)
    error: null (Text)


    Request:
    =ldapsearch(
    config: {
    scsExternalSystemKey: "ldap.test",
    usePerUserCredentials: false,
    timeout: 10000,
    url: "ldap://<IP>:389"
    baseDN: "DC=PSIAPPIAN,DC=com"
    /*baseDN: "OU=dev,DC=PSIAPPIAN,DC=com"*/
    },
    searchFilter: "(objectClass=person)",
    /*searchFilter:"(&(objectCategory=*)(cn=admin))"*/
    attributes: {"givenName", "sn", "sAMAccountName", "mail"},
    pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: - 1
    )
    )

    Response:
    success: false
    result: null (DataSubset)
    error: "Failed to request page: javax.naming.NameNotFoundException:
    [LDAP: error code 32 - 0000208D: NameErr: DSID-03100213, problem 2001 (NO_OBJECT), data 0, best match of:
    ''
    ]; remaining name ''"
  • 0
    Certified Associate Developer
    in reply to Raghuvaran Nagarajan
    Hey rahuvarann,

    I'm also getting the same issue where result shows success but its not returning any datasubset,
  • 0
    Certified Lead Developer
    in reply to viveku3486
    I have created custom function plugin and it works fine however ldapsearch() fails with same parameters. Appian wont allow further function for same functionality otherwise i can publish it in App Market.
Reply Children
No Data