Skip to content

Commit

Permalink
Merge pull request #1 from kachick/improve-remove_warnings
Browse files Browse the repository at this point in the history
Remove some warnings
  • Loading branch information
macks committed Jan 25, 2013
2 parents b0dc7ab + 136a285 commit 8ba3653
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions Rakefile
Expand Up @@ -18,6 +18,7 @@ Rake::TestTask.new(:test) do |task|
task.libs << 'lib:test'
task.pattern = 'test/**/*_test.rb'
task.verbose = true
task.warning = true
end

begin
Expand Down
20 changes: 13 additions & 7 deletions lib/ntlm/message.rb
Expand Up @@ -79,9 +79,15 @@ def self.parse(*args)
end

def initialize(args = {})
@buffer = ''
@offset = 0
@flag = args[:flag] || self.class::DEFAULT_FLAGS
@buffer = ''
@offset = 0
@flag = args[:flag] || self.class::DEFAULT_FLAGS
@domain = nil
@workstation = nil
@version = nil
@target_info = nil
@session_key = nil
@mic = nil

self.class::ATTRIBUTES.each do |key|
instance_variable_set("@#{key}", args[key]) if args[key]
Expand Down Expand Up @@ -147,7 +153,7 @@ def append_payload(string, allocation_size = nil)
end

def fetch_payload(fields)
size, allocated_size, offset = fields.unpack('vvV')
size, _, offset = fields.unpack('vvV')
return nil if size.zero?
@buffer[offset, size]
end
Expand Down Expand Up @@ -204,7 +210,7 @@ class Negotiate < Message
ATTRIBUTES = [:domain, :workstation, :version]
DEFAULT_FLAGS = [NEGOTIATE_UNICODE, NEGOTIATE_OEM, REQUEST_TARGET, NEGOTIATE_NTLM, NEGOTIATE_ALWAYS_SIGN, NEGOTIATE_EXTENDED_SECURITY].inject(:|)

attr_accessor *ATTRIBUTES
attr_accessor(*ATTRIBUTES)

def parse(string)
super
Expand Down Expand Up @@ -247,7 +253,7 @@ class Challenge < Message
ATTRIBUTES = [:target_name, :challenge, :target_info, :version]
DEFAULT_FLAGS = 0

attr_accessor *ATTRIBUTES
attr_accessor(*ATTRIBUTES)

def parse(string)
super
Expand Down Expand Up @@ -300,7 +306,7 @@ class Authenticate < Message
ATTRIBUTES = [:lm_response, :nt_response, :domain, :user, :workstation, :session_key, :version, :mic]
DEFAULT_FLAGS = [NEGOTIATE_UNICODE, REQUEST_TARGET, NEGOTIATE_NTLM, NEGOTIATE_ALWAYS_SIGN, NEGOTIATE_EXTENDED_SECURITY].inject(:|)

attr_accessor *ATTRIBUTES
attr_accessor(*ATTRIBUTES)

def parse(string)
super
Expand Down

0 comments on commit 8ba3653

Please sign in to comment.