You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 14, 2024. It is now read-only.
I've got some simple code to answer LDAP search query for the rootDSE. Normally all attribute under the rootDSE are operational attribute and I want to have a behavior similar to a real LDAP server.
Specifically, I want to implement returning all attributes when search query for attribute "+" (rfc3673)
My issue is that I don't understand how I can use ldapjs to archive this.
Following does not work as the return object is filtered to only the attribute matching "+" which mean nothing. I imagine there must be a way to explicatively define what is returned.
Any help is very much appreciated.
...
else if (req.attributes.toString() === '+') {
// Want to send all attributes
res.send(rootDSEobj)
}
...
Full example code:
// Search handler for rootDSE
proxy.search('', function (req, res, next) {
// rootDSE response
var rootDSEobj = {
dn: req.dn.toString(),
attributes: {
objectClass: ['top', 'LDAPJSrootDSE'],
structuralObjectClass: 'LDAPJSrootDSE',
namingContexts: 'o=example.org',
supportedLDAPVersion: '3'
}
}
// rootDSE minimal response with only objectClass
var rootDSEobjMin = {
dn: req.dn.toString(),
attributes: {
objectClass: ['top', 'LDAPJSrootDSE']
}
}
// rootDSE search require base scope
if (req.scope !== 'base') {
return next(new ldap.NoSuchObjectError())
}
// For empty filter emulate operational attributes (minimal response)
if (req.attributes.toString() === '') {
res.send(rootDSEobjMin)
} else if (req.attributes.toString() === '+') {
// Want to send all attributes
res.send(rootDSEobj)
} else if (req.filter.matches(rootDSEobj.attributes)) {
const request = 'attr= ' + req.attributes.toString() + ' filter= ' + req.filter.toString()
res.send(rootDSEobj)
}
res.end()
return next()
})
The text was updated successfully, but these errors were encountered:
I've got some simple code to answer LDAP search query for the rootDSE. Normally all attribute under the rootDSE are operational attribute and I want to have a behavior similar to a real LDAP server.
Specifically, I want to implement returning all attributes when search query for attribute "+" (rfc3673)
My issue is that I don't understand how I can use ldapjs to archive this.
Following does not work as the return object is filtered to only the attribute matching "+" which mean nothing. I imagine there must be a way to explicatively define what is returned.
Any help is very much appreciated.
Full example code:
The text was updated successfully, but these errors were encountered: