2011-08-04 20:32:01 +00:00
|
|
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
|
|
|
|
2015-10-31 17:28:25 +00:00
|
|
|
var assert = require('assert-plus');
|
2011-08-04 20:32:01 +00:00
|
|
|
var util = require('util');
|
|
|
|
|
|
|
|
var LDAPMessage = require('./message');
|
2011-08-30 18:12:34 +00:00
|
|
|
var dn = require('../dn');
|
2011-08-04 20:32:01 +00:00
|
|
|
var Protocol = require('../protocol');
|
|
|
|
|
|
|
|
|
|
|
|
///--- Globals
|
|
|
|
|
2011-08-30 18:12:34 +00:00
|
|
|
var DN = dn.DN;
|
|
|
|
var RDN = dn.RDN;
|
2011-08-04 20:32:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
///--- API
|
|
|
|
|
|
|
|
function UnbindRequest(options) {
|
2015-10-31 17:28:25 +00:00
|
|
|
options = options || {};
|
|
|
|
assert.object(options);
|
2011-08-04 20:32:01 +00:00
|
|
|
|
|
|
|
options.protocolOp = Protocol.LDAP_REQ_UNBIND;
|
|
|
|
LDAPMessage.call(this, options);
|
|
|
|
}
|
|
|
|
util.inherits(UnbindRequest, LDAPMessage);
|
2015-10-31 17:28:25 +00:00
|
|
|
Object.defineProperties(UnbindRequest.prototype, {
|
|
|
|
type: {
|
|
|
|
get: function getType() { return 'UnbindRequest'; },
|
|
|
|
configurable: false
|
|
|
|
},
|
|
|
|
_dn: {
|
|
|
|
get: function getDN() {
|
|
|
|
if (this.connection) {
|
|
|
|
return this.connection.ldap.bindDN;
|
|
|
|
} else {
|
|
|
|
return new DN([new RDN({cn: 'anonymous'})]);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
configurable: false
|
2011-08-04 20:32:01 +00:00
|
|
|
}
|
2015-10-31 17:28:25 +00:00
|
|
|
});
|
2011-08-04 20:32:01 +00:00
|
|
|
|
2012-02-18 08:15:52 +00:00
|
|
|
UnbindRequest.prototype._parse = function (ber) {
|
2011-08-04 20:32:01 +00:00
|
|
|
assert.ok(ber);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
|
2012-02-18 08:15:52 +00:00
|
|
|
UnbindRequest.prototype._toBer = function (ber) {
|
2011-08-04 20:32:01 +00:00
|
|
|
assert.ok(ber);
|
|
|
|
|
|
|
|
return ber;
|
|
|
|
};
|
|
|
|
|
2012-02-18 08:15:52 +00:00
|
|
|
UnbindRequest.prototype._json = function (j) {
|
2011-08-04 20:32:01 +00:00
|
|
|
assert.ok(j);
|
|
|
|
|
|
|
|
return j;
|
|
|
|
};
|
2015-10-31 17:28:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
///--- Exports
|
|
|
|
|
|
|
|
module.exports = UnbindRequest;
|