Commit Graph

108 Commits

Author SHA1 Message Date
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 495ea2afce Overhaul DN parsing and formatting
Certain applications depend upon DN string formatting in a manner more
strict than specified in the RFC.  To enable format transcription and
reproduction, some changes were made to how DNs are converted to/from
strings.

- Store RDN strings raw instead of escaped
- Record formatting details during DN/RDN parsing
- Add DN.format method to control format recreation
- Remove DN.spaced method in favor of DN.setFormat

Fix mcavage/node-ldapjs#176
2015-02-17 15:35:06 -06:00
Patrick Mooney 22b04f3a94 Move filter parsing into separate module 2014-10-16 17:00:14 -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 b70bdaa26b Cleanup lint/cruft 2014-07-29 10:21:57 -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 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 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 888d34ab7c Simplify and fix Change.apply tests for replace 2014-07-16 15:03:15 -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 7dabc16e47 Disable client abandon test
Abandon handling is not within spec in the ldapjs server and not
particularly robust in the client.  This test should be re-enabled when
both issues are fixed.
2014-07-08 15:29:05 -05:00
Patrick Mooney 3186f5eca1 Convert tests to use tape/istanbul/faucet 2014-07-08 15:09:26 -05:00
Patrick Mooney 8f29f3b68d Merge ServerSideSort controls
Fix mcavage/node-ldapjs#187
2014-06-30 11:56:50 -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 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 3b101a7b2f Cease reconnection when client.destroy is called 2014-06-24 05:45:06 -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 6c8dbf9a29 Use plans instead of timeouts for server tests 2014-06-16 09:40:07 -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 0427732c10 Add basic server API tests 2014-06-05 16:37:24 -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
= c1af9a8814 Server side sorting control tests 2014-05-26 21:12:14 +00: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
Mark Cavage aa633dfd20 support extensible matching of caseIgnore and caseIgnoreSubstrings 2013-10-28 21:12:12 +00: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
Mark Cavage 3fc422ac2b filter parsing not catching (() 2013-02-07 18:16: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 24e02f8d88 throw on all bad filters 2013-01-30 23:50:19 +00:00
Sascha Tandel 20368c58c1 #109: escape filter attribute/values only in toString() 2013-01-11 11:01:51 +01:00
Mark Cavage 51e6abf477 throw on invalid filter syntax 2012-10-11 20:04:10 +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 59ea20ffa2 Client refactor, with pooled client (minor lint cleanup as well) 2012-04-26 20:23:43 -07:00
Mark Cavage 7e49d7720e cleanup client test 2012-04-17 15:14:06 -07:00
Nathan Rogers 91051377da added tests and better handle zero-length cookies 2012-03-26 14:30:23 -05:00
Mark Cavage 344cac0287 filter parsing turning presence filter into substring filter 2012-03-16 17:22:30 -07:00
Austin King 9c5ed685c5 First stab at RFC 2254 filter escaping 2012-03-13 16:40:39 -07:00
Yunong Xiao 763f4630f7 Merge remote-tracking branch 'upstream/master'
Conflicts:
	lib/index.js
2012-02-22 14:34:17 -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 15c6e32801 add logger to del_request test 2012-02-18 11:47:58 -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