I tried to query 'LDAP server users' with my node.js server. here is my codes what i tried with 'Ldapjs framework'
function ldapQuery_Users(){
var opts = {
filter: '(uid=*)',
scope: 'sub'
// attributes: ['dn', 'sn', 'cn', 'phone', 'fax', 'mail']
};
client.search('dc=mirageworks, dc=kr', opts, function(err, res) {
assert.ifError(err);
res.on('searchEntry', function(entry) {
console.log(entry.attributes.toString());
});
res.on('searchReference', function(referral) {
console.log('referral: ' + referral.uris.join());
});
res.on('error', function(err) {
console.error('error: ' + err.message);
});
res.on('end', function(result) {
//console.log('ldapLogin status: ' + ((result.status == 0) ? "success" : result.status));
});
});
}
And the result is like this.
When I set attributes items in opts array, the results are sorted as what I set. But with no attributes, no sorted items.
The first user's result is starting "type" : "uid". these items seem ascending sorted. But second and thrid are decending sorted. these are starting with "type":"telephoneNumber"