GH-20 case insensitive treatment of attribute names in a DN

This commit is contained in:
Mark Cavage 2011-09-29 14:46:10 -07:00
parent ffb06e8285
commit 12356c5628
2 changed files with 10 additions and 2 deletions

View File

@ -26,7 +26,7 @@ function RDN(obj) {
if (obj) {
Object.keys(obj).forEach(function(k) {
self[k] = obj[k];
self[k.toLowerCase()] = obj[k];
});
}
}
@ -66,7 +66,7 @@ function parse(name) {
trim();
var value = parseAttrValue();
trim();
rdn[attr] = value;
rdn[attr.toLowerCase()] = value;
if (cur >= len || name[cur] !== '+')
break;
++cur;

View File

@ -123,3 +123,11 @@ test('empty DNs GH-16', function(t) {
t.notOk(_dn2.childOf(''));
t.end();
});
test('case insensitive attribute names GH-20', function(t) {
var dn1 = dn.parse('CN=foo, dc=bar');
t.ok(dn1.equals('cn=foo, dc=bar'));
t.ok(dn1.equals(dn.parse('cn=foo, DC=bar')));
t.end();
});