httpclient icon indicating copy to clipboard operation
httpclient copied to clipboard

wrong number of arguments error when authenticating via ntlm.

Open OnesAndTwos opened this issue 12 years ago • 3 comments

wrong number of arguments (1 for 0)
C:/Ruby193/lib/ruby/1.9.1/win32/sspi.rb:248:in `get_initial_token'
C:/src/gems/ruby/1.9.1/gems/httpclient-2.3.3/lib/httpclient/auth.rb:621:in `get'
C:/src/gems/ruby/1.9.1/gems/httpclient-2.3.3/lib/httpclient/auth.rb:114:in `block in filter_request'
C:/src/gems/ruby/1.9.1/gems/httpclient-2.3.3/lib/httpclient/auth.rb:112:in `each'
C:/src/gems/ruby/1.9.1/gems/httpclient-2.3.3/lib/httpclient/auth.rb:112:in `filter_request'
C:/src/gems/ruby/1.9.1/gems/httpclient-2.3.3/lib/httpclient.rb:1073:in `block in do_get_block'
C:/src/gems/ruby/1.9.1/gems/httpclient-2.3.3/lib/httpclient.rb:1072:in `each'
C:/src/gems/ruby/1.9.1/gems/httpclient-2.3.3/lib/httpclient.rb:1072:in `do_get_block'
C:/src/gems/ruby/1.9.1/gems/httpclient-2.3.3/lib/httpclient.rb:887:in `block in do_request'
C:/src/gems/ruby/1.9.1/gems/httpclient-2.3.3/lib/httpclient.rb:981:in `protect_keep_alive_disconnected'
C:/src/gems/ruby/1.9.1/gems/httpclient-2.3.3/lib/httpclient.rb:886:in `do_request'
C:/src/gems/ruby/1.9.1/gems/httpclient-2.3.3/lib/httpclient.rb:774:in `request'
C:/src/gems/ruby/1.9.1/gems/httpclient-2.3.3/lib/httpclient.rb:689:in `put'

Works if remove @scheme from get_initial_token like so :

if SSPIEnabled
  authenticator = param[:authenticator] = Win32::SSPI::NegotiateAuth.new
  return authenticator.get_initial_token()
else # use GSSAPI
  authenticator = param[:authenticator] = GSSAPI::Simple.new(domain_uri.host, 'HTTP')
  # Base64 encode the context token
  return [authenticator.init_context].pack('m').gsub(/\n/,'')
end

Ruby env:

RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.17
  - RUBY VERSION: 1.9.3 (2012-02-16 patchlevel 125) [i386-mingw32]
  - INSTALLATION DIRECTORY: C:/Ruby193/lib/ruby/gems/1.9.1
  - RUBY EXECUTABLE: C:/Ruby193/bin/ruby.exe
  - EXECUTABLE DIRECTORY: C:/Ruby193/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-mingw32
  - GEM PATHS:
     - C:/Ruby193/lib/ruby/gems/1.9.1
     - C:/Users/mkay/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - :sources => ["http://rubygems.org/"]
  - REMOTE SOURCES:
     - http://rubygems.org/

OnesAndTwos avatar Apr 03 '13 11:04 OnesAndTwos

Same error with

ruby --version ruby 2.0.0p0 (2013-02-24) [i386-mingw32] on Windows 7.

I removed @scheme from get_initial_token() like above but then I got more errors and gave up.

RuntimeError: can't modify frozen String
    from C:/Ruby200/lib/ruby/2.0.0/win32/sspi.rb:152:in `pack'
    from C:/Ruby200/lib/ruby/2.0.0/win32/sspi.rb:152:in `to_p'
    from C:/Ruby200/lib/ruby/2.0.0/win32/sspi.rb:322:in `get_credentials'
    from C:/Ruby200/lib/ruby/2.0.0/win32/sspi.rb:253:in `get_initial_token'
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/httpclient-2.3.4.1/lib/httpclient/auth.rb:621:in `get'

jonelf avatar Oct 17 '13 12:10 jonelf

Is the error still happens? If true, can anyone provide IIS + NegotiateAuth for me? I want to fix it...

nahi avatar Dec 28 '14 13:12 nahi

@nahi Unfortunately I'm not in the Microsoft sphere right now so I haven't been able to test if the problem still exists.

jonelf avatar Jan 16 '15 12:01 jonelf