Minor client argument fixes, and broken search response send() with no filtering option

This commit is contained in:
Mark Cavage 2011-10-18 12:31:52 -07:00
parent 03dad8c9a1
commit a80758b917
3 changed files with 8 additions and 7 deletions

View File

@ -156,7 +156,7 @@ module.exports = Client;
* @throws {TypeError} on invalid input. * @throws {TypeError} on invalid input.
*/ */
Client.prototype.bind = function(name, credentials, controls, callback, conn) { 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'); throw new TypeError('name (string) required');
if (typeof(credentials) !== 'string') if (typeof(credentials) !== 'string')
throw new TypeError('credentials (string) required'); throw new TypeError('credentials (string) required');
@ -172,7 +172,7 @@ Client.prototype.bind = function(name, credentials, controls, callback, conn) {
var self = this; var self = this;
var req = new BindRequest({ var req = new BindRequest({
name: dn.parse(name), name: (typeof(name) === 'string') ? dn.parse(name) : name,
authentication: 'Simple', authentication: 'Simple',
credentials: credentials, credentials: credentials,
controls: controls controls: controls
@ -486,7 +486,7 @@ Client.prototype.modifyDN = function(name, newName, controls, callback) {
* @throws {TypeError} on invalid input. * @throws {TypeError} on invalid input.
*/ */
Client.prototype.search = function(base, options, controls, callback) { 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'); throw new TypeError('base (string) required');
if (Array.isArray(options) || (options instanceof Control)) { if (Array.isArray(options) || (options instanceof Control)) {
controls = options; controls = options;
@ -520,7 +520,7 @@ Client.prototype.search = function(base, options, controls, callback) {
throw new TypeError('callback (function) required'); throw new TypeError('callback (function) required');
var req = new SearchRequest({ var req = new SearchRequest({
baseObject: dn.parse(base), baseObject: typeof(base) === 'string' ? dn.parse(base) : base,
scope: options.scope || 'base', scope: options.scope || 'base',
filter: options.filter, filter: options.filter,
derefAliases: Protocol.NEVER_DEREF_ALIASES, derefAliases: Protocol.NEVER_DEREF_ALIASES,

View File

@ -63,7 +63,7 @@ SearchResponse.prototype.send = function(entry, nofiltering) {
var _a = a.toLowerCase(); var _a = a.toLowerCase();
if (!nofiltering && _a.length && _a[0] === '_') { if (!nofiltering && _a.length && _a[0] === '_') {
delete entry.attributes[a]; delete entry.attributes[a];
} else if (self.notAttributes.indexOf(_a) !== -1) { } else if (!nofiltering && self.notAttributes.indexOf(_a) !== -1) {
delete entry.attributes[a]; delete entry.attributes[a];
} else if (all) { } else if (all) {
// noop // noop

View File

@ -3,7 +3,7 @@
"name": "ldapjs", "name": "ldapjs",
"homepage": "http://ldapjs.org", "homepage": "http://ldapjs.org",
"description": "LDAP client and server APIs", "description": "LDAP client and server APIs",
"version": "0.2.3", "version": "0.2.4",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git://github.com/mcavage/node-ldapjs.git" "url": "git://github.com/mcavage/node-ldapjs.git"
@ -13,9 +13,10 @@
"node": ">=0.4" "node": ">=0.4"
}, },
"dependencies": { "dependencies": {
"asn1": "~0.1.6", "asn1": "~0.1.7",
"buffertools": "~1.0.3", "buffertools": "~1.0.3",
"dtrace-provider": "~0.0.3", "dtrace-provider": "~0.0.3",
"nopt": "~1.0.10",
"sprintf": "~0.1.1" "sprintf": "~0.1.1"
}, },
"devDependencies": { "devDependencies": {