diff --git a/CHANGES.md b/CHANGES.md index 859e3ca..ac3e01e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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 diff --git a/lib/client/client.js b/lib/client/client.js index 221dcc2..f90dc82 100644 --- a/lib/client/client.js +++ b/lib/client/client.js @@ -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 = []; diff --git a/package.json b/package.json index 8550d46..0de4996 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "Yunong Xiao ", "Denis Vuyka ", "Pedro Palazón ", - "Patrick Mooney " + "Patrick Mooney ", + "Matt Simerson " ], "name": "ldapjs", "homepage": "http://ldapjs.org", diff --git a/test/client.test.js b/test/client.test.js index 788e68a..ca38f53 100644 --- a/test/client.test.js +++ b/test/client.test.js @@ -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({