node-activedirectory icon indicating copy to clipboard operation
node-activedirectory copied to clipboard

Illegal Unescaped Char : (

Open nandsfordays opened this issue 1 year ago • 2 comments

I am using the getMembershipForUser function and trying to get a list of all the Groups that a member is in. This function has worked for every user so far except for one. I get this error: Error: illegal unescaped char: ( at escapeValue (/server/node_modules/ldap-filter/lib/index.js:49:13) at parseExpr (/server/node_modules/ldap-filter/lib/index.js:167:16) at parseFilter /server/node_modules/ldap-filter/lib/index.js:228:14) at Object.parse (/server/node_modules/ldap-filter/lib/index.js:252:18) at Object.parseString (portal44/server/node_modules/ldapjs/lib/filters/index.js:179:27) at Client.search (server/node_modules/ldapjs/lib/client/client.js:569:30) at ActiveDirectory.search (/app/data/portal/portal44/server/node_modules/activedirectory/lib/activedirectory.js:529:10) at ActiveDirectory.getGroupMembershipForDN (server/node_modules/activedirectory/lib/activedirectory.js:740:10) at server/node_modules/activedirectory/lib/activedirectory.js:770:33 at server/node_modules/async/dist/async.js:2588:44

I am unsure of why the open paranthesis '(' would cause this error. It does not need to be escaped at any other time. I think is that one of the OU parts of the dn has an open paranthesis '(' for example: CN={CN NAME},OU=FPLS (Fed Parent Locator Svc),OU=Security,... {more information} I am unable to change security groups and as soon as it hits the getMembershipForUser function it crashes the entire process and my process manager restarts. Just wondering if there is anyway to work around this.

"activedirectory": { "version": "0.7.2", "resolved": "https://registry.npmjs.org/activedirectory/-/activedirectory-0.7.2.tgz",

    "requires": {
    "async": ">= 0.1.22",
    "bunyan": ">= 1.3.5",
    "ldapjs": ">= 0.7.1",
    "underscore": ">= 1.4.3"
  }
}

"ldapjs": { "version": "2.2.3",

nandsfordays avatar May 16 '23 17:05 nandsfordays

Made a typo and the function I was calling getMembershipForUser is supposed to be getGroupMembershipForUser but everything else is still relevant

nandsfordays avatar May 16 '23 17:05 nandsfordays

Hi, i have the same issue

found this:

https://github.com/gheeres/node-activedirectory/issues/230#issuecomment-768434904

El1rans avatar Jun 05 '23 11:06 El1rans