mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-09 19:45:13 +02:00
16 lines
695 B
JavaScript
16 lines
695 B
JavaScript
// Unsafe: ldapjs `client.search` receives a filter assembled from req.query.
|
|
// Bound-variable idiom: the closure-captured `client` carries
|
|
// `TypeKind::LdapClient` (forwarded from the top-level body to the function
|
|
// body by `taint::inject_external_type_facts`), so type-qualified receiver
|
|
// resolution rewrites `client.search` → `LdapClient.search`.
|
|
const ldap = require('ldapjs');
|
|
|
|
const client = ldap.createClient({ url: 'ldap://example.com' });
|
|
|
|
function lookup(req, res) {
|
|
const user = req.query.user;
|
|
const filter = '(uid=' + user + ')';
|
|
client.search('ou=people,dc=example,dc=com', { filter: filter }, (err) => { res.json({ ok: !err }); });
|
|
}
|
|
|
|
module.exports = lookup;
|