1

I want to create a validator for dn of an ldap, I mean that if I get as input a string from user, my regex, program, library (whatever works) can tell me if string inserted is a ldap dn or not, can You help me??

andPat
  • 4,153
  • 7
  • 24
  • 36
  • I found a regex in this question: http://stackoverflow.com/questions/9289357/javascript-regular-expression-for-dn, could it be a good one? – andPat Oct 31 '13 at 13:37
  • my regex: `\\w+[=]{1}\\w+)([,{1}]\\w+[=]{1}\\w+)*` – andPat Oct 31 '13 at 16:39

2 Answers2

1

Maybe I asked in the wrong place, however (for those who will make a similar search) I post the answer I found from another part: https://serverfault.com/questions/549961/ldap-distinguished-name-validator

Community
  • 1
  • 1
andPat
  • 4,153
  • 7
  • 24
  • 36
0

LDAP C API has a function for DN parsing that is called ldap_explode_dn. There are also many bindings for different languages (PHP, python, etc.). I suggest you consider using this API as a DN validation tool.

Kirill Kovalenko
  • 2,121
  • 16
  • 18