throw on all bad filters
This commit is contained in:
parent
f87f608c05
commit
24e02f8d88
|
@ -114,6 +114,10 @@ function _buildFilterTree(expr) {
|
|||
var operatorStr = '';
|
||||
tree.name = '';
|
||||
tree.value = '';
|
||||
|
||||
if (!/[a-zA-Z0-9;\-]+[~><:]?=.+/.test(expr))
|
||||
throw new Error(expr + ' is invalid');
|
||||
|
||||
if (expr.indexOf('~=') !== -1) {
|
||||
operatorStr = '~=';
|
||||
tree.tag = 'approxMatch';
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
"name": "ldapjs",
|
||||
"homepage": "http://ldapjs.org",
|
||||
"description": "LDAP client and server APIs",
|
||||
"version": "0.5.8",
|
||||
"version": "0.5.9",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/mcavage/node-ldapjs.git"
|
||||
|
|
|
@ -130,3 +130,10 @@ test('bogus filter', function (t) {
|
|||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('bogus filter !=', function (t) {
|
||||
t.throws(function () {
|
||||
parse('foo!=1');
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue