2011-08-04 20:32:01 +00:00
|
|
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
|
|
|
|
2020-10-31 21:07:32 +00:00
|
|
|
const assert = require('assert-plus')
|
|
|
|
const util = require('util')
|
2011-08-04 20:32:01 +00:00
|
|
|
|
2020-10-31 21:07:32 +00:00
|
|
|
const dtrace = require('../dtrace')
|
2011-11-19 00:39:37 +00:00
|
|
|
|
2020-10-31 21:07:32 +00:00
|
|
|
const LDAPMessage = require('./result')
|
2019-08-27 21:11:49 +00:00
|
|
|
// var Protocol = require('../protocol')
|
2011-08-04 20:32:01 +00:00
|
|
|
|
2019-08-27 21:11:49 +00:00
|
|
|
/// --- API
|
2011-08-04 20:32:01 +00:00
|
|
|
// Ok, so there's really no such thing as an unbind 'response', but to make
|
|
|
|
// the framework not suck, I just made this up, and have it stubbed so it's
|
|
|
|
// not such a one-off.
|
|
|
|
|
2019-08-27 21:11:49 +00:00
|
|
|
function UnbindResponse (options) {
|
|
|
|
options = options || {}
|
|
|
|
assert.object(options)
|
2011-08-04 20:32:01 +00:00
|
|
|
|
2019-08-27 21:11:49 +00:00
|
|
|
options.protocolOp = 0
|
|
|
|
LDAPMessage.call(this, options)
|
2011-08-04 20:32:01 +00:00
|
|
|
}
|
2019-08-27 21:11:49 +00:00
|
|
|
util.inherits(UnbindResponse, LDAPMessage)
|
2015-10-31 17:28:25 +00:00
|
|
|
Object.defineProperties(UnbindResponse.prototype, {
|
|
|
|
type: {
|
2019-08-27 21:11:49 +00:00
|
|
|
get: function getType () { return 'UnbindResponse' },
|
2015-10-31 17:28:25 +00:00
|
|
|
configurable: false
|
|
|
|
}
|
2019-08-27 21:11:49 +00:00
|
|
|
})
|
2011-08-04 20:32:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Special override that just ends the connection, if present.
|
|
|
|
*
|
2020-12-07 01:26:27 +00:00
|
|
|
* @param {Number} _status completely ignored.
|
2011-08-04 20:32:01 +00:00
|
|
|
*/
|
2020-12-07 01:26:27 +00:00
|
|
|
UnbindResponse.prototype.end = function (_status) {
|
2019-08-27 21:11:49 +00:00
|
|
|
assert.ok(this.connection)
|
2011-08-04 20:32:01 +00:00
|
|
|
|
2019-08-27 21:11:49 +00:00
|
|
|
this.log.trace('%s: unbinding!', this.connection.ldap.id)
|
2011-08-04 20:32:01 +00:00
|
|
|
|
2019-08-27 21:11:49 +00:00
|
|
|
this.connection.end()
|
2011-11-19 00:39:37 +00:00
|
|
|
|
2020-10-31 21:07:32 +00:00
|
|
|
const self = this
|
2011-11-19 00:39:37 +00:00
|
|
|
if (self._dtraceOp && self._dtraceId) {
|
2012-02-18 08:15:52 +00:00
|
|
|
dtrace.fire('server-' + self._dtraceOp + '-done', function () {
|
2020-10-31 21:07:32 +00:00
|
|
|
const c = self.connection || { ldap: {} }
|
2011-11-19 00:39:37 +00:00
|
|
|
return [
|
|
|
|
self._dtraceId || 0,
|
|
|
|
(c.remoteAddress || ''),
|
|
|
|
c.ldap.bindDN ? c.ldap.bindDN.toString() : '',
|
|
|
|
(self.requestDN ? self.requestDN.toString() : ''),
|
|
|
|
0,
|
|
|
|
''
|
2019-08-27 21:11:49 +00:00
|
|
|
]
|
|
|
|
})
|
2011-11-19 00:39:37 +00:00
|
|
|
}
|
2019-08-27 21:11:49 +00:00
|
|
|
}
|
2011-08-04 20:32:01 +00:00
|
|
|
|
2012-02-18 08:15:52 +00:00
|
|
|
UnbindResponse.prototype._json = function (j) {
|
2019-08-27 21:11:49 +00:00
|
|
|
return j
|
|
|
|
}
|
2015-10-31 17:28:25 +00:00
|
|
|
|
2019-08-27 21:11:49 +00:00
|
|
|
/// --- Exports
|
2015-10-31 17:28:25 +00:00
|
|
|
|
2019-08-27 21:11:49 +00:00
|
|
|
module.exports = UnbindResponse
|