From 95bc10934a8307520f19744ee96b40cdea1b14ed Mon Sep 17 00:00:00 2001 From: Mark Cavage Date: Tue, 18 Oct 2011 16:26:38 -0700 Subject: [PATCH] Include CLI in npm bundle --- bin/ldapjs-search | 13 ++++++++++++- package.json | 6 +++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/bin/ldapjs-search b/bin/ldapjs-search index 2feac0e..b326083 100755 --- a/bin/ldapjs-search +++ b/bin/ldapjs-search @@ -33,12 +33,14 @@ var opts = { 'debug': Number, 'base': ldap.DN, 'binddn': ldap.DN, + 'control': Array, 'password': String, 'scope': String, 'url': url }; var shortOpts = { + 'c': ['--control'], 'd': ['--debug'], 'b': ['--base'], 'D': ['--binddn'], @@ -117,6 +119,8 @@ if (!parsed.password) parsed.password = ''; if (!parsed.base) parsed.base = ''; +if (!parsed.control) + parsed.control = []; var client = ldap.createClient({ url: parsed.url, @@ -131,12 +135,19 @@ client.bind(parsed.binddn, parsed.password, function(err, res) { if (err) perror(err); + var controls = []; + parsed.control.forEach(function(c) { + controls.push(new ldap.Control({ + type: c, + criticality: true + })); + }); var req = { scope: parsed.scope || 'sub', filter: parsed.argv.remain[0], attributes: parsed.argv.remain.length > 1 ? parsed.argv.remain.slice(1) : [] }; - client.search(parsed.base, req, function(err, res) { + client.search(parsed.base, req, controls, function(err, res) { if (err) perror(err); diff --git a/package.json b/package.json index 861dfb8..a3ea233 100644 --- a/package.json +++ b/package.json @@ -3,12 +3,16 @@ "name": "ldapjs", "homepage": "http://ldapjs.org", "description": "LDAP client and server APIs", - "version": "0.2.4", + "version": "0.2.5", "repository": { "type": "git", "url": "git://github.com/mcavage/node-ldapjs.git" }, "main": "lib/index.js", + "directories": { + "bin": "./bin", + "lib": "./lib" + }, "engines": { "node": ">=0.4" },