special handling of objectclass in search filters

This commit is contained in:
Mark Cavage 2012-04-17 14:15:50 -07:00
parent 7d9b6debde
commit 89d3dfc97b
2 changed files with 13 additions and 2 deletions

View File

@ -49,10 +49,16 @@ EqualityFilter.prototype.matches = function (target) {
if (typeof (target) !== 'object') if (typeof (target) !== 'object')
throw new TypeError('target (object) required'); throw new TypeError('target (object) required');
var self = this;
if (target.hasOwnProperty(this.attribute)) { if (target.hasOwnProperty(this.attribute)) {
var value = this.value; var value = this.value;
return Filter.multi_test( return Filter.multi_test(
function (v) { return value === v; }, function (v) {
if (self.attribute === 'objectclass')
v = v.toLowerCase();
return value === v;
},
target[this.attribute]); target[this.attribute]);
} }

View File

@ -89,8 +89,13 @@ SubstringFilter.prototype.matches = function (target) {
re += this['final'] + '$'; re += this['final'] + '$';
var matcher = new RegExp(re); var matcher = new RegExp(re);
var self = this;
return Filter.multi_test( return Filter.multi_test(
function (v) { return matcher.test(v); }, function (v) {
if (self.attribute === 'objectclass')
v = v.toLowerCase();
return matcher.test(v);
},
target[this.attribute]); target[this.attribute]);
} }