1

I am an LDAP newbie.

I am using nodejs's ldapauth and I keep getting 32 - No Such Object.

Here is my code :

var LdapAuth = require('ldapauth');
var ldapOptions = {
    "url":"ldap://my-host:389",
    "adminDn" : "cn=manager,dc=guycrc,dc=com",
    "adminPassword":"secret",
    "searchBase":"ou=Engineering",
    "searchFilter":"(uid={{username}})"
};

var ldapAuthClient = new LdapAuth( ldapOptions );

ldapAuthClient.authenticate('Dana', 'Dana',
    function(err, result) {
        if (err) {
            console.log(['Error',err.code, err.dn, err.message ]);
        } else {
            console.log('Credentials valid = ' + result); // true or false
        }
    }
);

This is my LDAP info - what I think is relevant for the question

dn: cn=Dana,ou=people,dc=guycrc,dc=com
...
cn: Dana Dana
sn: Dana
uid: Dana
userpassword: Dana
ou: Engineering


dn: cn=CompanyA,ou=groups,dc=guycrc,dc=com
...
cn: CompanyA
ou: Groups
member: cn=Dana,ou=people,dc=guycrc,dc=com

Why am I getting No Such Object all the time?

2 Answers 2

2

Not being sure what the .authenticate is meant to do in your line: ldapAuthClient.authenticate('Dana', 'Dana',

I would guess that the data passed is not sufficient to find the required object, per the error.

Looking at your defined options:

"searchBase":"ou=Engineering",
"searchFilter":"(uid={{username}})"

Means that it is looking in the ou=engineering container. And looking for a uid that matches username, so probably the 'Dana' as the uid part is correct.

But since your LDIF shows Dana with the DN: dn: cn=Dana,ou=people,dc=guycrc,dc=com

Not in an ou=engineering.

Perhaps it as simple as changing your searchBase to ou=people,dc=guycrc,dc=com

Sign up to request clarification or add additional context in comments.

2 Comments

I modified "searchBase" to "dc=guycrc,dc=com" and it worked. does this sound logical?
@guymograbi Yes, changing the searchbase as you did looks much better. basically it is telling LDAP where to start looking from and down deeper. Needs to be a valid starting point.
2

The search base object ou=engineering is probably not what is intended, that value does not look like a DN, but rather like an RDN. Use the complete and correct search base object, which will be a DN superior to the objects for which the client searches.

see also

1 Comment

The link you gave me looks like a really good resource for LDAP. Do you have any more like it? I am looking for a short read on the basics.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.