lib/gssapi/simple.rb
# Acquire security credentials. This does not log you in. It grabs the credentials from a cred cache or keytab.
# @param [Hash] opts options to pass to the gss_acquire_cred function.
# @option opts [String] :usage The credential usage type (:accept, :initiate, :both).  It defaults to 'accept' since
#   this method is most usually called on the server only.
# @return [true] It will return true if everything succeeds and the @scred variable will be set for future methods. If
#   an error ocurrs an exception will be raised.
Acquire security credentials. This does not log you in. It grabs the credentials from a cred cache or keytab.
Acquire security credentials . This does not log you in . It grabs the credentials from a cred cache or keytab .
def acquire_credentials(princ = @int_svc_name, opts = {:usage => :accept})
      min_stat = FFI::MemoryPointer.new :OM_uint32
      scred = FFI::MemoryPointer.new :pointer
      case opts[:usage]
      when :accept
        usage = LibGSSAPI::GSS_C_ACCEPT
      when :initiate
        usage = LibGSSAPI::GSS_C_INITIATE
      when :both
        usage = LibGSSAPI::GSS_C_BOTH
      else
        raise GssApiError, "Bad option passed to #{self.class.name}#acquire_credentials"
      end
      maj_stat = LibGSSAPI.gss_acquire_cred(min_stat, princ, 0, LibGSSAPI::GSS_C_NO_OID_SET, usage, scred, nil, nil)
      raise GssApiError.new(maj_stat, min_stat), "gss_acquire_cred did not return GSS_S_COMPLETE" if maj_stat != 0
      @scred = LibGSSAPI::GssCredIdT.new(scred.get_pointer(0))
      true
    end
def acquire_credentials ( princ = @int_svc_name , opts = { :usage => :accept } ) min_stat = FFI :: MemoryPointer . new :OM_uint32 scred = FFI :: MemoryPointer . new :pointer case opts [ :usage ] when :accept usage = LibGSSAPI :: GSS_C_ACCEPT when :initiate usage = LibGSSAPI :: GSS_C_INITIATE when :both usage = LibGSSAPI :: GSS_C_BOTH else raise GssApiError , "Bad option passed to #{self.class.name}#acquire_credentials" end maj_stat = LibGSSAPI . gss_acquire_cred ( min_stat , princ , 0 , LibGSSAPI :: GSS_C_NO_OID_SET , usage , scred , nil , nil ) raise GssApiError . new ( maj_stat , min_stat ) , "gss_acquire_cred did not return GSS_S_COMPLETE" if maj_stat != 0 @scred = LibGSSAPI :: GssCredIdT . new ( scred . get_pointer ( 0 ) ) true end
Acquire security credentials.
Acquire security credentials .
It will return true if everything succeeds and the @scred variable will be set for future methods. If an error ocurrs an exception will be raised.
It will return true if everything succeeds and the @scred variable will be set for future methods . If an error ocurrs an exception will be raised .
true
princ
opts
:usage The credential usage type (:accept, :initiate, :both). It defaults to 'accept' since this method is most usually called on the server only.
: usage The credential usage type ( : accept : initiate : both ) . It defaults to ' accept ' since this method is most usually called on the server only .
'accept' since this method is most usually called on the server only
opts options to pass to the gss_acquire_cred function.
opts options to pass to the gss_acquire_cred function .