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

Commit 49d5724

Browse files
authoredJul 29, 2020
Merge pull request #646 from spookiej/645-search-response-spaces-dn
Remove spaces in searchResEntry objectName
2 parents 42c40d6 + 8922d78 commit 49d5724

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed
 

‎lib/messages/search_entry.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ SearchEntry.prototype._parse = function (ber) {
171171
SearchEntry.prototype._toBer = function (ber) {
172172
assert.ok(ber)
173173

174-
ber.writeString(this.objectName.toString())
174+
var formattedObjectName = this.objectName.format({ skipSpace: true })
175+
ber.writeString(formattedObjectName)
175176
ber.startSequence()
176177
this.attributes.forEach(function (a) {
177178
// This may or may not be an attribute

‎test/client.test.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ tap.test('search basic', function (t) {
682682
res.on('searchEntry', function (entry) {
683683
t.ok(entry)
684684
t.ok(entry instanceof ldap.SearchEntry)
685-
t.equal(entry.dn.toString(), 'cn=test, ' + SUFFIX)
685+
t.equal(entry.dn.toString(), 'cn=test,' + SUFFIX)
686686
t.ok(entry.attributes)
687687
t.ok(entry.attributes.length)
688688
t.equal(entry.attributes[0].type, 'cn')
@@ -1118,7 +1118,7 @@ tap.test('GH-21 binary attributes', function (t) {
11181118
res.on('searchEntry', function (entry) {
11191119
t.ok(entry)
11201120
t.ok(entry instanceof ldap.SearchEntry)
1121-
t.equal(entry.dn.toString(), 'cn=bin, ' + SUFFIX)
1121+
t.equal(entry.dn.toString(), 'cn=bin,' + SUFFIX)
11221122
t.ok(entry.attributes)
11231123
t.ok(entry.attributes.length)
11241124
t.equal(entry.attributes[0].type, 'foo;binary')
@@ -1159,7 +1159,7 @@ tap.test('GH-23 case insensitive attribute filtering', function (t) {
11591159
res.on('searchEntry', function (entry) {
11601160
t.ok(entry)
11611161
t.ok(entry instanceof ldap.SearchEntry)
1162-
t.equal(entry.dn.toString(), 'cn=test, ' + SUFFIX)
1162+
t.equal(entry.dn.toString(), 'cn=test,' + SUFFIX)
11631163
t.ok(entry.attributes)
11641164
t.ok(entry.attributes.length)
11651165
t.equal(entry.attributes[0].type, 'cn')
@@ -1191,7 +1191,7 @@ tap.test('GH-24 attribute selection of *', function (t) {
11911191
res.on('searchEntry', function (entry) {
11921192
t.ok(entry)
11931193
t.ok(entry instanceof ldap.SearchEntry)
1194-
t.equal(entry.dn.toString(), 'cn=test, ' + SUFFIX)
1194+
t.equal(entry.dn.toString(), 'cn=test,' + SUFFIX)
11951195
t.ok(entry.attributes)
11961196
t.ok(entry.attributes.length)
11971197
t.equal(entry.attributes[0].type, 'cn')

‎test/messages/search_entry.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ test('toBer', function (t) {
7474
t.equal(ber.readSequence(), 0x30)
7575
t.equal(ber.readInt(), 123)
7676
t.equal(ber.readSequence(), 0x64)
77-
t.equal(ber.readString(), 'cn=foo, o=test')
77+
t.equal(ber.readString(), 'cn=foo,o=test')
7878
t.ok(ber.readSequence())
7979

8080
t.ok(ber.readSequence())

‎test/server.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ tap.test('route order', function (t) {
107107
const server = ldap.createServer()
108108
const sock = t.context.sock
109109
const dnShort = SUFFIX
110-
const dnMed = 'dc=sub, ' + SUFFIX
111-
const dnLong = 'dc=long, dc=sub, ' + SUFFIX
110+
const dnMed = 'dc=sub,' + SUFFIX
111+
const dnLong = 'dc=long,dc=sub,' + SUFFIX
112112

113113
// Mount routes out of order
114114
server.search(dnMed, generateHandler(dnMed))

0 commit comments

Comments
 (0)