From efb3ea98b742ef8a0638a163fbeecf0846b1e037 Mon Sep 17 00:00:00 2001 From: Doug Campbell Date: Mon, 14 Jan 2013 17:14:35 +0800 Subject: [PATCH] make changes recommended in Issue 97 --- lib/messages/moddn_request.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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; };