Skip to content
This repository was archived by the owner on Feb 25, 2019. It is now read-only.
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

@msamblanet

Description

@msamblanet

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();

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions