support for client controls
This commit is contained in:
parent
fcec8d626f
commit
73b14ea8ad
|
@ -564,7 +564,7 @@ Client.prototype.search = function(base, options, controls, callback) {
|
||||||
callback = controls;
|
callback = controls;
|
||||||
controls = [];
|
controls = [];
|
||||||
} else {
|
} else {
|
||||||
control = validateControls(controls);
|
controls = validateControls(controls);
|
||||||
}
|
}
|
||||||
if (typeof(callback) !== 'function')
|
if (typeof(callback) !== 'function')
|
||||||
throw new TypeError('callback (function) required');
|
throw new TypeError('callback (function) required');
|
||||||
|
@ -577,7 +577,8 @@ Client.prototype.search = function(base, options, controls, callback) {
|
||||||
sizeLimit: options.sizeLimit || 0,
|
sizeLimit: options.sizeLimit || 0,
|
||||||
timeLimit: options.timeLimit || 10,
|
timeLimit: options.timeLimit || 10,
|
||||||
typesOnly: options.typesOnly || false,
|
typesOnly: options.typesOnly || false,
|
||||||
attributes: options.attributes || []
|
attributes: options.attributes || [],
|
||||||
|
controls: controls
|
||||||
});
|
});
|
||||||
|
|
||||||
var res = new EventEmitter();
|
var res = new EventEmitter();
|
||||||
|
|
|
@ -72,3 +72,15 @@ Control.prototype.parse = function(ber) {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Control.prototype.toBer = function(ber) {
|
||||||
|
assert.ok(ber);
|
||||||
|
|
||||||
|
ber.startSequence();
|
||||||
|
ber.writeString(this.type || '');
|
||||||
|
ber.writeBoolean(this.criticality);
|
||||||
|
if (this.value)
|
||||||
|
ber.writeString(this.value);
|
||||||
|
ber.endSequence();
|
||||||
|
};
|
||||||
|
|
|
@ -95,12 +95,20 @@ LDAPMessage.prototype.toBer = function() {
|
||||||
var writer = new BerWriter();
|
var writer = new BerWriter();
|
||||||
writer.startSequence();
|
writer.startSequence();
|
||||||
writer.writeInt(this.messageID);
|
writer.writeInt(this.messageID);
|
||||||
writer.startSequence(this.protocolOp);
|
|
||||||
|
|
||||||
|
writer.startSequence(this.protocolOp);
|
||||||
if (this._toBer)
|
if (this._toBer)
|
||||||
writer = this._toBer(writer);
|
writer = this._toBer(writer);
|
||||||
|
|
||||||
writer.endSequence();
|
writer.endSequence();
|
||||||
|
|
||||||
|
if (this.controls && this.controls.length) {
|
||||||
|
writer.startSequence(0xa0);
|
||||||
|
this.controls.forEach(function(c) {
|
||||||
|
c.toBer(writer);
|
||||||
|
});
|
||||||
|
writer.endSequence();
|
||||||
|
}
|
||||||
|
|
||||||
writer.endSequence();
|
writer.endSequence();
|
||||||
return writer.buffer;
|
return writer.buffer;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue