This repository was archived by the owner on May 14, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
Expand file tree Collapse file tree 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) {
854854 }
855855
856856 // Otherwise, match via DN rules
857- assert . ok ( req . dn )
858857 const keys = this . _sortedRouteKeys ( )
859858 let fallbackHandler = [ noSuffixHandler ]
860859 // invalid DNs in non-strict mode are routed to the default handler
861860 const testDN = ( typeof ( req . dn ) === 'string' ) ? DN . fromString ( req . dn ) : req . dn
861+ assert . ok ( testDN )
862862
863863 for ( let i = 0 ; i < keys . length ; i ++ ) {
864864 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) {
257257 } )
258258} )
259259
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+
260281tap . test ( 'bind/unbind identity user' , function ( t ) {
261282 const server = ldap . createServer ( {
262283 connectionRouter : function ( c ) {
You can’t perform that action at this time.
0 commit comments