Skip to content

Commit

Permalink
Unbind clients when closing
Browse files Browse the repository at this point in the history
Previously no client was unbound (see trentm#3), now
unbinding both without keeping track if they were actually bound as this
seems to be working (and also destroy-method in ldapjs' connection pool
does so).
  • Loading branch information
vesse committed Aug 22, 2013
1 parent aba95c5 commit c232808
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/ldapauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,12 @@ function LdapAuth(opts) {


LdapAuth.prototype.close = function (callback) {
if (! this._adminBound) {
callback()
} else {
this._adminClient.unbind(function (err) {
callback(err);
});
}
var self = this;
// It seems to be OK just to call unbind regardless of if the
// client has been bound (e.g. how ldapjs pool destroy does)
self._adminClient.unbind(function(err) {
self._userClient.unbind(callback);
});
}


Expand All @@ -117,6 +116,7 @@ LdapAuth.prototype._adminBind = function (callback) {
self.log && self.log.trace('ldap authenticate: bind error: %s', err);
return callback(err);
}
self._adminBound = true;
return callback();
});
}
Expand Down

0 comments on commit c232808

Please sign in to comment.