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