Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ldapjs/node-ldapjs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.0.0
Choose a base ref
...
head repository: ldapjs/node-ldapjs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.0.1
Choose a head ref
  • 5 commits
  • 4 files changed
  • 3 contributors

Commits on Mar 4, 2023

  1. build(deps-dev): bump eslint from 8.34.0 to 8.35.0

    Bumps [eslint](https://github.com/eslint/eslint) from 8.34.0 to 8.35.0.
    - [Release notes](https://github.com/eslint/eslint/releases)
    - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
    - [Commits](eslint/eslint@v8.34.0...v8.35.0)
    
    ---
    updated-dependencies:
    - dependency-name: eslint
      dependency-type: direct:development
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored and jsumners committed Mar 4, 2023
    Copy the full SHA
    6ba15ed View commit details

Commits on Mar 7, 2023

  1. Quick fix for outdated client doc

    Still referring to result.object, instead of result.pojo.
    Tethik authored and jsumners committed Mar 7, 2023
    Copy the full SHA
    0dfe40e View commit details

Commits on Mar 8, 2023

  1. Resolve issue #845

    This issue resolves issue #845 by updating `@ldapjs/messages` to the
    latest version and adding a test that shows how the module should be
    used to evaluate search request scopes.
    jsumners committed Mar 8, 2023
    Copy the full SHA
    824dd2c View commit details
  2. Copy the full SHA
    98b91de View commit details
  3. v3.0.1

    jsumners committed Mar 8, 2023
    Copy the full SHA
    5c6c5dc View commit details
Showing with 139 additions and 4 deletions.
  1. +19 −0 README.md
  2. +1 −1 docs/client.md
  3. +3 −3 package.json
  4. +116 −0 test/issue-845.test.js
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -43,6 +43,25 @@ client on your system:

npm install ldapjs

## Node.js Version Support

As of `ldapjs@3` we only support the active Node.js LTS releases.
See [https://github.com/nodejs/release#release-schedule][schedule] for the LTS
release schedule.

For a definitive list of Node.js version we support, see the version matrix
we test against in our [CI configuration][ci-config].

Note: given the release date of `ldapjs@3`, and the short window of time that
Node.js v14 had remaining on its LTS window, we opted to not support Node.js
v14 with `ldapjs@3` (we released late February 2023 and v14 goes into
maintenance in late April 2023). Also, Node.js v14 will be end-of-life (EOL) on
September 11, 2023; this is a very shortened EOL timeline and makes it even
more reasonable to not support it at this point.

[schedule]: https://github.com/nodejs/release#release-schedule
[ci-config]: https://github.com/ldapjs/node-ldapjs/blob/master/.github/workflows/main.yml

## License

MIT.
2 changes: 1 addition & 1 deletion docs/client.md
Original file line number Diff line number Diff line change
@@ -308,7 +308,7 @@ client.search('o=example', opts, (err, res) => {
console.log('searchRequest: ', searchRequest.messageId);
});
res.on('searchEntry', (entry) => {
console.log('entry: ' + JSON.stringify(entry.object));
console.log('entry: ' + JSON.stringify(entry.pojo));
});
res.on('searchReference', (referral) => {
console.log('referral: ' + referral.uris.join());
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
"name": "ldapjs",
"homepage": "http://ldapjs.org",
"description": "LDAP client and server APIs",
"version": "3.0.0",
"version": "3.0.1",
"license": "MIT",
"repository": {
"type": "git",
@@ -17,7 +17,7 @@
"@ldapjs/controls": "2.0.0",
"@ldapjs/dn": "1.0.0",
"@ldapjs/filter": "2.0.0",
"@ldapjs/messages": "1.0.0",
"@ldapjs/messages": "1.0.1",
"@ldapjs/protocol": "^1.2.1",
"abstract-logging": "^2.0.1",
"assert-plus": "^1.0.0",
@@ -28,7 +28,7 @@
},
"devDependencies": {
"@fastify/pre-commit": "^2.0.2",
"eslint": "8.34.0",
"eslint": "8.35.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^15.6.1",
116 changes: 116 additions & 0 deletions test/issue-845.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
'use strict'

const tap = require('tap')
const { SearchResultEntry, SearchRequest } = require('@ldapjs/messages')
const ldapjs = require('../')

const server = ldapjs.createServer()

const SUFFIX = ''
const directory = {
'dc=example,dc=com': {
objectclass: 'example',
dc: 'example',
cn: 'example'
}
}

server.bind(SUFFIX, (req, res, done) => {
res.end()
return done()
})

server.search(SUFFIX, (req, res, done) => {
const dn = req.dn.toString().toLowerCase()

if (Object.hasOwn(directory, dn) === false) {
return done(Error('not in directory'))
}

switch (req.scope) {
case SearchRequest.SCOPE_BASE:
case SearchRequest.SCOPE_SUBTREE: {
res.send(new SearchResultEntry({ objectName: `dc=${req.scopeName}` }))
break
}
}

res.end()
done()
})

tap.beforeEach(t => {
return new Promise((resolve, reject) => {
server.listen(0, '127.0.0.1', (err) => {
if (err) return reject(err)
t.context.url = server.url

t.context.client = ldapjs.createClient({ url: [server.url] })
t.context.searchOpts = {
filter: '(&(objectClass=*))',
scope: 'sub',
attributes: ['dn', 'cn']
}

resolve()
})
})
})

tap.afterEach(t => {
return new Promise((resolve, reject) => {
t.context.client.destroy()
server.close((err) => {
if (err) return reject(err)
resolve()
})
})
})

tap.test('rejects if search not in directory', t => {
const { client, searchOpts } = t.context

client.search('dc=nope', searchOpts, (err, res) => {
t.error(err)
res.on('error', err => {
// TODO: plain error messages should not be lost
// This should be fixed in a revamp of the server code.
// ~ jsumners 2023-03-08
t.equal(err.lde_message, 'Operations Error')
t.end()
})
})
})

tap.test('base scope matches', t => {
const { client, searchOpts } = t.context
searchOpts.scope = 'base'

client.search('dc=example,dc=com', searchOpts, (err, res) => {
t.error(err)
res.on('error', (err) => {
t.error(err)
t.end()
})
res.on('searchEntry', entry => {
t.equal(entry.objectName.toString(), 'dc=base')
t.end()
})
})
})

tap.test('sub scope matches', t => {
const { client, searchOpts } = t.context

client.search('dc=example,dc=com', searchOpts, (err, res) => {
t.error(err)
res.on('error', (err) => {
t.error(err)
t.end()
})
res.on('searchEntry', entry => {
t.equal(entry.objectName.toString(), 'dc=subtree')
t.end()
})
})
})