V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
nuc093
V2EX  ›  Node.js

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

  •  
  •   nuc093 · 2015-09-08 17:15:40 +08:00 · 3707 次点击
    这是一个创建于 3372 天前的主题,其中的信息可能已经有所发展或是发生改变。

    ➜ mytodos git:(master ) npm install ldapauth

    [email protected] 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

    7 条回复    2015-09-09 16:23:09 +08:00
    jarlyyn
        1
    jarlyyn  
       2015-09-08 17:33:04 +08:00
    jarlyyn
        2
    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
        3
    nuc093  
    OP
       2015-09-08 17:45:33 +08:00
    @jarlyyn 多谢我来研究研究
    scarlex
        4
    scarlex  
       2015-09-08 18:28:39 +08:00
    目测是 bcrypt 的问题, 0.7.5 只能用 Node 0.10.x
    楼主的 Node 是 0.12 吧,降到 0.10 试试
    nuc093
        5
    nuc093  
    OP
       2015-09-08 20:18:18 +08:00
    @scarlex ok 试一试
    nuc093
        7
    nuc093  
    OP
       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 );
    });
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2789 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 11:52 · PVG 19:52 · LAX 03:52 · JFK 06:52
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.