Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

LDAPJS keeps trying to connect to LDAP when no bind attempt occurs #375

Closed
jontowles opened this issue May 24, 2016 · 3 comments
Closed

Comments

@jontowles
Copy link

I have taken multiple Packet Captures trying to figure out why ECONNRESET's occur.

I have found that even though you are not attempting to do any binds or LDAP actions that LDAPJS will try to connect to our LDAP server and eventually disconnect and just keep trying to re-connect.

This behavior doesn't seem to be by design. Can we get some clarification on this?

@tastypackets
Copy link

tastypackets commented Feb 14, 2018

I was fighting with this recently and after reviewing the client file in the library I realized the idle event wasn't being emitted if I didn't create a bind first. I haven't spent too much time reviewing this code to see what is going on, but if I have time one day maybe I can create a pull request. For now I will likely default back to using OpenLDAP library.

You can hook up to the idle event like so:

const client = ldap.createClient({
    url: `ldap://my-dc`,
    idleTimeout: 10 // Close due to inactivity
});

client.on('idle', event => {
    console.log("Timed out")
});

// Timed out is never printed

The result of this was I never received a idle event, so I decided to put a test bind in there and I started to received the idle event.

const ldap = require('ldapjs');
const client = ldap.createClient({
    url: `ldap://my-dc`,
    idleTimeout: 10 // Close due to inactivity
});

client.bind("user@domain.com","Password", (err,res) => {
    if(err)
        console.log(err)
});

client.on('idle', event => {
    console.log("Timed out")
});

// Console now prints Timed out

@jsumners
Copy link
Member

It sounds like the library assumes every connection will at least perform an anonymous bind before issuing any other messages. And this assumption leads to the idle code relying on the bind to be performed before it kicks in. I'd consider a PR that changes this or at least one that documents this behavior.

@jsumners
Copy link
Member

👋

On February 22, 2023, we released version 3 of this library. As a result, we are closing this issue/pull request.

Please see issue #839 for more information, including how to proceed if you feel this closure is in error.

@ldapjs ldapjs locked as resolved and limited conversation to collaborators Feb 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants