class GSSAPI::LibGSSAPI::UnManagedGssBufferDesc
This class implements the gss_buffer_desc type. Use pointer to emulate gss_buffer_t If you are setting the value of the buffer and it is not being set from the function this is the type of buffer you should use. If the buffer is being allocated and set inside the function you should use a ManagedGssBufferDesc instead so gss_release_buffer is called for it. It states in the manpage for each gss function whether or not gss_release_buffer needs to be called or not. @example
buff = UnManagedGssBufferDesc.new buff.value = "This is a test"
Public Class Methods
new(ptr = nil)
click to toggle source
Calls superclass method
# File lib/gssapi/lib_gssapi.rb, line 79 def initialize(ptr = nil) if(ptr.nil?) super(FFI::Pointer.new(FFI::MemoryPointer.new(self.size))) else super(ptr) end end
Public Instance Methods
value=(val)
click to toggle source
Set the value of the string for the “value” parameter. This method also
appropriately sets the length parameter.
# File lib/gssapi/lib_gssapi.rb, line 89 def value=(val) if(val.nil?) self[:length] = 0 self[:value] = val elsif(val.is_a?(String)) buff = FFI::MemoryPointer.from_string(val) self[:length] = val.length self[:value] = buff elsif(val.is_a?(Fixnum)) buff = FFI::MemoryPointer.new :OM_uint32 buff.write_int val self[:length] = FFI::type_size :OM_uint32 self[:value] = buff else raise StandardError, "Can't handle type #{val.class.name}" end end