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.3
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.4
Choose a head ref
  • 2 commits
  • 3 files changed
  • 2 contributors

Commits on Jul 22, 2023

  1. Fix ensureDN (#918)

    mischnic authored Jul 22, 2023
    Copy the full SHA
    0fcad24 View commit details
  2. v3.0.4

    jsumners committed Jul 22, 2023
    Copy the full SHA
    1cc6a73 View commit details
Showing with 33 additions and 2 deletions.
  1. +1 −1 lib/client/client.js
  2. +1 −1 package.json
  3. +31 −0 test/client.test.js
2 changes: 1 addition & 1 deletion lib/client/client.js
Original file line number Diff line number Diff line change
@@ -80,7 +80,7 @@ function validateControls (controls) {

function ensureDN (input) {
if (DN.isDn(input)) {
return DN
return input
} else if (typeof (input) === 'string') {
return DN.fromString(input)
} else {
2 changes: 1 addition & 1 deletion 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.3",
"version": "3.0.4",
"license": "MIT",
"repository": {
"type": "git",
31 changes: 31 additions & 0 deletions test/client.test.js
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@ const Attribute = require('@ldapjs/attribute')
const Change = require('@ldapjs/change')
const messages = require('@ldapjs/messages')
const controls = require('@ldapjs/controls')
const dn = require('@ldapjs/dn')
const ldap = require('../lib')

const {
@@ -761,6 +762,36 @@ tap.test('search basic', function (t) {
})
})

tap.test('search basic with DN', function (t) {
const { SearchResultEntry, SearchResultDone } = messages

t.context.client.search(dn.DN.fromString('cn=test, ' + SUFFIX, '(objectclass=*)'), function (err, res) {
t.error(err)
t.ok(res)
let gotEntry = 0
res.on('searchEntry', function (entry) {
t.ok(entry)
t.ok(entry instanceof SearchResultEntry)
t.equal(entry.dn.toString(), 'cn=test,' + SUFFIX)
t.ok(entry.attributes)
t.ok(entry.attributes.length)
t.equal(entry.attributes[0].type, 'cn')
t.equal(entry.attributes[1].type, 'SN')
gotEntry++
})
res.on('error', function (err) {
t.fail(err)
})
res.on('end', function (res) {
t.ok(res)
t.ok(res instanceof SearchResultDone)
t.equal(res.status, 0)
t.equal(gotEntry, 2)
t.end()
})
})
})

tap.test('GH-602 search basic with delayed event listener binding', function (t) {
t.context.client.search('cn=test, ' + SUFFIX, '(objectclass=*)', function (err, res) {
t.error(err)