lib/gssapi/simple.rb
# Convert a String to a GSSAPI usable buffer (gss_buffer_desc)
# @param [String] str the string to convert
Convert a String to a GSSAPI usable buffer (gss_buffer_desc)
Convert a String to a GSSAPI usable buffer ( gss_buffer_desc )
def import_name(str)
      buff_str = LibGSSAPI::UnManagedGssBufferDesc.new
      buff_str.value = str
      if (str =~ /[A-Za-z0-9]+\/[^@]+@.+$/)
        mech = LibGSSAPI::GssOID.gss_c_no_oid
      else
        mech = LibGSSAPI::GSS_C_NT_HOSTBASED_SERVICE
      end
      name = FFI::MemoryPointer.new :pointer 
      min_stat = FFI::MemoryPointer.new :OM_uint32
      maj_stat = LibGSSAPI.gss_import_name(min_stat, buff_str.pointer, mech, name)
      raise GssApiError.new(maj_stat, min_stat), "gss_import_name did not return GSS_S_COMPLETE" if maj_stat != 0
      LibGSSAPI::GssNameT.new(name.get_pointer(0))
    end
def import_name ( str ) buff_str = LibGSSAPI :: UnManagedGssBufferDesc . new buff_str . value = str if ( str =~ / [A-Za-z0-9]+ \/ [^@]+@.+$ / ) mech = LibGSSAPI :: GssOID . gss_c_no_oid else mech = LibGSSAPI :: GSS_C_NT_HOSTBASED_SERVICE end name = FFI :: MemoryPointer . new :pointer min_stat = FFI :: MemoryPointer . new :OM_uint32 maj_stat = LibGSSAPI . gss_import_name ( min_stat , buff_str . pointer , mech , name ) raise GssApiError . new ( maj_stat , min_stat ) , "gss_import_name did not return GSS_S_COMPLETE" if maj_stat != 0 LibGSSAPI :: GssNameT . new ( name . get_pointer ( 0 ) ) end
Convert a String to a GSSAPI usable buffer (gss_buffer_desc)
Convert a String to a GSSAPI usable buffer ( gss_buffer_desc )
# Choose the appropriate mechanism based on the string passed. # gss_name_t
str
str the string to convert
str the string to convert