類別 Win32::SSPI::SecurityBuffer
建立 SecBufferDesc 結構的二進制表示,包括內含的 SecBuffer。
常數
- SECBUFFER_TOKEN
- SECBUFFER_VERSION
- TOKENBUFSIZE
公開類別方法
new(buffer = nil) 按一下以切換來源
# File ext/win32/lib/win32/sspi.rb, line 92 def initialize(buffer = nil) @buffer = buffer || "\0" * TOKENBUFSIZE @bufferSize = @buffer.length @type = SECBUFFER_TOKEN end
公開實例方法
bufferSize() 按一下以切換來源
# File ext/win32/lib/win32/sspi.rb, line 98 def bufferSize unpack @bufferSize end
bufferType() 按一下以切換來源
# File ext/win32/lib/win32/sspi.rb, line 103 def bufferType unpack @type end
to_p() 按一下以切換來源
# File ext/win32/lib/win32/sspi.rb, line 113 def to_p # Assumption is that when to_p is called we are going to get a packed structure. Therefore, # set @unpacked back to nil so we know to unpack when accessors are next accessed. @unpacked = nil # Assignment of inner structure to variable is very important here. Without it, # will not be able to unpack changes to the structure. Alternative, nested unpacks, # does not work (i.e. @struct.unpack("LLP12")[2].unpack("LLP12") results in "no associated pointer") @sec_buffer ||= [@bufferSize, @type, @buffer].pack("LLP") @struct ||= [SECBUFFER_VERSION, 1, @sec_buffer].pack("LLP") end
token() 按一下以切換來源
# File ext/win32/lib/win32/sspi.rb, line 108 def token unpack @buffer end
私有實例方法
unpack() 按一下以切換來源
將 SecurityBufferDesc 結構解壓縮到成員變數中。我們只希望對每個結構執行一次此操作,因此結構會在解壓縮後刪除。
# File ext/win32/lib/win32/sspi.rb, line 129 def unpack if ! @unpacked && @sec_buffer && @struct @bufferSize, @type = @sec_buffer.unpack("LL") @buffer = @sec_buffer.unpack("LLP#{@bufferSize}")[2] @struct = nil @sec_buffer = nil @unpacked = true end end