npm install ldapauth 安装报错, node LDAP 验证谁做过啊

2015-09-08 17:15:40 +08:00
 nuc093

➜ mytodos git:(master ) npm install ldapauth

bcrypt@0.7.5 install /home/raphael/dev/mytodos/node_modules/ldapauth/node_modules/bcrypt
node-gyp rebuild

make: Entering directory '/home/raphael/dev/mytodos/node_modules/ldapauth/node_modules/bcrypt/build'
CXX (target ) Release/obj.target/bcrypt_lib/src/blowfish.o
CXX (target ) Release/obj.target/bcrypt_lib/src/bcrypt.o
CXX (target ) Release/obj.target/bcrypt_lib/src/bcrypt_node.o
../src/bcrypt_node.cc: In destructor ‘ virtual {anonymous}::baton_base::~baton_base ()’:
../src/bcrypt_node.cc:118:18: error: ‘ class v8::Persistent<v8::Function>’ has no member named ‘ Dispose ’
callback.Dispose ();
^
../src/bcrypt_node.cc: At global scope:
../src/bcrypt_node.cc:198:19: error: variable or field ‘ GenSaltAsync ’ declared void
void GenSaltAsync (uv_work_t* req ) {
^
../src/bcrypt_node.cc:198:19: error: ‘ uv_work_t ’ was not declared in this scope
../src/bcrypt_node.cc:198:30: error: ‘ req ’ was not declared in this scope
void GenSaltAsync (uv_work_t* req ) {
^
../src/bcrypt_node.cc:483:30: error: expected ‘}’ at end of input
NODE_MODULE (bcrypt_lib, init );
^
../src/bcrypt_node.cc:85:13: warning: ‘ void crypto_lock_init ()’ defined but not used [-Wunused-function]
static void crypto_lock_init (void ) {
^
../src/bcrypt_node.cc:95:13: warning: ‘ void crypto_lock_cb (int, int, const char, int )’ defined but not used [-Wunused-function]
static void crypto_lock_cb (int mode, int n, const char
file, int line ) {
^
../src/bcrypt_node.cc:105:22: warning: ‘ long unsigned int crypto_id_cb ()’ defined but not used [-Wunused-function]
static unsigned long crypto_id_cb (void ) {
^
../src/bcrypt_node.cc:140:5: warning: ‘ int {anonymous}::GetSeed (uint8_t, int )’ defined but not used [-Wunused-function]
int GetSeed (uint8_t
seed, int size ) {
^
../src/bcrypt_node.cc:150:6: warning: ‘ bool {anonymous}::ValidateSalt (const char)’ defined but not used [-Wunused-function]
bool ValidateSalt (const char
salt ) {
^
bcrypt_lib.target.mk:88: recipe for target 'Release/obj.target/bcrypt_lib/src/bcrypt_node.o' failed
make: *** [Release/obj.target/bcrypt_lib/src/bcrypt_node.o] Error 1
make: Leaving directory '/home/raphael/dev/mytodos/node_modules/ldapauth/node_modules/bcrypt/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/raphael/.nvm/versions/node/v0.12.4/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23 )
gyp ERR! stack at ChildProcess.emit (events.js:110:17 )
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074:12 )
gyp ERR! System Linux 3.19.0-15-generic
gyp ERR! command "node" "/home/raphael/.nvm/versions/node/v0.12.4/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/raphael/dev/mytodos/node_modules/ldapauth/node_modules/bcrypt
gyp ERR! node -v v0.12.4
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok

3639 次点击
所在节点    Node.js
7 条回复
jarlyyn
2015-09-08 17:33:04 +08:00
jarlyyn
2015-09-08 17:33:45 +08:00
User.prototype.getLdapClient=function ()
{
var web=this.web;
return ldap.createClient (web.settings.ldap );
}

User.prototype.auth=function (uid,password,callback )
{
var User=this;
this.getLdapClient ().bind ('uid='+uid+',ou=People,dc=xxxx',password,function (err ){
if (err ){return callback (err,null )}
User.find (uid,function (err,result ){
if (err ){return callback (err,null )}
callback (null,result );
});
});
}

大概是这样的。
nuc093
2015-09-08 17:45:33 +08:00
@jarlyyn 多谢我来研究研究
scarlex
2015-09-08 18:28:39 +08:00
目测是 bcrypt 的问题, 0.7.5 只能用 Node 0.10.x
楼主的 Node 是 0.12 吧,降到 0.10 试试
nuc093
2015-09-08 20:18:18 +08:00
@scarlex ok 试一试
nuc093
2015-09-08 20:28:36 +08:00
nuc093
2015-09-09 16:23:09 +08:00
var ldap = require ('ldapjs');
var client = ldap.createClient ({
url: 'ldap://192.168.96.23:389'
});
client.bind ('cn=admin,dc=ds,dc=com', 'linux', function (err ) {
assert.ifError (err );
});

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/219164

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX