Class: Win32::SSPI::SecurityBuffer
- Inherits:
-
Object
- Object
- Win32::SSPI::SecurityBuffer
- Defined in:
- lib/win32/sspi.rb
Overview
Creates binary representations of a SecBufferDesc structure, including the SecBuffer contained inside.
Constant Summary collapse
- SECBUFFER_TOKEN =
Security token
2
- TOKENBUFSIZE =
12288
- SECBUFFER_VERSION =
0
Instance Method Summary collapse
- #bufferSize ⇒ Object
- #bufferType ⇒ Object
-
#initialize(buffer = nil) ⇒ SecurityBuffer
constructor
A new instance of SecurityBuffer.
- #to_p ⇒ Object
- #token ⇒ Object
Constructor Details
#initialize(buffer = nil) ⇒ SecurityBuffer
Returns a new instance of SecurityBuffer.
92 93 94 95 96 |
# File 'lib/win32/sspi.rb', line 92 def initialize(buffer = nil) @buffer = buffer || "\0" * TOKENBUFSIZE @bufferSize = @buffer.length @type = SECBUFFER_TOKEN end |
Instance Method Details
#bufferSize ⇒ Object
98 99 100 101 |
# File 'lib/win32/sspi.rb', line 98 def bufferSize unpack @bufferSize end |
#bufferType ⇒ Object
103 104 105 106 |
# File 'lib/win32/sspi.rb', line 103 def bufferType unpack @type end |
#to_p ⇒ Object
113 114 115 116 117 118 119 120 121 122 |
# File '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 ⇒ Object
108 109 110 111 |
# File 'lib/win32/sspi.rb', line 108 def token unpack @buffer end |