Allow simple client bind with empty credentials

Fix mcavage/node-ldapjs#254
This commit is contained in:
Matt Simerson 2015-04-13 20:55:02 -07:00 committed by Patrick Mooney
parent 773a1c6fd2
commit 19f2c16783
4 changed files with 12 additions and 2 deletions

View File

@ -28,6 +28,7 @@
- Add options for format preservation
- Removed `spaced()` and `rndSpaced` from DN API
- Fix parent/child rules regarding empty DNs
- #254 Allow simple client bind with empty credentials
## 0.7.1

View File

@ -465,7 +465,7 @@ Client.prototype.bind = function bind(name,
_bypass) {
if (typeof (name) !== 'string' && !(name instanceof dn.DN))
throw new TypeError('name (string) required');
assert.string(credentials, 'credentials');
assert.optionalString(credentials, 'credentials');
if (typeof (controls) === 'function') {
callback = controls;
controls = [];

View File

@ -8,7 +8,8 @@
"Yunong Xiao <yunong@joyent.com>",
"Denis Vuyka <denis.vuyka@gmail.com>",
"Pedro Palazón <kusorbox@gmail.com>",
"Patrick Mooney <patrick.f.mooney@gmail.com>"
"Patrick Mooney <patrick.f.mooney@gmail.com>",
"Matt Simerson <matt@tnpi.net>"
],
"name": "ldapjs",
"homepage": "http://ldapjs.org",

View File

@ -274,6 +274,14 @@ test('simple bind success', function (t) {
});
});
test('simple anonymous bind (empty credentials)', function (t) {
client.bind('', '', function (err, res) {
t.ifError(err);
t.ok(res);
t.equal(res.status, 0);
t.end();
});
});
test('auto-bind bad credentials', function (t) {
var clt = ldap.createClient({