Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

unbind_response.js 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // Copyright 2011 Mark Cavage, Inc. All rights reserved.
  2. var assert = require('assert-plus');
  3. var util = require('util');
  4. var dtrace = require('../dtrace');
  5. var LDAPMessage = require('./result');
  6. var Protocol = require('../protocol');
  7. ///--- API
  8. // Ok, so there's really no such thing as an unbind 'response', but to make
  9. // the framework not suck, I just made this up, and have it stubbed so it's
  10. // not such a one-off.
  11. function UnbindResponse(options) {
  12. options = options || {};
  13. assert.object(options);
  14. options.protocolOp = 0;
  15. LDAPMessage.call(this, options);
  16. }
  17. util.inherits(UnbindResponse, LDAPMessage);
  18. Object.defineProperties(UnbindResponse.prototype, {
  19. type: {
  20. get: function getType() { return 'UnbindResponse'; },
  21. configurable: false
  22. }
  23. });
  24. /**
  25. * Special override that just ends the connection, if present.
  26. *
  27. * @param {Number} status completely ignored.
  28. */
  29. UnbindResponse.prototype.end = function (status) {
  30. assert.ok(this.connection);
  31. this.log.trace('%s: unbinding!', this.connection.ldap.id);
  32. this.connection.end();
  33. var self = this;
  34. if (self._dtraceOp && self._dtraceId) {
  35. dtrace.fire('server-' + self._dtraceOp + '-done', function () {
  36. var c = self.connection || {ldap: {}};
  37. return [
  38. self._dtraceId || 0,
  39. (c.remoteAddress || ''),
  40. c.ldap.bindDN ? c.ldap.bindDN.toString() : '',
  41. (self.requestDN ? self.requestDN.toString() : ''),
  42. 0,
  43. ''
  44. ];
  45. });
  46. }
  47. };
  48. UnbindResponse.prototype._json = function (j) {
  49. return j;
  50. };
  51. ///--- Exports
  52. module.exports = UnbindResponse;