1 |
|
2 |
|
3 | const assert = require('assert-plus')
|
4 | const util = require('util')
|
5 |
|
6 | const dtrace = require('../dtrace')
|
7 |
|
8 | const LDAPMessage = require('./result')
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | function UnbindResponse (options) {
|
17 | options = options || {}
|
18 | assert.object(options)
|
19 |
|
20 | options.protocolOp = 0
|
21 | LDAPMessage.call(this, options)
|
22 | }
|
23 | util.inherits(UnbindResponse, LDAPMessage)
|
24 | Object.defineProperties(UnbindResponse.prototype, {
|
25 | type: {
|
26 | get: function getType () { return 'UnbindResponse' },
|
27 | configurable: false
|
28 | }
|
29 | })
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 | UnbindResponse.prototype.end = function (status) {
|
37 | assert.ok(this.connection)
|
38 |
|
39 | this.log.trace('%s: unbinding!', this.connection.ldap.id)
|
40 |
|
41 | this.connection.end()
|
42 |
|
43 | const self = this
|
44 | if (self._dtraceOp && self._dtraceId) {
|
45 | dtrace.fire('server-' + self._dtraceOp + '-done', function () {
|
46 | const c = self.connection || { ldap: {} }
|
47 | return [
|
48 | self._dtraceId || 0,
|
49 | (c.remoteAddress || ''),
|
50 | c.ldap.bindDN ? c.ldap.bindDN.toString() : '',
|
51 | (self.requestDN ? self.requestDN.toString() : ''),
|
52 | 0,
|
53 | ''
|
54 | ]
|
55 | })
|
56 | }
|
57 | }
|
58 |
|
59 | UnbindResponse.prototype._json = function (j) {
|
60 | return j
|
61 | }
|
62 |
|
63 |
|
64 |
|
65 | module.exports = UnbindResponse
|