diff --git a/lib/filters/filter.js b/lib/filters/filter.js index 1956c14..4ebc39b 100644 --- a/lib/filters/filter.js +++ b/lib/filters/filter.js @@ -58,9 +58,7 @@ Filter.prototype.toBer = function (ber) { }; -/* - * Test a rule against one or more values. - */ +// Test a rule against one or more values. Filter.multi_test = function (rule, value) { if (Array.isArray(value)) { var response = false; diff --git a/lib/filters/index.js b/lib/filters/index.js index fba58a6..476396f 100644 --- a/lib/filters/index.js +++ b/lib/filters/index.js @@ -144,7 +144,7 @@ function _buildFilterTree(expr) { // substrings fall into the equality bin in the // switch above so we need more processing here if (tree.tag === 'equalityMatch') { - if (tree.value.length === 0) { + if (tree.value === '*') { tree.tag = 'present'; } else { diff --git a/test/filters/parse.test.js b/test/filters/parse.test.js index c0dfbe4..6e7ab8c 100644 --- a/test/filters/parse.test.js +++ b/test/filters/parse.test.js @@ -113,3 +113,13 @@ test('GH-53 NotFilter', function (t) { t.equal(f.filters[1].filter.value, 'shadowAccount'); t.end(); }); + + +test('presence filter', function (t) { + var str = '(foo=*)'; + var f = parse(str); + t.ok(f); + t.equal(f.type, 'present'); + t.equal(f.attribute, 'foo'); + t.end(); +});