Skip to content
This repository was archived by the owner on Feb 25, 2019. It is now read-only.

LDAP: normalizeDn() will not necessarily normalize all DNs properly #296

Open
msamblanet opened this issue Nov 3, 2015 · 2 comments
Open

Comments

@msamblanet
Copy link
Contributor

normalizeDn in LDAP.js does not consider all possible issues in LDAP DNs for string comparison.

Issue 1: multi-valued RDNs are not order sensitive, so cn=foo+uid=bar,c=us and uid=bar+cn=foo,c=us are equal...

Issue 2: There are multiple legal ways to escape special characters on a DN, so cn=Smith\,John,c=us and cn=Smith\2CJohn,c=us are also equal...

I recommend using an existing DN class for all DN comparisons...you can typically use these same libraries to normalize the DN before saving it to your DB. I have not verified this API is propely implemented but giving them the benefit of the doubt, it may help: ldapjs DN API

var parseDN = require('ldapjs').parseDN;
var a = parseDN("cn=foo+uid=bar,c=us");
var doesItEqual = a.equals("uid=bar+cn=foo,c=us");
var normalizedA = a.format();
@adalinesimonian
Copy link
Member

+1 for using ldapjs's API

@christiansmith
Copy link
Member

@vsimonian since you contributed the LDAP code would you mind pairing to sort out this issue and review/merge #285 while we're at it?

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

No branches or pull requests

3 participants