-2

please help me to get any possible was to insert empty values in LDAP using java/sample LDAP script. i have referred many cases but i didn't find any feasible solution .

Thanks in Advance ..

  • There is no such thing as an empty attribute value in LDAP, let alone Java. – user207421 Jul 06 '16 at 07:54
  • Actually there are syntaxes that allow an empty string as a value, DN being one of them. – Ludovic Poitou Jul 07 '16 at 09:46
  • @LudovicPoitou could an empty string as a value also cause [this](http://stackoverflow.com/q/39372374/5606016) issue? – A_Di-Matteo Sep 12 '16 at 21:00
  • @A_Di-Matteo, NO, the issue you're referring to is really that the entry cannot be found and none of the parents either on that server (or the server doesn't return any matching parent on purpose). – Ludovic Poitou Sep 13 '16 at 08:10

1 Answers1

0

You can only add empty values to attributes whose syntax allow it : IA5String and DNs. An example of command line use :

$ ldapmodify -h localhost -p 1389 -D "cn=directory manager" -w secret12
dn: cn=G,dc=example,dc=com
changetype: modify
add: member
member:
-

Processing MODIFY request for cn=G,dc=example,dc=com
MODIFY operation successful for DN cn=G,dc=example,dc=com

With Java, you will probably need an LDAP client library such as OpenDJ SDK, and build a modify operation where you add an attribute and the value is an empty string. I don't think you can do it with JNDI, but I could be proved wrong.

Ludovic Poitou
  • 4,788
  • 2
  • 21
  • 30