node-ldapjs icon indicating copy to clipboard operation
node-ldapjs copied to clipboard

Callback never invoked when starttls fails

Open runemol opened this issue 6 years ago • 1 comments

When invoking starttls and it fails to etablish a TLS connection, e.g.:

const starttls = (config) => {
    const client = ldap.createClient({url: config.url});

    return new Promise((resolve, reject) => {
        client.starttls({}, [], (tlsErr) => {
            if (tlsErr) {
                log.error({stack: tlsErr.stack}, tlsErr.message, 'connecting to', config.url, 'failed');
                reject(tlsErr);
            } else {
                log.info('connected to', config.url);
                resolve(client);
            }
        });
    });
};

the callback for handling the error is never used. client.starttls({}, [], (tlsErr) returns false, but this can not be used for error handling since it shortcuts the asynchronous operations whether or not the connection is successful or not a failed connection.

runemol avatar Jan 18 '19 13:01 runemol

Would you be able to submit a PR for this?

jsumners avatar Aug 26 '19 13:08 jsumners

👋

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.

jsumners avatar Feb 22 '23 19:02 jsumners