Exception: GSSAPI::GssApiError

Inherits:
StandardError
  • Object
show all
Includes:
LibGSSAPI
Defined in:
lib/gssapi/exceptions.rb

Constant Summary

Constants included from LibGSSAPI

LibGSSAPI::GSSAPI_LIB_TYPE, LibGSSAPI::GSS_C_ACCEPT, LibGSSAPI::GSS_C_ANON_FLAG, LibGSSAPI::GSS_C_BOTH, LibGSSAPI::GSS_C_CALLING_ERRORS, LibGSSAPI::GSS_C_CALLING_ERROR_OFFSET, LibGSSAPI::GSS_C_CONF_FLAG, LibGSSAPI::GSS_C_DELEG_FLAG, LibGSSAPI::GSS_C_DELEG_POLICY_FLAG, LibGSSAPI::GSS_C_EMPTY_BUFFER, LibGSSAPI::GSS_C_GSS_CODE, LibGSSAPI::GSS_C_INDEFINITE, LibGSSAPI::GSS_C_INITIATE, LibGSSAPI::GSS_C_INTEG_FLAG, LibGSSAPI::GSS_C_MECH_CODE, LibGSSAPI::GSS_C_MUTUAL_FLAG, LibGSSAPI::GSS_C_NO_BUFFER, LibGSSAPI::GSS_C_NO_CHANNEL_BINDINGS, LibGSSAPI::GSS_C_NO_CONTEXT, LibGSSAPI::GSS_C_NO_CREDENTIAL, LibGSSAPI::GSS_C_NO_NAME, LibGSSAPI::GSS_C_NO_OID, LibGSSAPI::GSS_C_NO_OID_SET, LibGSSAPI::GSS_C_PROT_READY_FLAG, LibGSSAPI::GSS_C_QOP_DEFAULT, LibGSSAPI::GSS_C_REPLAY_FLAG, LibGSSAPI::GSS_C_ROUTINE_ERRORS, LibGSSAPI::GSS_C_ROUTINE_ERROR_OFFSET, LibGSSAPI::GSS_C_SEQUENCE_FLAG, LibGSSAPI::GSS_C_SUPPLEMENTARY_CODES, LibGSSAPI::GSS_C_SUPPLEMENTARY_OFFSET, LibGSSAPI::GSS_C_TRANS_FLAG, LibGSSAPI::GSS_IOV_BUFFER_FLAG_ALLOCATE, LibGSSAPI::GSS_IOV_BUFFER_FLAG_ALLOCATED, LibGSSAPI::GSS_IOV_BUFFER_FLAG_MASK, LibGSSAPI::GSS_IOV_BUFFER_TYPE_DATA, LibGSSAPI::GSS_IOV_BUFFER_TYPE_EMPTY, LibGSSAPI::GSS_IOV_BUFFER_TYPE_HEADER, LibGSSAPI::GSS_IOV_BUFFER_TYPE_MECH_PARAMS, LibGSSAPI::GSS_IOV_BUFFER_TYPE_PADDING, LibGSSAPI::GSS_IOV_BUFFER_TYPE_SIGN_ONLY, LibGSSAPI::GSS_IOV_BUFFER_TYPE_STREAM, LibGSSAPI::GSS_IOV_BUFFER_TYPE_TRAILER, LibGSSAPI::GSS_S_COMPLETE

Instance Method Summary collapse

Methods included from LibGSSAPI

load_heimdal, load_mit

Constructor Details

#initialize(maj_stat = nil, min_stat = nil) ⇒ GssApiError

Returns a new instance of GssApiError.


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/gssapi/exceptions.rb', line 13

def initialize(maj_stat = nil, min_stat = nil)

  # If raised as class (raise GssApiError, "msg) the error message is given
  # as the first parameter.
  if maj_stat.class == String
    @s = maj_stat
    return super maj_stat
  end

  if(maj_stat.nil? && min_stat.nil?)
    @s = '(no error info)'
  else
    min = FFI::MemoryPointer.new :OM_uint32
    message_context = FFI::MemoryPointer.new :OM_uint32
    @s = ''
    oid = GssOID.gss_c_no_oid
    min_stat = min_stat.read_uint32
    [[maj_stat, GSS_C_GSS_CODE], [min_stat, GSS_C_MECH_CODE]].each do |m, t|
      message_context.write_int 0
      begin
        out_buff = ManagedGssBufferDesc.new
        maj = gss_display_status(min, m, t, oid, message_context, out_buff.pointer)
        if (maj != 0)
          @s += "failed to retrieve GSSAPI display for status #{m}"
          @s += " of major status #{maj_stat}, minor_status #{min_stat}\n"
          @s += "(with major status #{maj}, minor status #{min.read_uint32}\n"
          break
        end
        @s += out_buff.value.to_s + "\n"
      end while message_context.read_int != 0
    end
  end

  # We need to call this so we can pass the message to the Error when we have no arguments
  super()
end

Instance Method Details

#messageObject


11
# File 'lib/gssapi/exceptions.rb', line 11

def message; to_s + ": " + @s; end