This repository was archived by the owner on May 14, 2024. It is now read-only.
File tree 2 files changed +22
-1
lines changed
2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -854,11 +854,11 @@ Server.prototype._getHandlerChain = function _getHandlerChain (req) {
854
854
}
855
855
856
856
// Otherwise, match via DN rules
857
- assert . ok ( req . dn )
858
857
const keys = this . _sortedRouteKeys ( )
859
858
let fallbackHandler = [ noSuffixHandler ]
860
859
// invalid DNs in non-strict mode are routed to the default handler
861
860
const testDN = ( typeof ( req . dn ) === 'string' ) ? DN . fromString ( req . dn ) : req . dn
861
+ assert . ok ( testDN )
862
862
863
863
for ( let i = 0 ; i < keys . length ; i ++ ) {
864
864
const suffix = keys [ i ]
Original file line number Diff line number Diff line change @@ -257,6 +257,27 @@ tap.test('bind/unbind identity anonymous', function (t) {
257
257
} )
258
258
} )
259
259
260
+ tap . test ( 'does not crash on empty DN values' , function ( t ) {
261
+ const server = ldap . createServer ( {
262
+ connectionRouter : function ( c ) {
263
+ server . newConnection ( c )
264
+ server . emit ( 'testconnection' , c )
265
+ }
266
+ } )
267
+
268
+ server . listen ( t . context . sock , function ( ) {
269
+ const client = ldap . createClient ( { socketPath : t . context . sock } )
270
+ server . once ( 'testconnection' , ( ) => {
271
+ client . bind ( '' , 'pw' , function ( err ) {
272
+ t . ok ( err , 'blank bind dn throws error' )
273
+ client . unbind ( function ( ) {
274
+ server . close ( ( ) => t . end ( ) )
275
+ } )
276
+ } )
277
+ } )
278
+ } )
279
+ } )
280
+
260
281
tap . test ( 'bind/unbind identity user' , function ( t ) {
261
282
const server = ldap . createServer ( {
262
283
connectionRouter : function ( c ) {
You can’t perform that action at this time.
0 commit comments