Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Protocol Error on ldap.add #105

Open
jb181991 opened this issue Nov 8, 2017 · 3 comments
Open

Error: Protocol Error on ldap.add #105

jb181991 opened this issue Nov 8, 2017 · 3 comments

Comments

@jb181991
Copy link

jb181991 commented Nov 8, 2017

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!"); } });

@ghost
Copy link

ghost commented Nov 15, 2017

I have the same error, trying to add a person....

i have no problem for bind, search and everything execpt adding a user with this :
var attrs = [ { attr: 'objectClass', vals: [ 'top', 'person' ] }, { attr: 'sn', vals: [ 'testingBot' ] }, { attr: 'badattr', vals: [ 'Fried' ] }, { attr: 'userPassword', vals: [ 'testing' ] } ]

ldap.add("cn=test,ou=users,dc=exemple,dc=com", [attrs], function(err){ if (err) { console.log(err); ldap.close(); } else { console.log('succes?'); ldap.close(); } });

Someone fix it ? or know from here the probleme become ?
Thanks all!

@Oscar492
Copy link

solved!, just remove the [ ] from your call to ldap.add("cn=test,ou=users,dc=exemple,dc=com", [attrs],...) and it will work. Otherwise you create a list of a list ;)
I had the same problem btw

@Oscar492
Copy link

Oscar492 commented Feb 20, 2019

check out the tests that comes with in the library, they are pretty helpful when someone wants to get how to use the functions.
All functions work just fine, so far

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants