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 LDAPResult = require('./result')
|
|
|
|
const 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
|
|
|
|
2019-08-27 21:11:49 +00:00
|
|
|
function CompareResponse (options) {
|
|
|
|
options = options || {}
|
|
|
|
assert.object(options)
|
2011-08-04 20:32:01 +00:00
|
|
|
|
2019-08-27 21:11:49 +00:00
|
|
|
options.protocolOp = Protocol.LDAP_REP_COMPARE
|
|
|
|
LDAPResult.call(this, options)
|
2011-08-04 20:32:01 +00:00
|
|
|
}
|
2019-08-27 21:11:49 +00:00
|
|
|
util.inherits(CompareResponse, LDAPResult)
|
2011-08-23 00:16:36 +00:00
|
|
|
|
2012-02-18 08:15:52 +00:00
|
|
|
CompareResponse.prototype.end = function (matches) {
|
2020-10-31 21:07:32 +00:00
|
|
|
let status = 0x06
|
2012-02-18 08:15:52 +00:00
|
|
|
if (typeof (matches) === 'boolean') {
|
2019-08-27 21:11:49 +00:00
|
|
|
if (!matches) { status = 0x05 } // Compare false
|
2011-09-22 00:35:19 +00:00
|
|
|
} else {
|
2019-08-27 21:11:49 +00:00
|
|
|
status = matches
|
2011-08-23 00:16:36 +00:00
|
|
|
}
|
|
|
|
|
2019-08-27 21:11:49 +00:00
|
|
|
return LDAPResult.prototype.end.call(this, status)
|
|
|
|
}
|
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 = CompareResponse
|