the latest ldapjs is firmly in the insane shit camp, but I think I've massaged it into a working condition

This commit is contained in:
Matvey Aksenov 2015-11-23 21:27:00 +00:00
parent f74ee35d6d
commit 82b1769fc9
56 changed files with 351 additions and 227 deletions

View File

@ -1,14 +0,0 @@
{ buildNodePackage, nodePackages, pkgs }:
buildNodePackage {
name = "abbrev";
version = "1.0.7";
src = pkgs.fetchurl {
url = "http://registry.npmjs.org/abbrev/-/abbrev-1.0.7.tgz";
sha1 = "5b6035b2ee9d4fb5cf859f08a9be81b208491843";
};
deps = [];
meta = {
homepage = "https://github.com/isaacs/abbrev-js#readme";
description = "Like ruby's abbrev module, but in js";
};
}

View File

@ -1 +0,0 @@
1.0.7.nix

View File

@ -1,10 +1,10 @@
{ buildNodePackage, nodePackages, pkgs }:
buildNodePackage {
name = "asn1";
version = "0.2.1";
version = "0.2.3";
src = pkgs.fetchurl {
url = "http://registry.npmjs.org/asn1/-/asn1-0.2.1.tgz";
sha1 = "ecc73f75d31ea3c6ed9d47428db35fecc7b2c6dc";
url = "http://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz";
sha1 = "dac8787713c9966849fc8180777ebe9c1ddf3b86";
};
deps = [];
meta = {

View File

@ -1 +1 @@
0.2.1.nix
0.2.3.nix

View File

@ -0,0 +1,21 @@
{ buildNodePackage, nodePackages, pkgs }:
buildNodePackage {
name = "backoff";
version = "2.4.1";
src = pkgs.fetchurl {
url = "http://registry.npmjs.org/backoff/-/backoff-2.4.1.tgz";
sha1 = "2f68c50e0dd789dbefe24200a62efb04d2456d68";
};
deps = with nodePackages; [
precond_0-2-3
];
meta = {
description = "Fibonacci and exponential backoffs.";
keywords = [
"backoff"
"retry"
"fibonacci"
"exponential"
];
};
}

View File

@ -0,0 +1 @@
2.4.1.nix

View File

@ -1,26 +0,0 @@
{ buildNodePackage, nodePackages, pkgs }:
buildNodePackage {
name = "bunyan";
version = "0.22.1";
src = pkgs.fetchurl {
url = "http://registry.npmjs.org/bunyan/-/bunyan-0.22.1.tgz";
sha1 = "020c383bed625af5c6c8834dd8c4aca0dd0f765c";
};
deps = with nodePackages; [
dtrace-provider_0-2-8
mv_0-0-5
];
optionalDependencies = with nodePackages; [
dtrace-provider_0-2-8
mv_0-0-5
];
meta = {
description = "a JSON Logger library for node.js services";
keywords = [
"log"
"logging"
"log4j"
"json"
];
};
}

View File

@ -0,0 +1,30 @@
{ buildNodePackage, nodePackages, pkgs }:
buildNodePackage {
name = "bunyan";
version = "1.5.1";
src = pkgs.fetchurl {
url = "http://registry.npmjs.org/bunyan/-/bunyan-1.5.1.tgz";
sha1 = "5f6e7d44c43b952f56b0f41309e3ab12391b4e2d";
};
deps = with nodePackages; [
dtrace-provider_0-6-0
safe-json-stringify_1-0-3
mv_2-0-3
];
optionalDependencies = with nodePackages; [
dtrace-provider_0-6-0
safe-json-stringify_1-0-3
mv_2-0-3
];
meta = {
homepage = "https://github.com/trentm/node-bunyan";
description = "a JSON logging library for node.js services";
keywords = [
"log"
"logging"
"log4j"
"json"
"bunyan"
];
};
}

View File

@ -1 +1 @@
0.22.1.nix
1.5.1.nix

View File

@ -0,0 +1,24 @@
{ buildNodePackage, nodePackages, pkgs }:
buildNodePackage {
name = "dashdash";
version = "1.10.1";
src = pkgs.fetchurl {
url = "http://registry.npmjs.org/dashdash/-/dashdash-1.10.1.tgz";
sha1 = "0abf1af89a8f5129a81f18c2b35b21df22622f60";
};
deps = with nodePackages; [
assert-plus_0-1-5
];
meta = {
homepage = "https://github.com/trentm/node-dashdash";
description = "A light, featureful and explicit option parsing library.";
keywords = [
"option"
"parser"
"parsing"
"cli"
"command"
"args"
];
};
}

View File

@ -0,0 +1 @@
1.10.1.nix

View File

@ -1,12 +1,14 @@
{ buildNodePackage, nodePackages, pkgs }:
buildNodePackage {
name = "dtrace-provider";
version = "0.2.8";
version = "0.6.0";
src = pkgs.fetchurl {
url = "http://registry.npmjs.org/dtrace-provider/-/dtrace-provider-0.2.8.tgz";
sha1 = "e243f19219aa95fbf0d8f2ffb07f5bd64e94fe20";
url = "http://registry.npmjs.org/dtrace-provider/-/dtrace-provider-0.6.0.tgz";
sha1 = "0b078d5517937d873101452d9146737557b75e51";
};
deps = [];
deps = with nodePackages; [
nan_2-1-0
];
meta = {
homepage = "https://github.com/chrisa/node-dtrace-provider#readme";
description = "Native DTrace providers for node.js applications";

View File

@ -1 +1 @@
0.2.8.nix
0.6.0.nix

View File

@ -1,14 +1,15 @@
{ buildNodePackage, nodePackages, pkgs }:
buildNodePackage {
name = "extsprintf";
version = "1.0.0";
version = "1.2.0";
src = pkgs.fetchurl {
url = "http://registry.npmjs.org/extsprintf/-/extsprintf-1.0.0.tgz";
sha1 = "4d58b815ace5bebfc4ebf03cf98b0a7604a99b86";
url = "http://registry.npmjs.org/extsprintf/-/extsprintf-1.2.0.tgz";
sha1 = "5ad946c22f5b32ba7f8cd7426711c6e8a3fc2529";
};
deps = [];
devDependencies = [];
meta = {
homepage = "https://github.com/davepacheco/node-extsprintf";
description = "extended POSIX-style sprintf";
};
}

View File

@ -1 +1 @@
1.0.0.nix
1.2.0.nix

View File

@ -1,14 +0,0 @@
{ buildNodePackage, nodePackages, pkgs }:
buildNodePackage {
name = "json-schema";
version = "0.2.2";
src = pkgs.fetchurl {
url = "http://registry.npmjs.org/json-schema/-/json-schema-0.2.2.tgz";
sha1 = "50354f19f603917c695f70b85afa77c3b0f23506";
};
deps = [];
meta = {
description = "JSON Schema validation and specifications";
keywords = [ "json" "schema" ];
};
}

View File

@ -1,18 +0,0 @@
{ buildNodePackage, nodePackages, pkgs }:
buildNodePackage {
name = "jsprim";
version = "0.3.0";
src = pkgs.fetchurl {
url = "http://registry.npmjs.org/jsprim/-/jsprim-0.3.0.tgz";
sha1 = "cd13466ea2480dbd8396a570d47d31dda476f8b1";
};
deps = with nodePackages; [
json-schema_0-2-2
extsprintf_1-0-0
verror_1-3-3
];
devDependencies = [];
meta = {
description = "utilities for primitive JavaScript types";
};
}

View File

@ -1 +0,0 @@
0.3.0.nix

View File

@ -0,0 +1,16 @@
{ buildNodePackage, nodePackages, pkgs }:
buildNodePackage {
name = "ldap-filter";
version = "0.2.2";
src = pkgs.fetchurl {
url = "http://registry.npmjs.org/ldap-filter/-/ldap-filter-0.2.2.tgz";
sha1 = "f2b842be0b86da3352798505b31ebcae590d77d0";
};
deps = with nodePackages; [
assert-plus_0-1-5
];
meta = {
homepage = "http://ldapjs.org";
description = "API for handling LDAP-style filters";
};
}

View File

@ -1,24 +0,0 @@
{ buildNodePackage, nodePackages, pkgs }:
buildNodePackage {
name = "ldapjs";
version = "0.7.1";
src = pkgs.fetchurl {
url = "http://registry.npmjs.org/ldapjs/-/ldapjs-0.7.1.tgz";
sha1 = "684798a687640bab1afbd802cf532f30492dfb56";
};
deps = with nodePackages; [
asn1_0-2-1
nopt_2-1-1
bunyan_0-22-1
dtrace-provider_0-2-8
pooling_0-4-6
assert-plus_0-1-5
];
optionalDependencies = with nodePackages; [
dtrace-provider_0-2-8
];
meta = {
homepage = "http://ldapjs.org";
description = "LDAP client and server APIs";
};
}

View File

@ -0,0 +1,28 @@
{ buildNodePackage, nodePackages, pkgs }:
buildNodePackage {
name = "ldapjs";
version = "1.0.0";
src = pkgs.fetchurl {
url = "http://registry.npmjs.org/ldapjs/-/ldapjs-1.0.0.tgz";
sha1 = "1da2cd5bfb9cb103c1ba516938da971bc2bbc3f2";
};
deps = with nodePackages; [
ldap-filter_0-2-2
asn1_0-2-3
bunyan_1-5-1
once_1-3-2
vasync_1-6-3
dtrace-provider_0-6-0
backoff_2-4-1
assert-plus_0-1-5
verror_1-6-0
dashdash_1-10-1
];
optionalDependencies = with nodePackages; [
dtrace-provider_0-6-0
];
meta = {
homepage = "http://ldapjs.org";
description = "LDAP client and server APIs";
};
}

View File

@ -1 +1 @@
0.7.1.nix
1.0.0.nix

View File

@ -0,0 +1,20 @@
{ buildNodePackage, nodePackages, pkgs }:
buildNodePackage {
name = "minimist";
version = "0.0.8";
src = pkgs.fetchurl {
url = "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz";
sha1 = "857fcabfc3397d2625b8228262e86aa7a011b05d";
};
deps = [];
meta = {
homepage = "https://github.com/substack/minimist";
description = "parse argument options";
keywords = [
"argv"
"getopt"
"parser"
"optimist"
];
};
}

View File

@ -0,0 +1 @@
0.0.8.nix

View File

@ -0,0 +1,20 @@
{ buildNodePackage, nodePackages, pkgs }:
buildNodePackage {
name = "mkdirp";
version = "0.5.1";
src = pkgs.fetchurl {
url = "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz";
sha1 = "30057438eac6cf7f8c4767f38648d6697d75c903";
};
deps = with nodePackages; [
minimist_0-0-8
];
meta = {
homepage = "https://github.com/substack/node-mkdirp#readme";
description = "Recursively mkdir, like `mkdir -p`";
keywords = [
"mkdir"
"directory"
];
};
}

View File

@ -0,0 +1 @@
0.5.1.nix

View File

@ -1,13 +1,18 @@
{ buildNodePackage, nodePackages, pkgs }:
buildNodePackage {
name = "mv";
version = "0.0.5";
version = "2.0.3";
src = pkgs.fetchurl {
url = "http://registry.npmjs.org/mv/-/mv-0.0.5.tgz";
sha1 = "15eac759479884df1131d6de56bce20b654f5391";
url = "http://registry.npmjs.org/mv/-/mv-2.0.3.tgz";
sha1 = "e9ab707d71dc38de24edcc637a8e2f5f480c7f32";
};
deps = [];
deps = with nodePackages; [
ncp_0-6-0
mkdirp_0-5-1
rimraf_2-2-8
];
meta = {
homepage = "https://github.com/andrewrk/node-mv";
description = "fs.rename but works across devices. same as the unix utility 'mv'";
keywords = [
"mv"

View File

@ -1 +1 @@
0.0.5.nix
2.0.3.nix

View File

@ -0,0 +1,14 @@
{ buildNodePackage, nodePackages, pkgs }:
buildNodePackage {
name = "nan";
version = "2.1.0";
src = pkgs.fetchurl {
url = "http://registry.npmjs.org/nan/-/nan-2.1.0.tgz";
sha1 = "020a7ccedc63fdee85f85967d5607849e74abbe8";
};
deps = [];
meta = {
homepage = "https://github.com/nodejs/nan#readme";
description = "Native Abstractions for Node.js: C++ header for Node 0.8 -> 4 compatibility";
};
}

View File

@ -0,0 +1 @@
2.1.0.nix

View File

@ -0,0 +1,15 @@
{ buildNodePackage, nodePackages, pkgs }:
buildNodePackage {
name = "ncp";
version = "0.6.0";
src = pkgs.fetchurl {
url = "http://registry.npmjs.org/ncp/-/ncp-0.6.0.tgz";
sha1 = "df8ce021e262be21b52feb3d3e5cfaab12491f0d";
};
deps = [];
meta = {
homepage = "https://github.com/AvianFlu/ncp";
description = "Asynchronous recursive file copy utility.";
keywords = [ "cli" "copy" ];
};
}

View File

@ -0,0 +1 @@
0.6.0.nix

View File

@ -1,16 +0,0 @@
{ buildNodePackage, nodePackages, pkgs }:
buildNodePackage {
name = "nopt";
version = "2.1.1";
src = pkgs.fetchurl {
url = "http://registry.npmjs.org/nopt/-/nopt-2.1.1.tgz";
sha1 = "91eb7c4b017e7c00adcad1fd6d63944d0fdb75c1";
};
deps = with nodePackages; [
abbrev_1-0-7
];
devDependencies = [];
meta = {
description = "Option parsing for Node, supporting types, shorthands, etc. Used by npm.";
};
}

View File

@ -1 +0,0 @@
2.1.1.nix

View File

@ -1,13 +1,16 @@
{ buildNodePackage, nodePackages, pkgs }:
buildNodePackage {
name = "once";
version = "1.3.0";
version = "1.3.2";
src = pkgs.fetchurl {
url = "http://registry.npmjs.org/once/-/once-1.3.0.tgz";
sha1 = "151af86bfc1f08c4b9f07d06ab250ffcbeb56581";
url = "http://registry.npmjs.org/once/-/once-1.3.2.tgz";
sha1 = "d8feeca93b039ec1dcdee7741c92bdac5e28081b";
};
deps = [];
deps = with nodePackages; [
wrappy_1-0-1
];
meta = {
homepage = "https://github.com/isaacs/once#readme";
description = "Run a function exactly one time";
keywords = [
"once"

View File

@ -1 +1 @@
1.3.0.nix
1.3.2.nix

View File

@ -1,23 +0,0 @@
{ buildNodePackage, nodePackages, pkgs }:
buildNodePackage {
name = "pooling";
version = "0.4.6";
src = pkgs.fetchurl {
url = "http://registry.npmjs.org/pooling/-/pooling-0.4.6.tgz";
sha1 = "76a317371ea8a363b4858fa4799e60245f30e664";
};
deps = with nodePackages; [
bunyan_0-22-1
once_1-3-0
vasync_1-4-0
dtrace-provider_0-2-8
assert-plus_0-1-5
];
optionalDependencies = with nodePackages; [
dtrace-provider_0-2-8
];
meta = {
homepage = "https://github.com/mcavage/node-pooling";
description = "General purpose resource pool API";
};
}

View File

@ -1 +0,0 @@
0.4.6.nix

View File

@ -0,0 +1,20 @@
{ buildNodePackage, nodePackages, pkgs }:
buildNodePackage {
name = "precond";
version = "0.2.3";
src = pkgs.fetchurl {
url = "http://registry.npmjs.org/precond/-/precond-0.2.3.tgz";
sha1 = "aa9591bcaa24923f1e0f4849d240f47efc1075ac";
};
deps = [];
meta = {
description = "Precondition checking utilities.";
keywords = [
"precondition"
"assert"
"invariant"
"contract"
"condition"
];
};
}

View File

@ -0,0 +1 @@
0.2.3.nix

View File

@ -0,0 +1,15 @@
{ buildNodePackage, nodePackages, pkgs }:
buildNodePackage {
name = "rimraf";
version = "2.2.8";
src = pkgs.fetchurl {
url = "http://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz";
sha1 = "e439be2aaee327321952730f99a8929e4fc50582";
};
deps = [];
devDependencies = [];
meta = {
homepage = "https://github.com/isaacs/rimraf";
description = "A deep deletion module for node (like `rm -rf`)";
};
}

View File

@ -0,0 +1 @@
2.2.8.nix

View File

@ -0,0 +1,14 @@
{ buildNodePackage, nodePackages, pkgs }:
buildNodePackage {
name = "safe-json-stringify";
version = "1.0.3";
src = pkgs.fetchurl {
url = "http://registry.npmjs.org/safe-json-stringify/-/safe-json-stringify-1.0.3.tgz";
sha1 = "3cb6717660a086d07cb5bd9b7a6875bcf67bd05e";
};
deps = [];
meta = {
homepage = "https://github.com/e-conomic/safe-json-stringify";
description = "Prevent defined property getters from throwing errors";
};
}

View File

@ -0,0 +1 @@
1.0.3.nix

View File

@ -1,17 +1,16 @@
{ buildNodePackage, nodePackages, pkgs }:
buildNodePackage {
name = "vasync";
version = "1.4.0";
version = "1.6.3";
src = pkgs.fetchurl {
url = "http://registry.npmjs.org/vasync/-/vasync-1.4.0.tgz";
sha1 = "6ea5a63582358868d8743cbdd6ffadc9083b910f";
url = "http://registry.npmjs.org/vasync/-/vasync-1.6.3.tgz";
sha1 = "4a69d7052a47f4ce85503d7641df1cbf40432a94";
};
deps = with nodePackages; [
jsprim_0-3-0
verror_1-1-0
verror_1-6-0
];
devDependencies = [];
meta = {
homepage = "https://github.com/davepacheco/node-vasync";
description = "utilities for observable asynchronous control flow";
};
}

View File

@ -1 +1 @@
1.4.0.nix
1.6.3.nix

View File

@ -1,16 +0,0 @@
{ buildNodePackage, nodePackages, pkgs }:
buildNodePackage {
name = "verror";
version = "1.3.3";
src = pkgs.fetchurl {
url = "http://registry.npmjs.org/verror/-/verror-1.3.3.tgz";
sha1 = "8a6a4ac3a8c774b6f687fece49bdffd78552e2cd";
};
deps = with nodePackages; [
extsprintf_1-0-0
];
devDependencies = [];
meta = {
description = "richer JavaScript errors";
};
}

View File

@ -1,16 +1,17 @@
{ buildNodePackage, nodePackages, pkgs }:
buildNodePackage {
name = "verror";
version = "1.1.0";
version = "1.6.0";
src = pkgs.fetchurl {
url = "http://registry.npmjs.org/verror/-/verror-1.1.0.tgz";
sha1 = "2a4b4eb14a207051e75a6f94ee51315bf173a1b0";
url = "http://registry.npmjs.org/verror/-/verror-1.6.0.tgz";
sha1 = "7d13b27b1facc2e2da90405eb5ea6e5bdd252ea5";
};
deps = with nodePackages; [
extsprintf_1-0-0
extsprintf_1-2-0
];
devDependencies = [];
meta = {
homepage = "https://github.com/davepacheco/node-verror";
description = "richer JavaScript errors";
};
}

View File

@ -1 +1 @@
1.3.3.nix
1.6.0.nix

View File

@ -0,0 +1,14 @@
{ buildNodePackage, nodePackages, pkgs }:
buildNodePackage {
name = "wrappy";
version = "1.0.1";
src = pkgs.fetchurl {
url = "http://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz";
sha1 = "1e65969965ccbc2db4548c6b84a6f2c5aedd4739";
};
deps = [];
meta = {
homepage = "https://github.com/npm/wrappy";
description = "Callback wrapping utility";
};
}

View File

@ -0,0 +1 @@
1.0.1.nix

View File

@ -27,7 +27,7 @@ spec = do
res `shouldBe` Left
(Ldap.ResponseError
(Ldap.ResponseErrorCode (Ldap.Type.DeleteRequest
(Ldap.Type.LdapDn (Ldap.Type.LdapString "cn=oddish,o=localhost")))
(Ldap.Type.LdapDn (Ldap.Type.LdapString "cn=oddish, o=localhost")))
Ldap.NoSuchObject
(Dn "o=localhost")
"cn=oddish,o=localhost"))
"cn=oddish, o=localhost"))

View File

@ -30,7 +30,7 @@ spec = do
res `shouldBe` Left
(ResponseError
(ResponseErrorCode
(Ldap.Type.ModifyRequest (Ldap.Type.LdapDn (Ldap.Type.LdapString "cn=pikachu,o=localhost"))
(Ldap.Type.ModifyRequest (Ldap.Type.LdapDn (Ldap.Type.LdapString "cn=pikachu, o=localhost"))
[( Ldap.Type.Delete
, Ldap.Type.PartialAttribute
(Ldap.Type.AttributeDescription (Ldap.Type.LdapString "password"))

View File

@ -22,9 +22,12 @@ module SpecHelper
, oddish
) where
import Control.Monad (forever)
import Control.Concurrent (forkIO)
import Control.Exception (bracket)
import System.Environment (getEnvironment)
import System.IO (hGetLine)
import System.IO.Error (tryIOError)
import System.Process (runInteractiveProcess, terminateProcess, waitForProcess)
import Ldap.Client as Ldap
@ -39,6 +42,7 @@ locally f =
("SSL_KEY", "./ssl/key.pem") :
env))
hGetLine out
forkIO (() <$ tryIOError (forever (hGetLine out >>= putStrLn)))
return h)
(\h -> do terminateProcess h
waitForProcess h)
@ -55,49 +59,49 @@ dns (SearchEntry dn _ : es) = dn : dns es
dns [] = []
bulbasaur :: Dn
bulbasaur = Dn "cn=bulbasaur,o=localhost"
bulbasaur = Dn "cn=bulbasaur, o=localhost"
ivysaur :: Dn
ivysaur = Dn "cn=ivysaur,o=localhost"
ivysaur = Dn "cn=ivysaur, o=localhost"
venusaur :: Dn
venusaur = Dn "cn=venusaur,o=localhost"
venusaur = Dn "cn=venusaur, o=localhost"
charmander :: Dn
charmander = Dn "cn=charmander,o=localhost"
charmander = Dn "cn=charmander, o=localhost"
charmeleon :: Dn
charmeleon = Dn "cn=charmeleon,o=localhost"
charmeleon = Dn "cn=charmeleon, o=localhost"
charizard :: Dn
charizard = Dn "cn=charizard,o=localhost"
charizard = Dn "cn=charizard, o=localhost"
squirtle :: Dn
squirtle = Dn "cn=squirtle,o=localhost"
squirtle = Dn "cn=squirtle, o=localhost"
wartortle :: Dn
wartortle = Dn "cn=wartortle,o=localhost"
wartortle = Dn "cn=wartortle, o=localhost"
blastoise :: Dn
blastoise = Dn "cn=blastoise,o=localhost"
blastoise = Dn "cn=blastoise, o=localhost"
caterpie :: Dn
caterpie = Dn "cn=caterpie,o=localhost"
caterpie = Dn "cn=caterpie, o=localhost"
metapod :: Dn
metapod = Dn "cn=metapod,o=localhost"
metapod = Dn "cn=metapod, o=localhost"
butterfree :: Dn
butterfree = Dn "cn=butterfree,o=localhost"
butterfree = Dn "cn=butterfree, o=localhost"
pikachu :: Dn
pikachu = Dn "cn=pikachu,o=localhost"
pikachu = Dn "cn=pikachu, o=localhost"
raichu :: Dn
raichu = Dn "cn=raichu,o=localhost"
raichu = Dn "cn=raichu, o=localhost"
vulpix :: Dn
vulpix = Dn "cn=vulpix,o=localhost"
vulpix = Dn "cn=vulpix, o=localhost"
oddish :: Dn
oddish = Dn "cn=oddish,o=localhost"
oddish = Dn "cn=oddish, o=localhost"

View File

@ -3,6 +3,9 @@
var fs = require('fs');
var ldapjs = require('ldapjs');
ldapjs.ExtensibleFilter.prototype.matches = ldapjs.EqualityFilter.prototype.matches;
ldapjs.ApproximateFilter.prototype.matches = ldapjs.EqualityFilter.prototype.matches;
var port = process.env.PORT;
var certificate = fs.readFileSync(process.env.SSL_CERT, "utf-8");
var key = fs.readFileSync(process.env.SSL_KEY, "utf-8");
@ -10,43 +13,43 @@ var server = ldapjs.createServer({certificate: certificate, key: key});
// <http://bulbapedia.bulbagarden.net/wiki/List_of_Pok%C3%A9mon_by_National_Pok%C3%A9dex_number>
var pokemon = [
{ dn: 'cn=bulbasaur,o=localhost',
{ dn: 'cn=bulbasaur, o=localhost',
attributes: { cn: 'bulbasaur', evolution: "0", type: ["grass", "poison"], }
},
{ dn: 'cn=ivysaur,o=localhost',
{ dn: 'cn=ivysaur, o=localhost',
attributes: { cn: 'ivysaur', evolution: "1", type: ["grass", "poison"], }
},
{ dn: 'cn=venusaur,o=localhost',
{ dn: 'cn=venusaur, o=localhost',
attributes: { cn: 'venusaur', evolution: "2", type: ["grass", "poison"], }
},
{ dn: 'cn=charmander,o=localhost',
{ dn: 'cn=charmander, o=localhost',
attributes: { cn: 'charmander', evolution: "0", type: ["fire"], }
},
{ dn: 'cn=charmeleon,o=localhost',
{ dn: 'cn=charmeleon, o=localhost',
attributes: { cn: 'charmeleon', evolution: "1", type: ["fire"], }
},
{ dn: 'cn=charizard,o=localhost',
{ dn: 'cn=charizard, o=localhost',
attributes: { cn: 'charizard', evolution: "2", type: ["fire", "flying"], }
},
{ dn: 'cn=squirtle,o=localhost',
{ dn: 'cn=squirtle, o=localhost',
attributes: { cn: 'squirtle', evolution: "0", type: ["water"], }
},
{ dn: 'cn=wartortle,o=localhost',
{ dn: 'cn=wartortle, o=localhost',
attributes: { cn: 'wartortle', evolution: "1", type: ["water"], }
},
{ dn: 'cn=blastoise,o=localhost',
{ dn: 'cn=blastoise, o=localhost',
attributes: { cn: 'blastoise', evolution: "2", type: ["water"], }
},
{ dn: 'cn=caterpie,o=localhost',
{ dn: 'cn=caterpie, o=localhost',
attributes: { cn: 'caterpie', evolution: "0", type: ["bug"], }
},
{ dn: 'cn=metapod,o=localhost',
{ dn: 'cn=metapod, o=localhost',
attributes: { cn: 'metapod', evolution: "1", type: ["bug"], }
},
{ dn: 'cn=butterfree,o=localhost',
{ dn: 'cn=butterfree, o=localhost',
attributes: { cn: 'butterfree', evolution: "2", type: ["bug", "flying"], }
},
{ dn: 'cn=pikachu,o=localhost',
{ dn: 'cn=pikachu, o=localhost',
attributes: { cn: 'pikachu', evolution: "0", type: ["electric"], password: ["i-choose-you"] }
},
];
@ -60,8 +63,8 @@ server.bind('cn=admin', function(req, res, next) {
}
});
server.bind('cn=pikachu,o=localhost', function(req, res, next) {
if ((req.dn.toString() === 'cn=pikachu,o=localhost') && (req.credentials === 'i-choose-you')) {
server.bind('cn=pikachu, o=localhost', function(req, res, next) {
if ((req.dn.toString() === 'cn=pikachu, o=localhost') && (req.credentials === 'i-choose-you')) {
res.end();
return next();
} else {
@ -164,7 +167,7 @@ server.modifyDN('o=localhost', [], function(req, res, next) {
if (req.dn.toString() === pokemon[i].dn) {
req.dn.rdns[0] = req.newRdn.rdns[0];
pokemon[i].dn = req.dn.toString();
pokemon[i].attributes.cn = req.newRdn.rdns[0].cn;
pokemon[i].attributes.cn = req.newRdn.rdns[0].attrs.cn.value;
}
}