lib/net/ntlm/message.rb in rubyntlm-0.6.3 vs lib/net/ntlm/message.rb in rubyntlm-0.6.4

- old
+ new

@@ -33,11 +33,10 @@ :TYPE1 => FLAGS[:UNICODE] | FLAGS[:OEM] | FLAGS[:REQUEST_TARGET] | FLAGS[:NTLM] | FLAGS[:ALWAYS_SIGN] | FLAGS[:NTLM2_KEY], :TYPE2 => FLAGS[:UNICODE], :TYPE3 => FLAGS[:UNICODE] | FLAGS[:REQUEST_TARGET] | FLAGS[:NTLM] | FLAGS[:ALWAYS_SIGN] | FLAGS[:NTLM2_KEY] } - # @private false class Message < FieldSet class << Message def parse(str) m = Type0.new @@ -85,11 +84,11 @@ FLAG_KEYS.each{ |k| print(k, "=", has_flag?(k), "\n") } end def serialize deflag - super + security_buffers.map{|n, f| f.value}.join + super + security_buffers.map{|n, f| f.value + (has_flag?(:UNICODE) ? "\x00".b * (f.value.length % 2) : '')}.join end def encode64 Base64.encode64(serialize).gsub(/\n/, '') end @@ -115,9 +114,10 @@ def deflag security_buffers.inject(head_size){|cur, a| a[1].offset = cur cur += a[1].data_size + has_flag?(:UNICODE) ? cur + cur % 2 : cur } end def data_edge security_buffers.map{ |n, f| f.active ? f.offset : size}.min