I get Protocol Error when I add user but successful in binding to admin. Please let me know what did I missed. Here is my code:
var LDAP = require('ldap-client');
var ldap = new LDAP({ uri: 'ldap://192.168.1.250' // optional function to call when disconnect occurs }, function(err) { ldap.bind({ binddn: 'cn=admin,dc=sample,dc=com', password: 'p1n0yak0m3' }, function(err, data){ if(err) { console.log(err); }else{ console.log("success binding"); } }); });
var attrs = [ { attr: 'gidNumber', vals: [ '501' ] }, { attr: 'objectClass', vals: [ 'posixAccount', 'top', 'inetOrgPerson' ] }, { attr: 'uidNumber', vals: [ '1000' ] }, { attr: 'userPassword', vals: [ 'password' ] }, { attr: 'homeDirectory', vals: [ '/home/fsmith' ] }, { attr: 'cn', vals: [ 'fred smith' ] }, { attr: 'sn', vals: [ 'smith' ] }, { attr: 'loginShell', vals: ['/bin/bash'] }, { attr: 'dn', vals: ['cn=fred smith,cn=Investor,ou=arcana,dc=sample,dc=com'] } ];
ldap.add('cn=fred smith,cn=Investor,ou=arcana,dc=sample,dc=com', [attrs], function(err){ if(err) { console.log(err); }else{ console.log("Success!"); } });
I get Protocol Error when I add user but successful in binding to admin. Please let me know what did I missed. Here is my code:
var LDAP = require('ldap-client');var ldap = new LDAP({ uri: 'ldap://192.168.1.250' // optional function to call when disconnect occurs }, function(err) { ldap.bind({ binddn: 'cn=admin,dc=sample,dc=com', password: 'p1n0yak0m3' }, function(err, data){ if(err) { console.log(err); }else{ console.log("success binding"); } }); });var attrs = [ { attr: 'gidNumber', vals: [ '501' ] }, { attr: 'objectClass', vals: [ 'posixAccount', 'top', 'inetOrgPerson' ] }, { attr: 'uidNumber', vals: [ '1000' ] }, { attr: 'userPassword', vals: [ 'password' ] }, { attr: 'homeDirectory', vals: [ '/home/fsmith' ] }, { attr: 'cn', vals: [ 'fred smith' ] }, { attr: 'sn', vals: [ 'smith' ] }, { attr: 'loginShell', vals: ['/bin/bash'] }, { attr: 'dn', vals: ['cn=fred smith,cn=Investor,ou=arcana,dc=sample,dc=com'] } ];ldap.add('cn=fred smith,cn=Investor,ou=arcana,dc=sample,dc=com', [attrs], function(err){ if(err) { console.log(err); }else{ console.log("Success!"); } });