@@ -441,6 +441,10 @@ def self.result2string(code) #:nodoc:
441
441
# described below. The following arguments are supported:
442
442
# * :host => the LDAP server's IP-address (default 127.0.0.1)
443
443
# * :port => the LDAP server's TCP port (default 389)
444
+ # * :connect_cb => a Proc that will be called when a new connection is
445
+ # needed. This should return an actual Ruby IO object. Useful for
446
+ # manually handling connecting, like if you want to go through a proxy
447
+ # server. It will receive :host: and :port: as arguments.
444
448
# * :auth => a Hash containing authorization parameters. Currently
445
449
# supported values include: {:method => :anonymous} and {:method =>
446
450
# :simple, :username => your_user_name, :password => your_password }
@@ -469,6 +473,7 @@ def self.result2string(code) #:nodoc:
469
473
def initialize ( args = { } )
470
474
@host = args [ :host ] || DefaultHost
471
475
@port = args [ :port ] || DefaultPort
476
+ @connect_cb = args [ :connect_cb ]
472
477
@verbose = false # Make this configurable with a switch on the class.
473
478
@auth = args [ :auth ] || DefaultAuth
474
479
@base = args [ :base ] || DefaultTreebase
@@ -1215,7 +1220,9 @@ def use_connection(auth)
1215
1220
end
1216
1221
1217
1222
def new_connection
1223
+ socket = @connect_cb . call ( @host , @port ) if @connect_cb
1218
1224
Net ::LDAP ::Connection . new \
1225
+ :socket => socket ,
1219
1226
:host => @host ,
1220
1227
:port => @port ,
1221
1228
:encryption => @encryption ,
0 commit comments