Code Monkey home page Code Monkey logo

controls's People

Contributors

its-sami avatar jsumners avatar

Watchers

 avatar  avatar  avatar

controls's Issues

Enable VLV controls

VLV controls are disabled because we are not clear that their implementation is correct. We need a way to test these controls against an LDAP server that we are confident implements them correctly. See the information in ldapjs/node-ldapjs#797 (comment) for more detail.

Please update @ldapjs/asn1 dependency to 2.0.0

Hi,

@ldapjs/controls still uses previous version of @ldapjs/asn1. I tried the following patch, but it's not enough.

Best regards,

diff --git a/index.js b/ldapjs-controls/index.js
index 9f260b7..0b85eeb 100644
--- a/index.js
+++ b/index.js
@@ -1,6 +1,6 @@
 'use strict'
 
-const { Ber } = require('@ldapjs/asn1')
+const { BerTypes } = require('@ldapjs/asn1')
 
 const Control = require('./lib/control')
 const EntryChangeNotificationControl = require('./lib/controls/entry-change-notification-control')
@@ -32,10 +32,10 @@ module.exports = {
       /* istanbul ignore else */
       if (ber.offset < end) {
         /* istanbul ignore else */
-        if (ber.peek() === Ber.Boolean) { opts.criticality = ber.readBoolean() }
+        if (ber.peek() === BerTypes.Boolean) { opts.criticality = ber.readBoolean() }
       }
 
-      if (ber.offset < end) { opts.value = ber.readString(Ber.OctetString, true) }
+      if (ber.offset < end) { opts.value = ber.readString(BerTypes.OctetString, true) }
     }
 
     let control
diff --git a/lib/controls/paged-results-control.js b/ldapjs-controls/lib/controls/paged-results-control.js
index fe7dc5f..82fcf23 100644
--- a/lib/controls/paged-results-control.js
+++ b/lib/controls/paged-results-control.js
@@ -1,6 +1,6 @@
 'use strict'
 
-const { Ber, BerReader, BerWriter } = require('@ldapjs/asn1')
+const { BerTypes, BerReader, BerWriter } = require('@ldapjs/asn1')
 const isObject = require('../is-object')
 const hasOwn = require('../has-own')
 const Control = require('../control')
@@ -71,7 +71,7 @@ class PagedResultsControl extends Control {
     if (ber.readSequence()) {
       this._value = {}
       this._value.size = ber.readInt()
-      this._value.cookie = ber.readString(Ber.OctetString, true)
+      this._value.cookie = ber.readString(BerTypes.OctetString, true)
       // readString returns '' instead of a zero-length buffer
       if (!this._value.cookie) {
         this._value.cookie = Buffer.alloc(0)
@@ -84,14 +84,14 @@ class PagedResultsControl extends Control {
     writer.startSequence()
     writer.writeInt(this._value.size)
     if (this._value.cookie && this._value.cookie.length > 0) {
-      writer.writeBuffer(this._value.cookie, Ber.OctetString)
+      writer.writeBuffer(this._value.cookie, BerTypes.OctetString)
     } else {
       // writeBuffer rejects zero-length buffers
       writer.writeString('')
     }
     writer.endSequence()
 
-    ber.writeBuffer(writer.buffer, Ber.OctetString)
+    ber.writeBuffer(writer.buffer, BerTypes.OctetString)
     return ber
   }
 
diff --git a/lib/controls/server-side-sorting-request-control.js b/ldapjs-controls/lib/controls/server-side-sorting-request-control.js
index 878fa4f..a9e5fc3 100644
--- a/lib/controls/server-side-sorting-request-control.js
+++ b/lib/controls/server-side-sorting-request-control.js
@@ -1,6 +1,6 @@
 'use strict'
 
-const { Ber, BerReader, BerWriter } = require('@ldapjs/asn1')
+const { BerTypes, BerReader, BerWriter } = require('@ldapjs/asn1')
 const isObject = require('../is-object')
 const hasOwn = require('../has-own')
 const Control = require('../control')
@@ -84,14 +84,14 @@ class ServerSideSortingRequestControl extends Control {
 
       while (ber.readSequence(0x30)) {
         item = {}
-        item.attributeType = ber.readString(Ber.OctetString)
+        item.attributeType = ber.readString(BerTypes.OctetString)
         /* istanbul ignore else */
         if (ber.peek() === 0x80) {
           item.orderingRule = ber.readString(0x80)
         }
         /* istanbul ignore else */
         if (ber.peek() === 0x81) {
-          item.reverseOrder = (ber._readTag(0x81) !== 0)
+          item.reverseOrder = (ber.readTag(0x81) !== 0)
         }
         this.value.push(item)
       }
@@ -113,7 +113,7 @@ class ServerSideSortingRequestControl extends Control {
       writer.startSequence(0x30)
       /* istanbul ignore else */
       if (hasOwn(item, 'attributeType')) {
-        writer.writeString(item.attributeType, Ber.OctetString)
+        writer.writeString(item.attributeType, BerTypes.OctetString)
       }
       /* istanbul ignore else */
       if (hasOwn(item, 'orderingRule')) {
diff --git a/lib/controls/virtual-list-view-response-control.js b/ldapjs-controls/lib/controls/virtual-list-view-response-control.js
index f9b1efe..f2383d0 100644
--- a/lib/controls/virtual-list-view-response-control.js
+++ b/lib/controls/virtual-list-view-response-control.js
@@ -1,6 +1,6 @@
 'use strict'
 
-const { Ber, BerReader, BerWriter } = require('@ldapjs/asn1')
+const { BerTypes, BerReader, BerWriter } = require('@ldapjs/asn1')
 const isObject = require('../is-object')
 const hasOwn = require('../has-own')
 const Control = require('../control')
@@ -106,7 +106,7 @@ class VirtualListViewResponseControl extends Control {
       }
 
       this._value.result = ber.readEnumeration()
-      this._value.cookie = ber.readString(Ber.OctetString, true)
+      this._value.cookie = ber.readString(BerTypes.OctetString, true)
 
       // readString returns '' instead of a zero-length buffer
       if (!this._value.cookie) {
@@ -138,7 +138,7 @@ class VirtualListViewResponseControl extends Control {
 
     writer.writeEnumeration(this.value.result)
     if (this.value.cookie && this.value.cookie.length > 0) {
-      writer.writeBuffer(this.value.cookie, Ber.OctetString)
+      writer.writeBuffer(this.value.cookie, BerTypes.OctetString)
     } else {
       writer.writeString('') // writeBuffer rejects zero-length buffers
     }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.