Skip to content

Timeout is too short #1

@rnhurt

Description

@rnhurt

In my environment the SMB client takes quite a while to connect and the default init_timeout was way too short. The attached patch allows the user to pass in a optional init_timeout setting so they can tune it for their environment. Our SMB passwords are also full of garbage characters so I also included single quotes for the password option. Hopefully this patch is small enough to include without me having to fork the code, however if you would rather I can do that too.

Thanx!
Richard

diff -crB lib.ORIG/sambala.rb lib/sambala.rb
*** lib.ORIG/sambala.rb 2010-03-23 10:26:28.000000000 -0400
--- lib/sambala.rb  2010-03-23 10:25:41.000000000 -0400
***************
*** 71,77 ****
      $log_sambala = GlobaLog.logger(STDERR,:warn)
        @recurse = false
        begin
!       options[:init_timeout] = 1
        @options = options; gardener_ok
      rescue
        @gardener.close unless @gardener.nil? || @gardener.class != 'Gardener'
--- 71,77 ----
      $log_sambala = GlobaLog.logger(STDERR,:warn)
        @recurse = false
        begin
!       options[:init_timeout] = 1 unless options[:init_timeout]
        @options = options; gardener_ok
      rescue
        @gardener.close unless @gardener.nil? || @gardener.class != 'Gardener'
diff -crB lib.ORIG/sambala_gardener.rb lib/sambala_gardener.rb
*** lib.ORIG/sambala_gardener.rb    2010-03-23 10:26:28.000000000 -0400
--- lib/sambala_gardener.rb 2010-03-23 10:25:41.000000000 -0400
***************
*** 94,100 ****
      def init_gardener
        @gardener = Abundance.gardener(:rows => 1, :init_timeout => @options[:init_timeout]) do
                
!               PTY.spawn("smbclient //#{@options[:host]}/#{@options[:share]} #{@options[:password]} -W #{@options[:domain]} -U #{@options[:user]}") do |r,w,pid|
            w.sync = true
            $expect_verbose = false
            catch :init do
--- 94,100 ----
      def init_gardener
        @gardener = Abundance.gardener(:rows => 1, :init_timeout => @options[:init_timeout]) do
                
!               PTY.spawn("smbclient //#{@options[:host]}/#{@options[:share]} '#{@options[:password]}' -W #{@options[:domain]} -U #{@options[:user]}") do |r,w,pid|
            w.sync = true
            $expect_verbose = false
            catch :init do

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions