0

I am trying to add a new user in LDAP by using the below command:

ldapadd -H ldap://localhost:1389 -x -D cn=root -w secret -f ./user.ldif

user.ldif file contains the data as

dn: cn=ldapjs, ou=users, o=myhost
objectClass: unixUser
cn: ldapjs
shell: /bin/bash
description: Created via ldapadd

When I try to run the ldapadd command, I got the below error and I could not find where I made the mistakes:

**ERROR**
ldap_add: Constraint violation (19)
    matched DN: ou=users, o=myhost
    **additional info: cn required**

Here I am running the ldapjs server in the url: 'ldap://127.0.0.1:1389' with root mode.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Sankar
  • 1
  • 1

1 Answers1

0

The error is occurred due to the ldapjs server API. The example code shared in ldapjs.org is not suitable for the latest ldapjs API. We can fix the issue by changing req.dn.rdn[0].cn to req.dn.rdn[0].attrs.cn

Sankar
  • 1
  • 1