Commit Graph

89 Commits

Author SHA1 Message Date
Telepsis 95b4ebd618
Remove use of logging methods in conditional tests 2020-11-12 12:38:56 -05:00
Tony Brix c6fa25985b update devdependency standard to v16 2020-10-31 16:07:32 -05:00
Tony Brix 07555253ac chore(lint): fix linting errors 2020-10-24 16:22:11 +00:00
Martin Cizek cf29972990 fix 2020-09-18 15:36:12 +02:00
Martin Cizek c861135f80 Don't randomize first server 2020-09-18 15:32:22 +02:00
Martin Cizek f3804bbca6 cr 2020-09-18 06:15:25 +02:00
Martin Cizek d32a765ee9 cr 2020-09-17 17:49:58 +02:00
Martin Cizek f0c864ca85 Revert redundant changes 2020-09-17 16:58:16 +02:00
Martin Cizek 23e44b2959 cr 2020-09-17 16:46:34 +02:00
Martin Cizek f9ae5c12d8 Add test 2020-09-17 07:05:21 +02:00
Martin Cizek 3ca2c265da Support for arrays in url parameter 2020-09-17 06:28:03 +02:00
Martin Cizek 7d52f867a0 Client support multiple servers 2020-09-16 14:06:26 +02:00
Robert Kawecki 5204bb7ac0 Implement queueing events until a listener appears
This resolves an issue arising from using both a callback and an EventEmitter
together in the Client.search() API. Since the emitter would only be available
through the callback, some events could be emitted before the callback
is triggered, resulting in missed events.

This change incorporates a test case originally by László Szűcs (@ifroz).

For GH-602
2020-05-12 16:51:28 +02:00
James Sumners 2901e48cb4
Merge branch 'next' into fix-bind-crash 2019-12-15 08:25:23 -05:00
Mathias Lundell d7d2e99275 refactor: resultError always emitted on error 2019-12-03 17:14:05 +01:00
Thomas P 9a3c7bab61
Merge branch 'next' into fix-bind-crash 2019-11-24 16:33:37 +01:00
James Sumners 1f12eca334
Add integration tests (#571)
* Initial integration test, um, test

* Hack in service

* Add integration test for issue #480

* Add fix for issue #418

* Add fix for issue #370
2019-11-16 10:48:00 -05:00
Thomas P c27e14960e
Avoid handling all errors now that blocking errors are handled properly 2019-10-12 00:35:19 +02:00
Thomas P eda98986f2
FIX: Refused connections are now handled gracefully 2019-10-12 00:34:27 +02:00
Thomas P d702c455bd
Refactor the patch to limit its scope to bind actions
This way, other tests keep passing
2019-10-11 23:23:46 +02:00
Thomas P bc61f67b12
Lint fixes 2019-10-11 22:54:53 +02:00
Thomas P ce243d5318
Update the patch to use the logger interface 2019-10-11 22:42:44 +02:00
Matthew Nakama 79f3625f61
handle Client.emit('error') events
This prevents node crashes from Client.bind() and etc.
We set a callback handler in the instance during bind()
and send errors to it.
2019-10-11 22:41:17 +02:00
James Sumners 5a31abaed0
Clean up options checking and add some tests 2019-09-29 09:09:18 -04:00
James Sumners 92341e770a
Refactor MessageTracker into testable module 2019-08-30 10:50:02 -04:00
James Sumners 2e1ef78108
Refactor client RequestQueue into testable module (#548)
* Refactor client RequestQueue into testable module

* Update test/lib/client/request-queue/enqueue.test.js

Co-Authored-By: Tony Brix <tony@brix.ninja>

* Update test/lib/client/request-queue/enqueue.test.js

Co-Authored-By: Tony Brix <tony@brix.ninja>

* Update test/lib/client/request-queue/enqueue.test.js

Co-Authored-By: Tony Brix <tony@brix.ninja>
2019-08-28 19:15:09 -04:00
James Sumners e2c9b12430
Apply standard linting to the code base (#539)
* Apply standard linting to the code base

* Specify files to lint

* Run lint as first stage

* Update travis config
2019-08-27 17:11:49 -04:00
James Sumners 6b514b97df
Refactor tests to be independent of each other 2019-08-27 14:17:33 -04:00
acappella2017 a8b09f3f81 Support Node.js 10 (#497)
* Support node 10

* remove arrow function
2019-08-27 08:10:45 -04:00
Phil Batey 5f21dbf4cd destroy socket if auto-bind fails 2019-08-25 16:58:23 -06:00
James Sumners 2e2a0783bf
Create new instances of the null logger to remove potential side effects 2019-08-24 21:04:23 -04:00
James Sumners e9e8033fda
Remove dependency on Bunyan 2019-08-24 20:51:40 -04:00
Vincent van der Weele bb2d018b2c Emit error object in case of ConnectionError 2016-03-16 17:01:26 +02:00
Patrick Mooney bdbff63bc0 Expose Client as top-level export 2015-10-27 21:53:15 -05:00
Patrick Mooney c10a1a6faf Clean up client handling of end/error for searches 2015-10-15 21:49:34 -05:00
Patrick Mooney 3ca7e6d98f Allow startTLS during client setup 2015-05-24 19:56:16 -05:00
Patrick Mooney 821569c2c4 Implement client-side StartTLS support 2015-05-13 22:26:42 -05:00
Patrick Mooney ec062d370c Improve empty DN handling
- Use more strict comparisons for client input asserts
- Fix baseObject comparison in SearchRequest initialization
- Alter default error for server route fallthrough
2015-04-25 20:53:50 -05:00
Matt Simerson 19f2c16783 Allow simple client bind with empty credentials
Fix mcavage/node-ldapjs#254
2015-04-13 23:40:58 -05:00
Patrick Mooney 408e7c9f99 Support invalid DNs in client/server
Some LDAP implementations (mainly AD and Outlook) accept and/or output
DNs that are not valid.  To support interaction with these invalid DNs a
strictDN flag (default: true) has been added to the client and server
constructors.  Setting this flag to false will allow use of
non-conforming DNs.

When disabling strictDN in the ldapjs client, strings which wouldn't
parse into a DN can then be passed to the ldap operation methods.  It
also means that some methods (such as search) may return results with
string-formatted DNs instead of DN objects.

When disabling strictDN in the ldapjs server, incoming requests that
contain invalid DNs will be routed to the default ('') handler for that
operation type.  It is your responsiblity to differentiate between
string-type and object-type DNs in those handlers.

Fix mcavage/node-ldapjs#222
Fix mcavage/node-ldapjs#146
Fix mcavage/node-ldapjs#113
Fix mcavage/node-ldapjs#104
2014-09-30 18:39:19 -05:00
Patrick Mooney 92362e01f3 Improve parser error handling
- Wrap parser errors with VError
- Catch initial potential sequence errors
- Improve parser test coverage
- Emit parser errors instead of implicitly logging

Fix mcavage/node-ldapjs#221
2014-09-16 15:23:21 -05:00
Patrick Mooney 9ec6184ef5 Fix socket error handling during client unbind
The client now blackholes any socket errors after sending an unbind.
This prevents servers which issue RST from causing unecessary errors for
what was a succesful operation.

Fix mcavage/node-ldapjs#217
2014-08-21 02:01:30 -05:00
Patrick Mooney de16802a16 Fix SearchPager bugs, improve test coverage 2014-07-25 14:16:31 -05:00
Patrick Mooney 8fd16ee255 Add resultError event to client
Detecting certain types of errors in encountered during any operation
(such as BusyError or UnavailableError) can be useful for making
client-wide decisions.
2014-07-25 13:35:15 -05:00
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 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