Commit Graph

318 Commits

Author SHA1 Message Date
Patrick Mooney b555463a90 Minor cleanup in SearchPager 2014-07-25 13:21:02 -05:00
Patrick Mooney d665378c0e Improve client paged search handling
Search response objects now include more instrumentation and control when
automatically fetching paged results.  See the SearchPager documentation
for more details.

Fix mcavage/node-ldapjs#203
2014-07-24 15:41:24 -05:00
Patrick Mooney abdd4890e5 Move client.connect into public API
In cases where a reconnect-enabled client has been manually disconnected
via unbind, it may be desirable to initiate a reconnect without
incurring other client actions.
2014-07-18 10:29:46 -05:00
Patrick Mooney 59bebe537b Make Attribute detection more strict
The old Attribute.isAttribute would allow objects lacking the toBer
method to be attached to Change objects.  This would result in errors
during serialization.

With the stricter Attribute detection, it's necessary to convert
Attribute-like objects containing type (string) and vals (array)
properties into real Attribute objects.  This precise detection is
necessary to avoid falling back to the object-keys-into-attributes

That other logic which will turn a well structured Attribute-like object
such as this:

  { type: 'valid', vals: ['something'] }

... and turn it into something broken like this:

  [
    { type: 'type', vals: ['valid'] },
    { type: 'vals', vals: ['something'] }
  ]
2014-07-17 13:33:02 -05:00
Patrick Mooney 48bd7bfe82 Fix message parsing for length-sensitive types
Certain LDAP messages (such as DeleteRequest) encode their contents as
raw bytes within the top-level sequence object.  As such, they rely
their length being passed to them when LDAPMessage decodes the sequence.

This was being done incorrectly, but would not manifest itself as a
problem unless controls followed the message.  If no controls were
present, then length of the sequence item was bounded by the message
itself and the parse would succeed.

Fix mcavage/node-ldapjs#212
2014-07-16 18:53:06 -05:00
Patrick Mooney a80cedd870 Add Change.apply method for object modification 2014-07-16 14:53:13 -05:00
Patrick Mooney dd63fea6f7 Preserve raw Buffer value in Control objects
Fix mcavage/node-ldapjs#143
2014-07-14 14:47:56 -05:00
Patrick Mooney 2939fa1fad Improve client request state tracking
- Handle abandoned requests properly
- Re-enable client abandon test
- Report client idleness correctly (even after abandons)

Fix mcavage/node-ldapjs#211
2014-07-09 13:40:17 -05:00
Patrick Mooney 6607d83b86 Add automatic bind support to client
The pooled client would automatically bind when initializing connections
if bindDN and bindCredentials were passed to during construction.
This convenience should be supported in the plain client too.
2014-07-08 21:44:01 -05:00
Patrick Mooney 0509dd44c0 Fix circular dependency in controls 2014-07-01 18:36:47 -05:00
Patrick Mooney 8f29f3b68d Merge ServerSideSort controls
Fix mcavage/node-ldapjs#187
2014-06-30 11:56:50 -05:00
Patrick Mooney aed6d2b043 Add optional error arg to client destroy event 2014-06-27 17:28:04 -05:00
Patrick Mooney 4bd454e608 Fix client initiation of multiple reconnect ops
If the client queue was enabled and requests were made during the
reconnect process (but after one unsuccessful connection attempt), they
would spawn concurrent reconnection attempts.
2014-06-27 16:48:13 -05:00
Patrick Mooney c7cd5da208 Improve client reconnect behavior
A client configured to reconnect should do so on socket close unless
unbind was called explicitly.  This covers cases where the connection
undergoes clean but unexpected termination.
2014-06-27 16:15:04 -05:00
Patrick Mooney 3edf9de578 Suppress setup errors after client.destroy
This allows clients to be destroyed during setupError events without
emitting errors from the connect/setup retry loop.
2014-06-26 12:05:34 -05:00
Patrick Mooney 28d3ed86e1 Refine client reconnection logic
- Emit setupError for errors during client setup
- Client accepts more generic options.reconnect
- Fix unbind hang in client.destroy
- Add tests for client reconnect/setup scenarios
2014-06-26 10:11:07 -05:00
Patrick Mooney 9e2bbe1072 Alter client queue parameters and error reporting
- Use 'queueDisable' as option for disabling client RequestQueue
- Throw more meaningful ConnectionError when enqueue fails
2014-06-25 14:38:26 -05:00
Patrick Mooney b49c2efed2 Fix socket close event handling in node.js 0.11.x
Fix mcavage/node-ldapjs#205
2014-06-24 18:41:11 -05:00
Patrick Mooney ea96468602 Use proper Change object detection in client 2014-06-24 17:43:25 -05:00
Patrick Mooney 1d2cf79bff Add ducktyping Change.isChange method
Similar to Filter.isFilter, this should help mitigate instanceof issues.
2014-06-24 14:14:17 -05:00
Patrick Mooney a0fd56d7b3 Fix reconnect abort logic on client.destroy() 2014-06-24 13:25:21 -05:00
Patrick Mooney 41f99c5b1a Merge pfmooney/gh-202
Fix mcavage/node-ldapjs#202
2014-06-24 11:06:09 -05:00
Patrick Mooney acfaa69a07 Fix client RequestQueue
- Reference documented queue parameters
- Add freeze/thaw methods
2014-06-24 11:04:23 -05:00
Patrick Mooney 3b101a7b2f Cease reconnection when client.destroy is called 2014-06-24 05:45:06 -05:00
Patrick Mooney 00956eaae5 Add ducktyping Filter.isFilter method
This should make some headway in avoiding instanceof pitfalls when
dealing with Filter objects.

Fix mcavage/node-ldapjs#123
2014-06-23 18:09:56 -05:00
Patrick Mooney 72bfb9b0f7 Major overhaul of client connection logic
- Remove PooledClient
- Add reconnect functionality to client
- Add 'idle' client event and options
2014-06-23 16:15:52 -05:00
Patrick Mooney f3e376d40b Alter presence testing for Attribute vals
Ignoring a null 'vals' options while constructing a new Attribute object
will more closely mimic the behavior prior to mcavage/node-ldapjs#178.
2014-06-23 13:37:35 -05:00
Patrick Mooney f213b3e9a2 Allow configuration of derefAliases client option
Fix mcavage/node-ldapjs#134
2014-06-16 10:07:55 -05:00
Patrick Mooney e8593f78ce Add ServerSideSortingResponseControl 2014-06-09 15:58:01 -07:00
Patrick Mooney 352e4bbfba Rename ServerSideSortingControl
ServerSideSortingRequestControl will be more consistent when
ServerSideSortingResponseControl is implemented.
2014-06-09 15:37:19 -07:00
Patrick Mooney f1d4b667c3 Refactor ServerSideSortingControl
- Fix lint errors
- Always store SSSC sort fields as array
- Rename test file to match 'make test' pattern
2014-06-06 17:23:27 -05:00
Patrick Mooney 349e0f91bd Merge qvicksilver/server_side_sorting 2014-06-06 14:56:56 -05:00
Patrick Mooney d9b2b1378e Properly dispatch unbind requests
Fix mcavage/node-ldapjs#197
2014-06-06 14:05:08 -05:00
Patrick Mooney 5a6e781293 Handle string ports properly in server.listen
Parse port as an integer when possible in server.listen.  In addition to
fixing server.url output, this avoids some weird socket reuse behavior
when mixing string and integer types passed to net.listen.

Fix mcavage/node-ldapjs#196
2014-06-06 12:21:05 -05:00
Patrick Mooney e92977b514 Refactor server route handling
Force route lookups to proceed lexically through mounted endpoint DNs.
Mounting to a null ('') DN will act as the default route for requests
which aren't matched by defined routes.

Fix mcavage/node-ldapjs#154
Fix mcavage/node-ldapjs#111
2014-06-05 16:53:23 -05:00
Patrick Mooney 87117ecdec Use Buffer storage for EqualityFilter value
Store the value portion of EqualityFilter objects in raw attribute.
Certain binary-only comparisons (such as GUIDs or objectSIDs) are
difficult, if not impossible, to handle without direct binary access.
2014-06-01 19:46:11 -05:00
= b742e286db Fixed parse method and added some tests 2014-05-30 20:57:06 +00:00
Patrick Mooney 8d0a2d0d99 Add error code 123 from RFC4370 2014-05-24 09:53:37 -05:00
Jonathan Süssemilch Poulain c5ccafd436 Server Side Sorting control 2014-05-16 17:10:24 +02:00
Patrick Mooney 8f1eb06ffa Perform strict presence testing on attribute vals
When initializing an Attribute object, the 'vals' option field was being
loosely tested for content presence.  By changing this test to a strict
comparison against undefined, Attribute object creation will be more
consistent across input values.

Fix mcavage/node-ldapjs#178
2014-05-11 20:38:37 -05:00
Tobias Muellerleile e3d8ba2f37 Fixup for 501fb5a46b 2014-05-06 14:33:43 +02:00
Tobias Muellerleile 501fb5a46b Accept buffers for cert/key in createServer 2014-05-06 07:36:18 +02:00
Patrick Mooney d530893cce Merge pfmooney/parser-error-handling
* pfmooney/parser-error-handling:
  Improve parser error handling
2014-04-04 15:14:32 -05:00
Evan Shortiss 9afecfd788 Upadte to make dtrace-provider optional. Fix bug in original update. 2014-04-02 10:51:10 -04:00
Evan Shortiss b3b26a48fa Fix DTraceProvider name 2014-04-01 23:24:41 -04:00
Evan Shortiss a84546b7bd Update to make dtrace-provider optional. 2014-04-01 23:02:11 -04:00
Patrick Mooney 7c7c480eb8 Improve parser error handling
In cases where one side of the connection is not communicated with valid
ASN.1/BER, it would be better to fire an error event rather than let the
exception bubble all the way up.

Fix mcavage/node-ldapjs#142
2014-03-15 16:06:42 -05:00
Patrick Mooney d20308265a Circumvent lack of 'close' event for tls sockets
It appears that in node.js (at least recent versions), the 'close' event
is not emitted by TLS sockets.  The CleartextStream class specifies that
the 'close' event is optional, so such operation is allowed.  In order
to compensate, the event can be trapped at the raw net.socket instead.

Fix mcavage/node-ldapjs#161
2014-01-23 10:06:40 -06:00
Patrick Mooney c5cfc48da4 Remove buffertools dependency 2014-01-20 09:34:11 -06:00
Patrick Mooney bc19a98d06 Update buffertools dependency
Buffertools 2.0.1 is required to build on VC2013.
With the change to v2.x, the buffertools.extend() method must be called
to mimic the prototype extention behavior of the 1.x versions.

Fix mcavage/node-ldapjs#163
2014-01-18 14:42:21 -06:00
Patrick Mooney 6414682eee Merge pfmooney/filter-case-attrs
Fix mcavage/node-ldapjs#155
2014-01-17 15:58:32 -06:00
Patrick Mooney 7bacfb676e Merge from pfmooney/client-pool-events
Fix mcavage/node-ldapjs#162
2014-01-17 15:33:11 -06:00
Mark Cavage bc897f9fd4 lint/test cleanup 2014-01-17 09:52:26 -08:00
Patrick Mooney 6b7906ce99 Fix error event handling for pooled clients
Do not emit error events if no listeners are present
2014-01-17 10:47:51 -06:00
Gonzalo Huerta-Canepa 737009ee15 Modified client to allow buffer as a value for exop 2014-01-03 12:58:20 +00:00
Gonzalo Huerta-Canepa fce043d6d0 Allow ext request message to have a buffer value in order to accomodate rfc3062 exop 2014-01-03 12:47:42 +00:00
Patrick Mooney 9c78c06643 Make *Filter.matches case insensitive for attrs 2013-11-30 23:39:33 -06:00
Patrick Mooney 57fecb06d5 Update Filter utility functions
- Write simple tests for multi_test
- Add get_attr_caseless function for improving Filter.Match
2013-11-30 23:31:15 -06:00
Patrick Mooney dfbb6031c6 Merge client-pool-events from pfmooney/node-ldapjs
Fix mcavage/node-ldapjs#87
2013-11-28 14:09:28 -06:00
Patrick Mooney f5ba81dc38 Minor update to ClientPool event pass-through
- Allow event pass-through when performing ClientPool.bind
- Rename createPool parameter for better readability
- Fix jsstyle error
2013-11-28 14:08:17 -06:00
Patrick Mooney ebcba1205d Fix unhandled error during client connection
Client actions utilizing an EventEmitter may generate unhandled errors,
especially during initial connection.  Tracking whether the emitter has
been sent via callback is critical for proper routing of such errors.

Fix mcavage/node-ldapjs#144
2013-10-30 18:24:37 -05:00
Patrick Mooney df13275b8e Output ldapi:// URLs for UNIX domain sockets 2013-10-29 23:46:48 -05:00
Patrick Mooney 00bcb58ea1 Fix jsstyle error 2013-10-29 23:38:12 -05:00
Patrick Mooney d4a9d371f0 Re-enable ability to listen on UNIX domain sockets 2013-10-29 23:29:21 -05:00
Patrick Mooney 5d91284e57 Merge ephemeral_port from lloyd/node-ldapjs 2013-10-29 23:28:26 -05:00
Mark Cavage aa633dfd20 support extensible matching of caseIgnore and caseIgnoreSubstrings 2013-10-28 21:12:12 +00:00
Patrick Mooney e03d40957e Fix some ClientPool event handling
Emit connectTimeout and error events from ClientPool as Client would.
2013-10-24 21:04:50 -05:00
Patrick Mooney 0d12eef3ff Improve DN formatting flexibility
- Add 'spaced' function to DN objects allowing toggle of inter-RDN when
  rendering to a string.  ('dc=test,dc=tld' vs 'dc=test, dc=tld')

- Detect RDN spacing when parsing DN.
2013-10-24 18:27:42 -05:00
Pedro Palazón Candel 6c00badd95 Fixed Typo on AddRequest.getAttribute 2013-10-08 19:57:53 +02:00
Lloyd Hilaiel 04eab4716c allow binding ldap server on an ephemeral port 2013-05-27 14:49:44 -06:00
Pedro Palazón Candel a796c3efbf remove listeners on the right object (s/client/res/) 2013-04-30 21:16:45 +03:00
José F. Romaniello 0bd66caae9 Fixes #127 - socket is closed issue with pools 2013-04-10 10:17:23 -03:00
Tobias Muellerleile 4708b61cf4 Allow changing TLS connection options in client 2013-03-15 13:23:43 +01:00
Matti Kononen a73a7ecb2c Fixed a bug with formatting digits less than 16. 2013-02-28 08:48:04 +02:00
Rob Gulewich f52a29e24c GH-118: "failed to instantiate provider" warnings in console on SmartOS 2013-02-25 21:11:52 -08:00
Mark Cavage 3fc422ac2b filter parsing not catching (() 2013-02-07 18:16:40 +00:00
Mark Cavage 5a79884977 allow _ in search filters 2013-01-31 15:51:23 +00:00
Mark Cavage 5157e72f5d Merge branch 'master' of git://github.com/morphar/node-ldapjs into morphar-master 2013-01-31 01:06:40 +00:00
Mark Cavage 55ba2d1855 lint cleanup 2013-01-30 23:58:40 +00:00
Mark Cavage 9e35cf76ac Merge branch '109-escape-filter' of git://github.com/Kenoxa/node-ldapjs into Kenoxa-109-escape-filter 2013-01-30 23:54:34 +00:00
Mark Cavage ea8aac5781 lint cleanup 2013-01-30 23:52:44 +00:00
Mark Cavage 9cfeed0bdc Merge branch 'master' of git://github.com/DenisVuyka/node-ldapjs into DenisVuyka-master 2013-01-30 23:50:48 +00:00
Mark Cavage 24e02f8d88 throw on all bad filters 2013-01-30 23:50:19 +00:00
Mark Cavage 0535dd8534 version bump 2013-01-29 18:38:39 +00:00
Denis Vuyka 2b433bb3ad Added objectGUID formatting support
see readme for more details
2013-01-15 22:19:20 +02:00
Doug Campbell efb3ea98b7 make changes recommended in Issue 97 2013-01-14 17:14:35 +08:00
Sascha Tandel 20368c58c1 #109: escape filter attribute/values only in toString() 2013-01-11 11:01:51 +01:00
Dan Larsen 2435d1cf93 Added a raw getter to be able to extract images correctly 2012-12-07 23:07:53 +01:00
Mark Cavage 51e6abf477 throw on invalid filter syntax 2012-10-11 20:04:10 +00:00
Mark Cavage 2579c251fb lint/style cleanup and build support updates 2012-09-20 19:38:46 +00:00
Jason Pincin 4de2aa3ed2 client-side support for paged search
Re-applied paged search work by thomasv, without introducing logging
changes.
2012-09-19 16:39:31 -04:00
Pedro P. Candel 3c1feec071 Instead of log with error log level, emit "clientError" and let each ldap server decide how to log. 2012-09-11 11:49:37 +02:00
Pedro P. Candel 5cd593a5ec Log errors with error log level instead of trace. 2012-09-10 09:09:50 +02:00
Kevin Chan 6c7e33763a option.maxConnections of 1 should not create a ClientPool 2012-08-03 15:53:25 -07:00
Pedro P. Candel 2a30dee86b Fixes mcavage/node-ldapjs#83: "ReferenceError: removeAllListeners is not defined" 2012-07-13 16:01:38 +02:00
Mark Cavage 9d984b72fc 0.5.2 broke pooled SSL 2012-07-10 22:40:34 +00:00
Mark Cavage 0da050009b Bad event handling, and working with node 0.8 2012-07-09 13:00:51 +00:00
Mark Cavage fd9d713cdc Fix client memory leaks 2012-07-09 12:23:53 +00:00
Mark Cavage e378ae8474 use connect() instead of createConnection() as the tls api does not have createConnection 2012-04-27 11:02:49 -07:00
Mark Cavage 15413542c9 purge reference to generic-pool 2012-04-26 20:53:23 -07:00
Mark Cavage 3bcb74aa66 GH-72 s/debug/trace/g in client 2012-04-26 20:47:03 -07:00
Mark Cavage 59ea20ffa2 Client refactor, with pooled client (minor lint cleanup as well) 2012-04-26 20:23:43 -07:00
Mark Cavage 89d3dfc97b special handling of objectclass in search filters 2012-04-17 14:19:31 -07:00
Trent Mick e825615d9e Fix client 'connect' event being send when using tls.
With `tls.connect()` the socket connect event is 'secureConnect' instead
of 'connect'.
2012-04-13 15:42:58 -07:00
Nathan Rogers 91051377da added tests and better handle zero-length cookies 2012-03-26 14:30:23 -05:00
Nathan Rogers fd085c409d add support for RFC 2696 paged results controls 2012-03-26 13:53:30 -05:00
Mark Cavage 344cac0287 filter parsing turning presence filter into substring filter 2012-03-16 17:22:30 -07:00
Mark Cavage d5cf19bd9e Finish up #65 (lint and missing check) 2012-03-14 09:06:03 -07:00
Austin King 9c5ed685c5 First stab at RFC 2254 filter escaping 2012-03-13 16:40:39 -07:00
Mark Cavage 7fc249565e fix make check after merge 2012-02-24 08:39:21 -08:00
Yunong Xiao 5135da4b6a fixed style. 2012-02-23 16:02:52 -08:00
Yunong Xiao 116bedb487 Add persistent search cache, minor bug fix to client 2012-02-23 15:21:17 -08:00
Yunong Xiao 763f4630f7 Merge remote-tracking branch 'upstream/master'
Conflicts:
	lib/index.js
2012-02-22 14:34:17 -08:00
Yunong Xiao 035d2c4cfc add persistent search lib, fix url to parse filter as an ldap object 2012-02-20 17:21:53 -08:00
Mark Cavage 9819353042 Client refactoring. Cut reconnect logic and force users to listen for connect event. 2012-02-18 14:58:40 -08:00
Mark Cavage 7ff50f43f4 Initial switch to bunyan 2012-02-18 08:54:22 +00:00
Mark Cavage afeb354eac Initial setup for 0.5 (use eng.git layout) 2012-02-18 08:15:52 +00:00
Mark Cavage b47b208e5d GH-55 Client emits connect event multiple times 2012-01-30 08:45:01 -08:00
Mark Cavage a499a7cfd5 Addition of javascriptlint 2012-01-24 09:43:46 -08:00
Mark Cavage 0e30dc50c4 GH-53 unable to parse !filters 2012-01-24 08:56:30 -08:00
Mark Cavage f7276475b9 GH-51 Timeout support in client library 2012-01-19 18:02:10 -08:00
Mark Cavage 44a9d87863 GH-49 Allow options.attributes = "dn" in client.search 2012-01-19 15:39:16 -08:00
Mark Cavage 11b3a6655d Support escaping * in filter values 2012-01-19 15:12:19 -08:00
Mark Cavage 512541bfbd GH-50 Allow = in filter strings 2012-01-19 14:19:06 -08:00
Mark Cavage fb63ba2220 lint cleanup, and extensible matching 2012-01-19 14:00:23 -08:00
Craig Baker 60870497ef Removed commented out code and some left over console.log's. 2012-01-19 14:00:23 -08:00
Craig Baker d09a2ee711 changed out a stack based filter parser for a operator/operand k-ary tree based parser. 2012-01-19 14:00:23 -08:00
Mark Cavage 040dfa51fa GH-47 Server crash in c.on('data') 2012-01-09 08:24:14 -08:00
Mark Cavage f8c46a4c20 GH-13 server.use() 2012-01-06 15:10:46 -08:00
Mark Cavage 16a1018a3b getControl not handling null values correctly 2012-01-06 08:51:54 -08:00
Mark Cavage 13978d5303 Trivial server side extensible search filter support 2011-12-27 12:12:40 -08:00
Yunong Xiao f4729032dd add persistent search to cli 2011-12-20 15:04:59 -08:00
Yunong Xiao e6a007e032 minor fixes to revert new lines. 2011-12-19 17:09:38 -08:00
Yunong Xiao cbf809c856 add support for entry change notification control 2011-12-19 16:52:48 -08:00
Mark Cavage ab94de8126 Fix control.json and exports 2011-12-09 13:59:17 -08:00
Mark Cavage ebde1df00c Minor refactoring of PersistentSearchControl commit 2011-12-08 14:54:40 -08:00
Yunong Xiao bad8841382 "removed log4js dep in persistent_search_control.js" 2011-12-08 11:26:09 -08:00
Yunong Xiao 2240f29cc3 "refactored controls into its own directory, minor bug fixes" 2011-12-08 11:22:35 -08:00
Yunong Xiao ee88fc7019 "added ability to deserialize ldap persistent search controls" 2011-12-07 17:02:17 -08:00
Mathieu Lecarme eadf70e994 Filter: filter against one or multiple values. 2011-12-07 21:24:24 +01:00
Mark Cavage 7b5bef86d5 Control parsing incorrect if criticality field ommitted 2011-12-07 21:24:23 +01:00
Mathieu Lecarme 52f350dec2 Filter: stop when on first match in an array. 2011-12-04 23:32:35 +01:00
Mathieu Lecarme b0044f9bf0 ApproximateFilter can match multiple values. 2011-12-04 23:23:39 +01:00
Mathieu Lecarme 4343f72fab gjslint suggestions. 2011-12-04 22:48:22 +01:00
Mathieu Lecarme ef043af1d4 SubstringFilter can match against an array. 2011-12-04 22:32:22 +01:00
Mark Cavage eac2f95517 Client logging undefined 2011-11-28 10:39:07 -08:00
Mark Cavage dc8d04e8e0 Don't require log4js in bin/* 2011-11-22 13:36:08 -08:00
Mark Cavage e9c1de31f9 Don't actually delete the attributes in res.send() 2011-11-22 13:29:19 -08:00
Mark Cavage 57831b56d1 DTrace rework so probes always fire 2011-11-18 16:39:37 -08:00
Mark Cavage 5092293f84 comment wrong for dtrace probe 2011-11-17 11:56:19 -08:00