Merge pull request #613 from greatcare/611-search-request-space-in-dn
Remove spaces from DNs in SearchRequest
This commit is contained in:
commit
e14cf696a0
|
@ -105,7 +105,13 @@ SearchRequest.prototype._parse = function (ber) {
|
|||
SearchRequest.prototype._toBer = function (ber) {
|
||||
assert.ok(ber)
|
||||
|
||||
ber.writeString(this.baseObject.toString())
|
||||
// Format only with commas, since that is what RFC 4514 mandates.
|
||||
// There's a gotcha here: even though it's called baseObject,
|
||||
// it can be a string or a DN object.
|
||||
var formattedDN = dn.DN.isDN(this.baseObject)
|
||||
? this.baseObject.format({ skipSpace: true })
|
||||
: this.baseObject.toString()
|
||||
ber.writeString(formattedDN)
|
||||
ber.writeEnumeration(this._scope)
|
||||
ber.writeEnumeration(this.derefAliases)
|
||||
ber.writeInt(this.sizeLimit)
|
||||
|
|
|
@ -78,7 +78,8 @@ test('toBer', function (t) {
|
|||
t.equal(ber.readSequence(), 0x30)
|
||||
t.equal(ber.readInt(), 123)
|
||||
t.equal(ber.readSequence(), 0x63)
|
||||
t.equal(ber.readString(), 'cn=foo, o=test')
|
||||
// Make sure we've removed spaces from between RDNs:
|
||||
t.equal(ber.readString(), 'cn=foo,o=test')
|
||||
t.equal(ber.readEnumeration(), 1)
|
||||
t.equal(ber.readEnumeration(), 2)
|
||||
t.equal(ber.readInt(), 10)
|
||||
|
|
Loading…
Reference in New Issue