Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ldapts

Package Overview
Dependencies
Maintainers
1
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ldapts - npm Package Compare versions

Comparing version 2.5.1 to 2.6.0

2

Attribute.d.ts

@@ -8,5 +8,7 @@ /// <reference types="node" />

export declare class Attribute {
private buffers;
type: string;
values: string[] | Buffer[];
constructor(options?: AttributeOptions);
get parsedBuffers(): Buffer[];
write(writer: BerWriter): void;

@@ -13,0 +15,0 @@ parse(reader: BerReader): void;

10

Attribute.js

@@ -8,5 +8,9 @@ "use strict";

constructor(options = {}) {
this.buffers = [];
this.type = options.type || '';
this.values = options.values || [];
}
get parsedBuffers() {
return this.buffers;
}
write(writer) {

@@ -46,7 +50,9 @@ writer.startSequence();

while (reader.offset < end) {
const buffer = reader.readString(asn1_1.Ber.OctetString, true) || Buffer.alloc(0);
this.buffers.push(buffer);
if (isBinaryType) {
this.values.push(reader.readString(asn1_1.Ber.OctetString, true) || Buffer.alloc(0));
this.values.push(buffer);
}
else {
this.values.push(reader.readString());
this.values.push(buffer.toString('utf8'));
}

@@ -53,0 +59,0 @@ }

@@ -25,2 +25,3 @@ "use strict";

default:
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
throw new Error(`Unknown change operation: ${this.operation}`);

@@ -27,0 +28,0 @@ }

@@ -0,1 +1,5 @@

### 2.6.0
* Update npms
* Expose parsedBuffers on Attribute and added `explicitBufferAttributes` to search options. Fix #72 and Fix #82
### 2.5.1

@@ -2,0 +6,0 @@ * Update npms

@@ -79,2 +79,6 @@ /// <reference types="node" />

attributes?: string[];
/**
* List of attributes to explicitly return as buffers
*/
explicitBufferAttributes?: string[];
}

@@ -174,2 +178,3 @@ export interface SearchResult {

* @param {string[]} [options.attributes] - A set of attributes to request for inclusion in entries that match the search criteria and are returned to the client. If a specific set of attribute descriptions are listed, then only those attributes should be included in matching entries. The special value “*” indicates that all user attributes should be included in matching entries. The special value “+” indicates that all operational attributes should be included in matching entries. The special value “1.1” indicates that no attributes should be included in matching entries. Some servers may also support the ability to use the “@” symbol followed by an object class name (e.g., “@inetOrgPerson”) to request all attributes associated with that object class. If the set of attributes to request is empty, then the server should behave as if the value “*” was specified to request that all user attributes be included in entries that are returned.
* @param {string[]} [options.explicitBufferAttributes] - List of attributes to explicitly return as buffers
* @param {Control|Control[]} [controls]

@@ -176,0 +181,0 @@ */

@@ -17,3 +17,3 @@ "use strict";

var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);

@@ -343,2 +343,3 @@ return result;

* @param {string[]} [options.attributes] - A set of attributes to request for inclusion in entries that match the search criteria and are returned to the client. If a specific set of attribute descriptions are listed, then only those attributes should be included in matching entries. The special value “*” indicates that all user attributes should be included in matching entries. The special value “+” indicates that all operational attributes should be included in matching entries. The special value “1.1” indicates that no attributes should be included in matching entries. Some servers may also support the ability to use the “@” symbol followed by an object class name (e.g., “@inetOrgPerson”) to request all attributes associated with that object class. If the set of attributes to request is empty, then the server should behave as if the value “*” was specified to request that all user attributes be included in entries that are returned.
* @param {string[]} [options.explicitBufferAttributes] - List of attributes to explicitly return as buffers
* @param {Control|Control[]} [controls]

@@ -405,2 +406,3 @@ */

attributes: options.attributes,
explicitBufferAttributes: options.explicitBufferAttributes,
returnAttributeValues: options.returnAttributeValues,

@@ -438,3 +440,3 @@ sizeLimit: options.sizeLimit,

for (const searchEntry of result.searchEntries) {
searchResult.searchEntries.push(searchEntry.toObject(searchRequest.attributes));
searchResult.searchEntries.push(searchEntry.toObject(searchRequest.attributes, searchRequest.explicitBufferAttributes));
}

@@ -614,3 +616,3 @@ for (const searchReference of result.searchReferences) {

const sendPromise = new Promise((resolve, reject) => {
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore

@@ -634,3 +636,3 @@ messageResolve = resolve;

// Send the message to the socket
logDebug(`Sending message: ${message}`);
logDebug(`Sending message: ${JSON.stringify(message)}`);
this.socket.write(message.write(), () => {

@@ -683,3 +685,3 @@ if (message instanceof messages_1.AbandonRequest) {

else {
logDebug(`Unable to find details related to message response: ${message}`);
logDebug(`Unable to find details related to message response: ${JSON.stringify(message)}`);
}

@@ -686,0 +688,0 @@ }

@@ -6,43 +6,40 @@ "use strict";

const Control_1 = require("./Control");
let EntryChangeNotificationControl = /** @class */ (() => {
class EntryChangeNotificationControl extends Control_1.Control {
constructor(options = {}) {
super(options);
this.type = EntryChangeNotificationControl.type;
this.value = options.value;
}
parseControl(reader) {
if (reader.readSequence()) {
const changeType = reader.readInt();
let previousDN;
if (changeType === 8) {
previousDN = reader.readString();
}
const changeNumber = reader.readInt();
this.value = {
changeType,
previousDN,
changeNumber,
};
class EntryChangeNotificationControl extends Control_1.Control {
constructor(options = {}) {
super(options);
this.type = EntryChangeNotificationControl.type;
this.value = options.value;
}
parseControl(reader) {
if (reader.readSequence()) {
const changeType = reader.readInt();
let previousDN;
if (changeType === 8) {
previousDN = reader.readString();
}
const changeNumber = reader.readInt();
this.value = {
changeType,
previousDN,
changeNumber,
};
}
writeControl(writer) {
if (!this.value) {
return;
}
const controlWriter = new asn1_1.BerWriter();
controlWriter.startSequence();
controlWriter.writeInt(this.value.changeType);
if (this.value.previousDN) {
controlWriter.writeString(this.value.previousDN);
}
controlWriter.writeInt(this.value.changeNumber);
controlWriter.endSequence();
writer.writeBuffer(controlWriter.buffer, 0x04);
}
writeControl(writer) {
if (!this.value) {
return;
}
const controlWriter = new asn1_1.BerWriter();
controlWriter.startSequence();
controlWriter.writeInt(this.value.changeType);
if (this.value.previousDN) {
controlWriter.writeString(this.value.previousDN);
}
controlWriter.writeInt(this.value.changeNumber);
controlWriter.endSequence();
writer.writeBuffer(controlWriter.buffer, 0x04);
}
EntryChangeNotificationControl.type = '2.16.840.1.113730.3.4.7';
return EntryChangeNotificationControl;
})();
}
exports.EntryChangeNotificationControl = EntryChangeNotificationControl;
EntryChangeNotificationControl.type = '2.16.840.1.113730.3.4.7';
//# sourceMappingURL=EntryChangeNotificationControl.js.map

@@ -6,40 +6,37 @@ "use strict";

const Control_1 = require("./Control");
let PagedResultsControl = /** @class */ (() => {
class PagedResultsControl extends Control_1.Control {
constructor(options = {}) {
super(options);
this.type = PagedResultsControl.type;
this.value = options.value;
class PagedResultsControl extends Control_1.Control {
constructor(options = {}) {
super(options);
this.type = PagedResultsControl.type;
this.value = options.value;
}
parseControl(reader) {
if (reader.readSequence()) {
const size = reader.readInt();
const cookie = reader.readString(asn1_1.Ber.OctetString, true) || Buffer.alloc(0);
this.value = {
size,
cookie,
};
}
parseControl(reader) {
if (reader.readSequence()) {
const size = reader.readInt();
const cookie = reader.readString(asn1_1.Ber.OctetString, true) || Buffer.alloc(0);
this.value = {
size,
cookie,
};
}
}
writeControl(writer) {
if (!this.value) {
return;
}
writeControl(writer) {
if (!this.value) {
return;
}
const controlWriter = new asn1_1.BerWriter();
controlWriter.startSequence();
controlWriter.writeInt(this.value.size);
if (this.value.cookie && this.value.cookie.length) {
controlWriter.writeBuffer(this.value.cookie, asn1_1.Ber.OctetString);
}
else {
controlWriter.writeString('');
}
controlWriter.endSequence();
writer.writeBuffer(controlWriter.buffer, 0x04);
const controlWriter = new asn1_1.BerWriter();
controlWriter.startSequence();
controlWriter.writeInt(this.value.size);
if (this.value.cookie && this.value.cookie.length) {
controlWriter.writeBuffer(this.value.cookie, asn1_1.Ber.OctetString);
}
else {
controlWriter.writeString('');
}
controlWriter.endSequence();
writer.writeBuffer(controlWriter.buffer, 0x04);
}
PagedResultsControl.type = '1.2.840.113556.1.4.319';
return PagedResultsControl;
})();
}
exports.PagedResultsControl = PagedResultsControl;
PagedResultsControl.type = '1.2.840.113556.1.4.319';
//# sourceMappingURL=PagedResultsControl.js.map

@@ -6,38 +6,35 @@ "use strict";

const Control_1 = require("./Control");
let PersistentSearchControl = /** @class */ (() => {
class PersistentSearchControl extends Control_1.Control {
constructor(options = {}) {
super(options);
this.type = PersistentSearchControl.type;
this.value = options.value;
class PersistentSearchControl extends Control_1.Control {
constructor(options = {}) {
super(options);
this.type = PersistentSearchControl.type;
this.value = options.value;
}
parseControl(reader) {
if (reader.readSequence()) {
const changeTypes = reader.readInt();
const changesOnly = reader.readBoolean();
const returnECs = reader.readBoolean();
this.value = {
changeTypes,
changesOnly,
returnECs,
};
}
parseControl(reader) {
if (reader.readSequence()) {
const changeTypes = reader.readInt();
const changesOnly = reader.readBoolean();
const returnECs = reader.readBoolean();
this.value = {
changeTypes,
changesOnly,
returnECs,
};
}
}
writeControl(writer) {
if (!this.value) {
return;
}
writeControl(writer) {
if (!this.value) {
return;
}
const controlWriter = new asn1_1.BerWriter();
controlWriter.startSequence();
controlWriter.writeInt(this.value.changeTypes);
controlWriter.writeBoolean(this.value.changesOnly);
controlWriter.writeBoolean(this.value.returnECs);
controlWriter.endSequence();
writer.writeBuffer(controlWriter.buffer, 0x04);
}
const controlWriter = new asn1_1.BerWriter();
controlWriter.startSequence();
controlWriter.writeInt(this.value.changeTypes);
controlWriter.writeBoolean(this.value.changesOnly);
controlWriter.writeBoolean(this.value.returnECs);
controlWriter.endSequence();
writer.writeBuffer(controlWriter.buffer, 0x04);
}
PersistentSearchControl.type = '2.16.840.1.113730.3.4.3';
return PersistentSearchControl;
})();
}
exports.PersistentSearchControl = PersistentSearchControl;
PersistentSearchControl.type = '2.16.840.1.113730.3.4.3';
//# sourceMappingURL=PersistentSearchControl.js.map

@@ -6,62 +6,59 @@ "use strict";

const Control_1 = require("./Control");
let ServerSideSortingRequestControl = /** @class */ (() => {
class ServerSideSortingRequestControl extends Control_1.Control {
constructor(options = {}) {
super(options);
this.type = ServerSideSortingRequestControl.type;
if (Array.isArray(options.value)) {
this.values = options.value;
}
else if (typeof options.value === 'object') {
this.values = [options.value];
}
else {
this.values = [];
}
class ServerSideSortingRequestControl extends Control_1.Control {
constructor(options = {}) {
super(options);
this.type = ServerSideSortingRequestControl.type;
if (Array.isArray(options.value)) {
this.values = options.value;
}
parseControl(reader) {
if (reader.readSequence(0x30)) {
while (reader.readSequence(0x30)) {
const attributeType = reader.readString();
let orderingRule = '';
let reverseOrder = false;
if (reader.peek() === 0x80) {
orderingRule = reader.readString(0x80);
}
if (reader.peek() === 0x81) {
reverseOrder = reader._readTag(0x81) !== 0;
}
this.values.push({
attributeType,
orderingRule,
reverseOrder,
});
else if (typeof options.value === 'object') {
this.values = [options.value];
}
else {
this.values = [];
}
}
parseControl(reader) {
if (reader.readSequence(0x30)) {
while (reader.readSequence(0x30)) {
const attributeType = reader.readString();
let orderingRule = '';
let reverseOrder = false;
if (reader.peek() === 0x80) {
orderingRule = reader.readString(0x80);
}
if (reader.peek() === 0x81) {
reverseOrder = reader._readTag(0x81) !== 0;
}
this.values.push({
attributeType,
orderingRule,
reverseOrder,
});
}
}
writeControl(writer) {
if (!this.values.length) {
return;
}
const controlWriter = new asn1_1.BerWriter();
}
writeControl(writer) {
if (!this.values.length) {
return;
}
const controlWriter = new asn1_1.BerWriter();
controlWriter.startSequence(0x30);
for (const value of this.values) {
controlWriter.startSequence(0x30);
for (const value of this.values) {
controlWriter.startSequence(0x30);
controlWriter.writeString(value.attributeType, asn1_1.Ber.OctetString);
if (value.orderingRule) {
controlWriter.writeString(value.orderingRule, 0x80);
}
if (typeof value.reverseOrder !== 'undefined') {
controlWriter.writeBoolean(value.reverseOrder, 0x81);
}
controlWriter.endSequence();
controlWriter.writeString(value.attributeType, asn1_1.Ber.OctetString);
if (value.orderingRule) {
controlWriter.writeString(value.orderingRule, 0x80);
}
if (typeof value.reverseOrder !== 'undefined') {
controlWriter.writeBoolean(value.reverseOrder, 0x81);
}
controlWriter.endSequence();
writer.writeBuffer(controlWriter.buffer, 0x04);
}
controlWriter.endSequence();
writer.writeBuffer(controlWriter.buffer, 0x04);
}
ServerSideSortingRequestControl.type = '2.16.840.1.113730.3.4.3';
return ServerSideSortingRequestControl;
})();
}
exports.ServerSideSortingRequestControl = ServerSideSortingRequestControl;
ServerSideSortingRequestControl.type = '2.16.840.1.113730.3.4.3';
//# sourceMappingURL=ServerSideSortingRequestControl.js.map

@@ -110,3 +110,3 @@ "use strict";

default:
throw new Error(`Invalid search filter type: 0x${type}`);
throw new Error(`Invalid search filter type: 0x${type || '<null>'}`);
}

@@ -113,0 +113,0 @@ return filter;

@@ -17,3 +17,3 @@ "use strict";

var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);

@@ -20,0 +20,0 @@ return result;

@@ -17,3 +17,3 @@ "use strict";

var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);

@@ -20,0 +20,0 @@ return result;

@@ -20,3 +20,3 @@ /// <reference types="node" />

parseMessage(reader: BerReader): void;
toObject(requestAttributes: string[]): Entry;
toObject(requestAttributes: string[], explicitBufferAttributes: string[]): Entry;
}

@@ -24,14 +24,19 @@ "use strict";

}
toObject(requestAttributes) {
toObject(requestAttributes, explicitBufferAttributes) {
const result = {
dn: this.name,
};
const hasExplicitBufferAttributes = explicitBufferAttributes && explicitBufferAttributes.length;
for (const attribute of this.attributes) {
if (attribute.values && attribute.values.length) {
if (attribute.values.length === 1) {
let { values } = attribute;
if (hasExplicitBufferAttributes && explicitBufferAttributes.includes(attribute.type)) {
values = attribute.parsedBuffers;
}
if (values && values.length) {
if (values.length === 1) {
// eslint-disable-next-line prefer-destructuring
result[attribute.type] = attribute.values[0];
result[attribute.type] = values[0];
}
else {
result[attribute.type] = attribute.values;
result[attribute.type] = values;
}

@@ -38,0 +43,0 @@ }

@@ -20,2 +20,3 @@ import { BerReader, BerWriter } from 'asn1';

attributes: string[];
explicitBufferAttributes: string[];
constructor(options: SearchRequestMessageOptions);

@@ -22,0 +23,0 @@ writeMessage(writer: BerWriter): void;

@@ -19,2 +19,3 @@ "use strict";

this.attributes = options.attributes || [];
this.explicitBufferAttributes = options.explicitBufferAttributes || [];
}

@@ -37,2 +38,3 @@ writeMessage(writer) {

default:
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
throw new Error(`Invalid search scope: ${this.scope}`);

@@ -54,2 +56,3 @@ }

default:
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
throw new Error(`Invalid deref alias: ${this.derefAliases}`);

@@ -56,0 +59,0 @@ }

{
"name": "ldapts",
"version": "2.5.1",
"version": "2.6.0",
"description": "LDAP client",

@@ -47,3 +47,3 @@ "main": "index.js",

"@types/asn1": "~0.2.0",
"@types/node": "~14.0.4",
"@types/node": "~14.0.23",
"@types/uuid": "~8.0.0",

@@ -53,27 +53,27 @@ "asn1": "~0.2.4",

"strict-event-emitter-types": "~2.0.0",
"uuid": "~8.0.0"
"uuid": "~8.2.0"
},
"devDependencies": {
"@types/chai": "~4.2.11",
"@types/chai-as-promised": "~7.1.2",
"@types/chai-as-promised": "~7.1.3",
"@types/debug": "~4.1.5",
"@types/mocha": "~7.0.2",
"@typescript-eslint/eslint-plugin": "~2.34.0",
"@typescript-eslint/parser": "~2.34.0",
"@types/mocha": "~8.0.0",
"@typescript-eslint/eslint-plugin": "~3.6.1",
"@typescript-eslint/parser": "~3.6.1",
"chai": "~4.2.0",
"chai-as-promised": "~7.1.1",
"eslint": "~7.0.0",
"eslint-config-airbnb-base": "~14.1.0",
"eslint-plugin-import": "~2.20.2",
"eslint-plugin-jsdoc": "~25.4.2",
"eslint-plugin-mocha": "~7.0.0",
"eslint": "~7.4.0",
"eslint-config-airbnb-base": "~14.2.0",
"eslint-plugin-import": "~2.22.0",
"eslint-plugin-jsdoc": "~29.2.0",
"eslint-plugin-mocha": "~7.0.1",
"eslint-plugin-promise": "~4.2.1",
"eslint-plugin-security": "~1.4.0",
"husky": "~3.1.0",
"lint-staged": "~10.2.4",
"mocha": "~7.1.2",
"ts-mockito": "~2.5.0",
"ts-node": "~8.10.1",
"typescript": "~3.9.3"
"lint-staged": "~10.2.11",
"mocha": "~8.0.1",
"ts-mockito": "~2.6.1",
"ts-node": "~8.10.2",
"typescript": "~3.9.6"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc