diff --git a/lib/messages/moddn_request.js b/lib/messages/moddn_request.js index 76052b5..ee6a6cf 100644 --- a/lib/messages/moddn_request.js +++ b/lib/messages/moddn_request.js @@ -68,13 +68,21 @@ ModifyDNRequest.prototype._parse = function (ber) { ModifyDNRequest.prototype._toBer = function (ber) { - assert.ok(ber); + //assert.ok(ber); ber.writeString(this.entry.toString()); ber.writeString(this.newRdn.toString()); ber.writeBoolean(this.deleteOldRdn); - if (this.newSuperior) - ber.writeString(this.newSuperior.toString()); + if (this.newSuperior) { + var s = this.newSuperior.toString(); + var len = Buffer.byteLength(s); + + ber.writeByte(0x80); // MODIFY_DN_REQUEST_NEW_SUPERIOR_TAG + ber.writeByte(len); + ber._ensure(len); + ber._buf.write(s, ber._offset); + ber._offset += len; + } return ber; };