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

krill

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

krill - npm Package Compare versions

Comparing version 0.4.0 to 1.0.0

13

lib/krill.js

@@ -73,2 +73,7 @@ /*

{
if (this.trivial()) {
throw new Error('Cannot serialize empty predicate to LDAP '
+ 'search filter');
}
return (krillPrimPrintLDAP(this.p_pred));

@@ -628,4 +633,8 @@ };

if (nbKeys === 0)
return ('(*)');
/*
* Serializing an individual predicate with a number of keys !== 1 --
* that is an empty predicate, or a predicate with several keys -- to a
* LDAP filter string is not supported.
*/
mod_assert(nbKeys === 1);

@@ -632,0 +641,0 @@ return (krillOps[key].printLDAP(pred, key));

2

package.json
{
"name": "krill",
"description": "simple boolean filter language with support for C, DTrace and LDAP output",
"version": "0.4.0",
"version": "1.0.0",
"license": "MIT",

@@ -6,0 +6,0 @@ "contributors": [

@@ -86,2 +86,32 @@ # krill: simple boolean filter language

Please note however that without knowing the LDAP object schema, it is not
possible to generate a filter that matches all objects. As a result, trivial
predicates cannot be serialized as LDAP search filters:
```javascript
var pred = krill.createPredicate({});
pred.toLDAPSearchFilter();
/* Throws the following error:
Error: Cannot serialize empty predicate to LDAP search filter
*/
```
The recommended way to handle this case is to check if the predicate is trivial
before calling `toLDAPSearchFilter`:
```javascript
var pred = krill.createPredicate({});
var ldapSearchFilter;
if (!pred.trivial()) {
ldapSearchFilter = pred.toLDAPFilterString();
} else {
/*
* This example assumes that when the predicate is trivial, the intention
* is to build a LDAP search filter that includes all entries, but this is
* done only to illustrate a common use case.
*/
ldapSearchFilter = '(someRDN=*)';
}
```
You can also evaluate the predicate for a specific set of values:

@@ -88,0 +118,0 @@

@@ -18,3 +18,5 @@ /*

mod_assert.equal('1', pred.toCStyleString());
mod_assert.equal('(*)', pred.toLDAPFilterString());
mod_assert.throws(function emptyPredToLDAPFilter() {
pred.toLDAPFilterString()
}, /Cannot serialize empty predicate to LDAP search filter/);
mod_assert.ok(pred.eval({}));

@@ -21,0 +23,0 @@ mod_assert.ok(pred.eval({ 'hostname': 'sharptooth' }));

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