call unbind

This commit is contained in:
Girish Ramakrishnan
2019-10-25 16:58:15 -07:00
parent ade1187fc8
commit 13262d014b
+8 -2
View File
@@ -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();
});
});