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.4
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.5
Choose a head ref
  • 4 commits
  • 6 files changed
  • 1 contributor

Commits on Aug 4, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ac588a0 View commit details

Commits on Aug 15, 2023

  1. Resolve issue #924

    jsumners committed Aug 15, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    7b869f4 View commit details

Commits on Aug 16, 2023

  1. Resolve issue #860

    jsumners committed Aug 16, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    971f1bb View commit details
  2. v3.0.5

    jsumners committed Aug 16, 2023
    Copy the full SHA
    6a67636 View commit details
Showing with 175 additions and 26 deletions.
  1. +3 −1 .github/workflows/integration.yml
  2. +5 −3 docker-compose.yml
  3. +9 −9 package.json
  4. +59 −12 test-integration/client/issue-860.test.js
  5. +91 −0 test-integration/client/issue-923.test.js
  6. +8 −1 test-integration/client/issues.test.js
4 changes: 3 additions & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -20,10 +20,12 @@ jobs:

services:
openldap:
image: ghcr.io/ldapjs/docker-test-openldap/openldap:latest
image: ghcr.io/ldapjs/docker-test-openldap/openldap:2023-08-15
ports:
- 389:389
- 636:636
options: >
--health-cmd "ldapsearch -Y EXTERNAL -Q -H ldapi:// -b ou=people,dc=planetexpress,dc=com -LLL '(cn=Turanga Leela)' cn"
steps:
- uses: actions/checkout@v3
8 changes: 5 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
version: '3'

services:
openldap:
image: ghcr.io/ldapjs/docker-test-openldap/openldap:latest
image: ghcr.io/ldapjs/docker-test-openldap/openldap:2023-08-15
ports:
- 389:389
- 636:636
healthcheck:
start_period: 3s
test: >
/usr/bin/ldapsearch -Y EXTERNAL -Q -H ldapi:// -b ou=people,dc=planetexpress,dc=com -LLL '(cn=Turanga Leela)' cn 1>/dev/null
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -3,21 +3,21 @@
"name": "ldapjs",
"homepage": "http://ldapjs.org",
"description": "LDAP client and server APIs",
"version": "3.0.4",
"version": "3.0.5",
"license": "MIT",
"repository": {
"type": "git",
"url": "git://github.com/ldapjs/node-ldapjs.git"
},
"main": "lib/index.js",
"dependencies": {
"@ldapjs/asn1": "2.0.0",
"@ldapjs/attribute": "1.0.0",
"@ldapjs/change": "1.0.0",
"@ldapjs/controls": "2.0.0",
"@ldapjs/dn": "1.1.0",
"@ldapjs/filter": "2.1.0",
"@ldapjs/messages": "^1.2.0",
"@ldapjs/asn1": "^2.0.0",
"@ldapjs/attribute": "^1.0.0",
"@ldapjs/change": "^1.0.0",
"@ldapjs/controls": "^2.0.0",
"@ldapjs/dn": "^1.1.0",
"@ldapjs/filter": "^2.1.1",
"@ldapjs/messages": "^1.2.1",
"@ldapjs/protocol": "^1.2.1",
"abstract-logging": "^2.0.1",
"assert-plus": "^1.0.0",
@@ -47,7 +47,7 @@
"test:cov:html": "tap --coverage-report=html -R terse",
"test:watch": "tap -n -w --no-coverage-report -R terse",
"test:integration": "tap --no-cov -R terse 'test-integration/**/*.test.js'",
"test:integration:local": "docker-compose up -d && npm run test:integration && docker-compose down",
"test:integration:local": "docker-compose up -d --wait && npm run test:integration ; docker-compose down",
"lint": "eslint . --fix",
"lint:ci": "eslint .",
"docs": "node scripts/build-docs.js"
71 changes: 59 additions & 12 deletions test-integration/client/issue-860.test.js
Original file line number Diff line number Diff line change
@@ -11,20 +11,33 @@ const baseURL = `${SCHEME}://${HOST}:${PORT}`

const client = ldapjs.createClient({ url: baseURL })

const opts = {
filter: '(&(objectClass=person))',
scope: 'sub',
paged: true,
sizeLimit: 100,
attributes: ['cn', 'employeeID']
}
tap.before(() => {
return new Promise((resolve, reject) => {
client.bind('cn=admin,dc=planetexpress,dc=com', 'GoodNewsEveryone', (err) => {
if (err) {
return reject(err)
}
resolve()
})
})
})

const baseDN = parseDN('ou=テスト,dc=planetexpress,dc=com')
tap.teardown(() => {
client.unbind()
})

tap.test('can search OUs with Japanese characters', t => {
client.bind('cn=admin,dc=planetexpress,dc=com', 'GoodNewsEveryone', (err) => {
t.error(err, 'bind error')
})
t.plan(2)

const opts = {
filter: '(&(objectClass=person))',
scope: 'sub',
paged: true,
sizeLimit: 100,
attributes: ['cn', 'employeeID']
}

const baseDN = parseDN('ou=テスト,dc=planetexpress,dc=com')

client.search(baseDN.toString(), opts, (err, res) => {
t.error(err, 'search error')
@@ -42,7 +55,41 @@ tap.test('can search OUs with Japanese characters', t => {
t.error(err, 'search entry error')
})
res.on('end', () => {
client.unbind(t.end)
t.end()
})
})
})

tap.test('can search with non-ascii chars in filter', t => {
t.plan(3)

const opts = {
filter: '(&(sn=Rodríguez))',
scope: 'sub',
attributes: ['dn', 'sn', 'cn'],
type: 'user'
}

let searchEntryCount = 0
client.search('dc=planetexpress,dc=com', opts, (err, res) => {
t.error(err, 'search error')
res.on('searchEntry', (entry) => {
searchEntryCount += 1
t.match(entry.pojo, {
type: 'SearchResultEntry',
objectName: 'cn=Bender Bending Rodr\\c3\\adguez,ou=people,dc=planetexpress,dc=com',
attributes: [{
type: 'cn',
values: ['Bender Bending Rodríguez']
}]
})
})
res.on('error', (err) => {
t.error(err, 'search entry error')
})
res.on('end', () => {
t.equal(searchEntryCount, 1, 'should have found 1 entry')
t.end()
})
})
})
91 changes: 91 additions & 0 deletions test-integration/client/issue-923.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
'use strict'

const tap = require('tap')
const ldapjs = require('../../lib')
const { DN } = require('@ldapjs/dn')
const Change = require('@ldapjs/change')

const SCHEME = process.env.SCHEME || 'ldap'
const HOST = process.env.HOST || '127.0.0.1'
const PORT = process.env.PORT || 389
const baseURL = `${SCHEME}://${HOST}:${PORT}`

const client = ldapjs.createClient({ url: baseURL })

tap.teardown(() => {
client.unbind()
})

tap.test('modifies entry specified by dn string', t => {
t.plan(4)

client.bind('cn=admin,dc=planetexpress,dc=com', 'GoodNewsEveryone', (err) => {
t.error(err, 'bind error')
})

const dn = 'cn=large10,ou=large_ou,dc=planetexpress,dc=com'
const change = new Change({
operation: 'replace',
modification: {
type: 'givenName',
values: ['test']
}
})

client.modify(dn, change, (err) => {
t.error(err, 'modify error')
validateChange({ t, expected: 'test', client })
})
})

tap.test('modifies entry specified by dn object', t => {
t.plan(4)

client.bind('cn=admin,dc=planetexpress,dc=com', 'GoodNewsEveryone', (err) => {
t.error(err, 'bind error')
})

const dn = DN.fromString('cn=large10,ou=large_ou,dc=planetexpress,dc=com')
const change = new Change({
operation: 'replace',
modification: {
type: 'givenName',
values: ['test2']
}
})

client.modify(dn, change, (err) => {
t.error(err, 'modify error')
validateChange({ t, expected: 'test2', client })
})
})

function validateChange ({ t, expected, client }) {
const searchBase = 'ou=large_ou,dc=planetexpress,dc=com'
const searchOpts = {
filter: '(cn=large10)',
scope: 'subtree',
attributes: ['givenName'],
sizeLimit: 10,
timeLimit: 0
}

client.search(searchBase, searchOpts, (err, res) => {
t.error(err, 'search error')

res.on('searchEntry', entry => {
t.equal(
entry.attributes.filter(a => a.type === 'givenName').pop().values.pop(),
expected
)
})

res.on('error', err => {
t.error(err, 'search entry error')
})

res.on('end', () => {
t.end()
})
})
}
9 changes: 8 additions & 1 deletion test-integration/client/issues.test.js
Original file line number Diff line number Diff line change
@@ -10,7 +10,14 @@ const PORT = process.env.PORT || 389
const baseURL = `${SCHEME}://${HOST}:${PORT}`

tap.test('modifyDN with long name (issue #480)', t => {
const longStr = 'a292979f2c86d513d48bbb9786b564b3c5228146e5ba46f404724e322544a7304a2b1049168803a5485e2d57a544c6a0d860af91330acb77e5907a9e601ad1227e80e0dc50abe963b47a004f2c90f570450d0e920d15436fdc771e3bdac0487a9735473ed3a79361d1778d7e53a7fb0e5f01f97a75ef05837d1d5496fc86968ff47fcb64'
// 2023-08-15: disabling this 265 character string until a bug can be
// fixed in OpenLDAP. See https://github.com/ldapjs/docker-test-openldap/blob/d48bc2fb001b4ed9a152715ced4a2cb120439ec4/bootstrap/slapd-init.sh#L19-L31.
// const longStr = 'a292979f2c86d513d48bbb9786b564b3c5228146e5ba46f404724e322544a7304a2b1049168803a5485e2d57a544c6a0d860af91330acb77e5907a9e601ad1227e80e0dc50abe963b47a004f2c90f570450d0e920d15436fdc771e3bdac0487a9735473ed3a79361d1778d7e53a7fb0e5f01f97a75ef05837d1d5496fc86968ff47fcb64'

// 2023-08-15: this 140 character string satisfies the original issue
// (https://github.com/ldapjs/node-ldapjs/issues/480) and avoids a bug
// in OpenLDAP 2.5.
const longStr = '292979f2c86d513d48bbb9786b564b3c5228146e5ba46f404724e322544a7304a2b1049168803a5485e2d57a544c6a0d860af91330acb77e5907a9e601ad1227e80e0dc50ab'
const targetDN = 'cn=Turanga Leela,ou=people,dc=planetexpress,dc=com'
const client = ldapjs.createClient({ url: baseURL })
client.bind('cn=admin,dc=planetexpress,dc=com', 'GoodNewsEveryone', bindHandler)