Sha256: 0c61dd2fc018bcb2326ba6f27e8eb7691f63eb0a49c15e31d56a5747c7c91f62

Contents?: true

Size: 1.37 KB

Versions: 4

Compression:

Stored size: 1.37 KB

Contents

require 'spec_helper'

describe Net::NTLM::Message::Type1 do
  fields = [
      { :name => :sign, :class => Net::NTLM::String, :value => Net::NTLM::SSP_SIGN, :active => true },
      { :name => :type, :class => Net::NTLM::Int32LE, :value => 1, :active => true },
      { :name => :flag, :class => Net::NTLM::Int32LE, :value =>  Net::NTLM::DEFAULT_FLAGS[:TYPE1], :active => true },
      { :name => :domain, :class => Net::NTLM::SecurityBuffer, :value => '', :active => true },
      { :name => :workstation, :class => Net::NTLM::SecurityBuffer, :value =>  Socket.gethostname, :active => true },
      { :name => :padding, :class => Net::NTLM::String, :value => '', :active => false },
  ]
  flags = [
      :UNICODE,
      :OEM,
      :REQUEST_TARGET,
      :NTLM,
      :ALWAYS_SIGN,
      :NTLM2_KEY
  ]
  it_behaves_like 'a fieldset', fields
  it_behaves_like 'a message', flags

  let(:type1_packet) {"TlRMTVNTUAABAAAAB4IIAAAAAAAgAAAAAAAAACAAAAA="}

  it 'should deserialize' do
    t1 =  Net::NTLM::Message.decode64(type1_packet)
    t1.class.should == Net::NTLM::Message::Type1
    t1.domain.should == ''
    t1.flag.should == 557575
    t1.padding.should == ''
    t1.sign.should  == "NTLMSSP\0"
    t1.type.should == 1
    t1.workstation.should == ''
  end

  it 'should serialize' do
    t1 = Net::NTLM::Message::Type1.new
    t1.workstation = ''
    t1.encode64.should == type1_packet
  end

end

Version data entries

4 entries across 4 versions & 3 rubygems

Version Path
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/rubyntlm-0.4.0/spec/lib/net/ntlm/message/type1_spec.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/rubyntlm-0.4.0/spec/lib/net/ntlm/message/type1_spec.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/rubyntlm-0.4.0/spec/lib/net/ntlm/message/type1_spec.rb
rubyntlm-0.4.0 spec/lib/net/ntlm/message/type1_spec.rb