diff --git a/lib/client.js b/lib/client.js index 5d01af5..8945099 100644 --- a/lib/client.js +++ b/lib/client.js @@ -156,7 +156,7 @@ module.exports = Client; * @throws {TypeError} on invalid input. */ Client.prototype.bind = function(name, credentials, controls, callback, conn) { - if (typeof(name) !== 'string') + if (typeof(name) !== 'string' && !(name instanceof dn.DN)) throw new TypeError('name (string) required'); if (typeof(credentials) !== 'string') throw new TypeError('credentials (string) required'); @@ -172,7 +172,7 @@ Client.prototype.bind = function(name, credentials, controls, callback, conn) { var self = this; var req = new BindRequest({ - name: dn.parse(name), + name: (typeof(name) === 'string') ? dn.parse(name) : name, authentication: 'Simple', credentials: credentials, controls: controls @@ -486,7 +486,7 @@ Client.prototype.modifyDN = function(name, newName, controls, callback) { * @throws {TypeError} on invalid input. */ Client.prototype.search = function(base, options, controls, callback) { - if (typeof(base) !== 'string') + if (typeof(base) !== 'string' && !(base instanceof dn.DN)) throw new TypeError('base (string) required'); if (Array.isArray(options) || (options instanceof Control)) { controls = options; @@ -520,7 +520,7 @@ Client.prototype.search = function(base, options, controls, callback) { throw new TypeError('callback (function) required'); var req = new SearchRequest({ - baseObject: dn.parse(base), + baseObject: typeof(base) === 'string' ? dn.parse(base) : base, scope: options.scope || 'base', filter: options.filter, derefAliases: Protocol.NEVER_DEREF_ALIASES, diff --git a/lib/messages/search_response.js b/lib/messages/search_response.js index 3403a62..d723f3b 100644 --- a/lib/messages/search_response.js +++ b/lib/messages/search_response.js @@ -63,7 +63,7 @@ SearchResponse.prototype.send = function(entry, nofiltering) { var _a = a.toLowerCase(); if (!nofiltering && _a.length && _a[0] === '_') { delete entry.attributes[a]; - } else if (self.notAttributes.indexOf(_a) !== -1) { + } else if (!nofiltering && self.notAttributes.indexOf(_a) !== -1) { delete entry.attributes[a]; } else if (all) { // noop diff --git a/package.json b/package.json index 9af24ff..861dfb8 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "name": "ldapjs", "homepage": "http://ldapjs.org", "description": "LDAP client and server APIs", - "version": "0.2.3", + "version": "0.2.4", "repository": { "type": "git", "url": "git://github.com/mcavage/node-ldapjs.git" @@ -13,9 +13,10 @@ "node": ">=0.4" }, "dependencies": { - "asn1": "~0.1.6", + "asn1": "~0.1.7", "buffertools": "~1.0.3", "dtrace-provider": "~0.0.3", + "nopt": "~1.0.10", "sprintf": "~0.1.1" }, "devDependencies": {