Advertisement
Guest User

Untitled

a guest
Apr 3rd, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.19 KB | None | 0 0
  1. var ActiveDirectory = require('activedirectory');
  2.  
  3. var ad = new ActiveDirectory({
  4. url: 'ldap://10.10.10.10',
  5. baseDN: 'dc=domain,dc=com',
  6. username: 'Administrator',
  7. password: 'kokoko'
  8. });
  9.  
  10. ad.findUser('', function (err, user) {
  11. console.log('-- callback');
  12.  
  13. if (err) {
  14. console.log('Error: ' + JSON.stringify(err));
  15. } else {
  16. console.log('User: ' + JSON.stringify(user));
  17. }
  18. });
  19.  
  20. // Double error issue:
  21. // ===================
  22. //
  23. // activedirectory: ldapjs:
  24. //
  25. // findUser()
  26. // |
  27. // search()
  28. // |
  29. // client ============================ createClient()
  30. // |
  31. // retry = backoff.exponential()
  32. // |
  33. // x-----------------------------------x
  34. // |
  35. // client.on('error', !callback!) ---> this.search()
  36. // ^ ^ this.connect()
  37. // | | |
  38. // | | x-----------------x
  39. // | | |
  40. // | | v
  41. // | | retry.on('ready', function)
  42. // | | |
  43. // | | connectSocket()
  44. // | | onConnect()
  45. // | | setupClient()
  46. // | | forEachPipeline()
  47. // | | |
  48. // | | v
  49. // | | this.on('setup', function(err, cb))
  50. // | | | |
  51. // | | | retry.backoff(err)
  52. // | | | |
  53. // | | | x----------------x
  54. // | | (Solution is get rid this)-->X |
  55. // | | | v
  56. // | | | retry.on('fail', function)
  57. // | | | |
  58. // | | | x-------------------x
  59. // | | | |
  60. // | | v v
  61. // | | self.emit('error', err)
  62. // | | | |
  63. // | x---------------------------------------x |
  64. // x-------------------------------------------x
  65. //
  66. //
  67. // Fix:
  68. // ====
  69. //
  70. // ldapjs/lib/client/client.js:348
  71. //
  72. // clt.bind(options.bindDN, options.bindCredentials, function (err) {
  73. // if (err) {
  74. // self.emit('error', err);
  75. // }
  76. // cb(err);
  77. // });
  78. //
  79. // to
  80. //
  81. // clt.bind(options.bindDN, options.bindCredentials, cb);
  82. //
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement