Sha256: 665dcea7dc0f1362643c0f14e7e56aab7dfa6de7bbe14bf4a6adeee9a9cf25ef

Contents?: true

Size: 1.5 KB

Versions: 14

Compression:

Stored size: 1.5 KB

Contents

module RubySMB
  module SMB2
    module Packet
      # An SMB2 SessionSetupResponse Packet as defined in
      # [2.2.6 SMB2 SESSION_SETUP Response](https://msdn.microsoft.com/en-us/library/cc246564.aspx)
      class SessionSetupResponse < RubySMB::GenericPacket
        COMMAND = RubySMB::SMB2::Commands::SESSION_SETUP

        endian :little
        smb2_header         :smb2_header
        uint16              :structure_size, label: 'Structure Size', initial_value: 9
        session_flags       :session_flags
        uint16              :security_buffer_offset,  label: 'Security Buffer Offset', initial_value: 0x48
        uint16              :security_buffer_length,  label: 'Security Buffer Length'
        string              :buffer,                  label: 'Security Buffer', length: -> { security_buffer_length }

        def initialize_instance
          super
          smb2_header.flags.reply = 1
        end

        # Takes a serialized NTLM Type 2 message and wraps it in the GSS ASN1 encoding
        # and inserts it into the {RubySMB::SMB2::Packet::SessionSetupRequest#buffer}
        # as well as updating the {RubySMB::SMB2::Packet::SessionSetupRequest#security_buffer_length}
        #
        # @param type1_message [String] the serialized NTLM Type 1 message
        # @return [void]
        def set_type2_blob(type1_message)
          gss_blob = RubySMB::Gss.gss_type2(type1_message)
          self.security_buffer_length = gss_blob.length
          self.buffer = gss_blob
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
ruby_smb-2.0.10 lib/ruby_smb/smb2/packet/session_setup_response.rb
ruby_smb-2.0.9 lib/ruby_smb/smb2/packet/session_setup_response.rb
ruby_smb-2.0.8 lib/ruby_smb/smb2/packet/session_setup_response.rb
ruby_smb-2.0.7 lib/ruby_smb/smb2/packet/session_setup_response.rb
ruby_smb-2.0.6 lib/ruby_smb/smb2/packet/session_setup_response.rb
ruby_smb-2.0.5 lib/ruby_smb/smb2/packet/session_setup_response.rb
ruby_smb-2.0.4 lib/ruby_smb/smb2/packet/session_setup_response.rb
ruby_smb-2.0.3 lib/ruby_smb/smb2/packet/session_setup_response.rb
ruby_smb-2.0.2 lib/ruby_smb/smb2/packet/session_setup_response.rb
ruby_smb-2.0.1 lib/ruby_smb/smb2/packet/session_setup_response.rb
ruby_smb-2.0.0 lib/ruby_smb/smb2/packet/session_setup_response.rb
ruby_smb-1.1.0 lib/ruby_smb/smb2/packet/session_setup_response.rb
ruby_smb-1.0.5 lib/ruby_smb/smb2/packet/session_setup_response.rb
ruby_smb-1.0.4 lib/ruby_smb/smb2/packet/session_setup_response.rb