call unbind
This commit is contained in:
+8
-2
@@ -83,8 +83,8 @@ function testConfig(config, callback) {
|
||||
if (error) return callback(new BoxError(BoxError.EXTERNAL_ERROR, error));
|
||||
|
||||
result.on('searchEntry', function (/* entry */) {});
|
||||
result.on('error', function (error) { callback(new BoxError(BoxError.BAD_FIELD, `Unable to search directory: ${error.message}`)); });
|
||||
result.on('end', function (/* result */) { callback(); });
|
||||
result.on('error', function (error) { client.unbind(); callback(new BoxError(BoxError.BAD_FIELD, `Unable to search directory: ${error.message}`)); });
|
||||
result.on('end', function (/* result */) { client.unbind(); callback(); });
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -179,6 +179,11 @@ function sync(progressCallback, callback) {
|
||||
|
||||
const username = user[externalLdapConfig.usernameField];
|
||||
|
||||
if (!username) {
|
||||
debug(`[empty username] username=${username} email=${user.mail} cn=${user.cn} usernameField=${externalLdapConfig.usernameField}`);
|
||||
return iteratorCallback();
|
||||
}
|
||||
|
||||
users.getByUsername(username, function (error, result) {
|
||||
if (error && error.reason !== BoxError.NOT_FOUND) {
|
||||
debug(`Could not find user with username ${username}: ${error.message}`);
|
||||
@@ -213,6 +218,7 @@ function sync(progressCallback, callback) {
|
||||
});
|
||||
}, function () {
|
||||
debug('User sync done.');
|
||||
client.unbind();
|
||||
callback();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user