Merge pull request #646 from spookiej/645-search-response-spaces-dn

Remove spaces in searchResEntry objectName
This commit is contained in:
James Sumners 2020-07-29 19:14:20 -04:00 committed by GitHub
commit 49d5724c80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 8 deletions

View File

@ -171,7 +171,8 @@ SearchEntry.prototype._parse = function (ber) {
SearchEntry.prototype._toBer = function (ber) {
assert.ok(ber)
ber.writeString(this.objectName.toString())
var formattedObjectName = this.objectName.format({ skipSpace: true })
ber.writeString(formattedObjectName)
ber.startSequence()
this.attributes.forEach(function (a) {
// This may or may not be an attribute

View File

@ -682,7 +682,7 @@ tap.test('search basic', function (t) {
res.on('searchEntry', function (entry) {
t.ok(entry)
t.ok(entry instanceof ldap.SearchEntry)
t.equal(entry.dn.toString(), 'cn=test, ' + SUFFIX)
t.equal(entry.dn.toString(), 'cn=test,' + SUFFIX)
t.ok(entry.attributes)
t.ok(entry.attributes.length)
t.equal(entry.attributes[0].type, 'cn')
@ -1118,7 +1118,7 @@ tap.test('GH-21 binary attributes', function (t) {
res.on('searchEntry', function (entry) {
t.ok(entry)
t.ok(entry instanceof ldap.SearchEntry)
t.equal(entry.dn.toString(), 'cn=bin, ' + SUFFIX)
t.equal(entry.dn.toString(), 'cn=bin,' + SUFFIX)
t.ok(entry.attributes)
t.ok(entry.attributes.length)
t.equal(entry.attributes[0].type, 'foo;binary')
@ -1159,7 +1159,7 @@ tap.test('GH-23 case insensitive attribute filtering', function (t) {
res.on('searchEntry', function (entry) {
t.ok(entry)
t.ok(entry instanceof ldap.SearchEntry)
t.equal(entry.dn.toString(), 'cn=test, ' + SUFFIX)
t.equal(entry.dn.toString(), 'cn=test,' + SUFFIX)
t.ok(entry.attributes)
t.ok(entry.attributes.length)
t.equal(entry.attributes[0].type, 'cn')
@ -1191,7 +1191,7 @@ tap.test('GH-24 attribute selection of *', function (t) {
res.on('searchEntry', function (entry) {
t.ok(entry)
t.ok(entry instanceof ldap.SearchEntry)
t.equal(entry.dn.toString(), 'cn=test, ' + SUFFIX)
t.equal(entry.dn.toString(), 'cn=test,' + SUFFIX)
t.ok(entry.attributes)
t.ok(entry.attributes.length)
t.equal(entry.attributes[0].type, 'cn')

View File

@ -74,7 +74,7 @@ test('toBer', function (t) {
t.equal(ber.readSequence(), 0x30)
t.equal(ber.readInt(), 123)
t.equal(ber.readSequence(), 0x64)
t.equal(ber.readString(), 'cn=foo, o=test')
t.equal(ber.readString(), 'cn=foo,o=test')
t.ok(ber.readSequence())
t.ok(ber.readSequence())

View File

@ -107,8 +107,8 @@ tap.test('route order', function (t) {
const server = ldap.createServer()
const sock = t.context.sock
const dnShort = SUFFIX
const dnMed = 'dc=sub, ' + SUFFIX
const dnLong = 'dc=long, dc=sub, ' + SUFFIX
const dnMed = 'dc=sub,' + SUFFIX
const dnLong = 'dc=long,dc=sub,' + SUFFIX
// Mount routes out of order
server.search(dnMed, generateHandler(dnMed))