GH-22: Client should preserve attribute type casing

This commit is contained in:
Mark Cavage 2011-10-04 10:27:43 -07:00
parent 01a6cfb77e
commit 7763cf3789
7 changed files with 7 additions and 6 deletions

View File

@ -69,7 +69,7 @@ Attribute.prototype.parse = function(ber) {
assert.ok(ber);
ber.readSequence();
this.type = ber.readString().toLowerCase();
this.type = ber.readString();
if (ber.peek() === Protocol.LBER_SET) {
if (ber.readSequence(Protocol.LBER_SET)) {

View File

@ -63,6 +63,7 @@ AddRequest.prototype._parse = function(ber) {
while (ber.offset < end) {
var a = new Attribute();
a.parse(ber);
a.type = a.type.toLowerCase();
if (a.type === 'objectclass') {
for (var i = 0; i < a.vals.length; i++)
a.vals[i] = a.vals[i].toLowerCase();
@ -127,7 +128,7 @@ AddRequest.prototype.attributeNames = function() {
AddRequest.prototype.getAttribute = function(name) {
if (!name || typeof(name) !== 'string')
throw new TypeEroror('attribute name (string) required');
throw new TypeError('attribute name (string) required');
name = name.toLowerCase();

View File

@ -7,7 +7,6 @@ var LDAPMessage = require('./message');
var LDAPResult = require('./result');
var dn = require('../dn');
var Attribute = require('../attribute');
var Protocol = require('../protocol');

View File

@ -9,7 +9,6 @@ var LDAPMessage = require('./message');
var LDAPResult = require('./result');
var dn = require('../dn');
var Attribute = require('../attribute');
var Protocol = require('../protocol');

View File

@ -9,7 +9,6 @@ var LDAPMessage = require('./message');
var LDAPResult = require('./result');
var dn = require('../dn');
var Attribute = require('../attribute');
var Protocol = require('../protocol');

View File

@ -56,6 +56,7 @@ ModifyRequest.prototype._parse = function(ber) {
while (ber.offset < end) {
var c = new Change();
c.parse(ber);
c.modification.type = c.modification.type.toLowerCase();
this.changes.push(c);
}

View File

@ -82,7 +82,7 @@ test('setup', function(t) {
objectName: req.dn,
attributes: {
cn: ['unit', 'test'],
sn: 'testy'
SN: 'testy'
}
});
res.send(e);
@ -345,6 +345,8 @@ test('search basic', function(t) {
t.equal(entry.dn.toString(), 'cn=test, ' + SUFFIX);
t.ok(entry.attributes);
t.ok(entry.attributes.length);
t.equal(entry.attributes[0].type, 'cn');
t.equal(entry.attributes[1].type, 'SN');
t.ok(entry.object);
gotEntry++;
});