Skip to content

Commit 4898d81

Browse files
author
Tom Maher
committed
URI may contain a base DN
1 parent b72c4a8 commit 4898d81

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/net/ldap.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,11 @@ def initialize(args = {})
551551
@hosts = args[:hosts]
552552
@verbose = false # Make this configurable with a switch on the class.
553553
@auth = args[:auth] || DefaultAuth
554-
@base = args[:base] || DefaultTreebase
554+
@base = args[:base] || if @uri.path && @uri.path.length > 1
555+
URI.decode(@uri.path[1..-1])
556+
else
557+
DefaultTreebase
558+
end
555559
@force_no_page = args[:force_no_page] || DefaultForceNoPage
556560
@encryption = normalize_encryption(args[:encryption]) # may be nil
557561
if @uri.scheme == 'ldaps'

0 commit comments

Comments
 (0)