Class: Win32::SSPI::SSPIResult

Inherits:
Object
  • Object
show all
Defined in:
lib/win32/sspi.rb

Overview

Takes a return result from an SSPI function and interprets the value.

Constant Summary collapse

SEC_E_OK =

Good results

0x00000000
SEC_I_CONTINUE_NEEDED =
0x00090312
SEC_E_INSUFFICIENT_MEMORY =

These are generally returned by InitializeSecurityContext

0x80090300
SEC_E_INTERNAL_ERROR =
0x80090304
SEC_E_INVALID_HANDLE =
0x80090301
SEC_E_INVALID_TOKEN =
0x80090308
SEC_E_LOGON_DENIED =
0x8009030C
SEC_E_NO_AUTHENTICATING_AUTHORITY =
0x80090311
SEC_E_NO_CREDENTIALS =
0x8009030E
SEC_E_TARGET_UNKNOWN =
0x80090303
SEC_E_UNSUPPORTED_FUNCTION =
0x80090302
SEC_E_WRONG_PRINCIPAL =
0x80090322
SEC_E_NOT_OWNER =

These are generally returned by AcquireCredentialsHandle

0x80090306
SEC_E_SECPKG_NOT_FOUND =
0x80090305
SEC_E_UNKNOWN_CREDENTIALS =
0x8009030D
RESULT_MAP =
constants.to_h {|v| [const_get(v), v]}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ SSPIResult

Returns a new instance of SSPIResult.



188
189
190
191
192
193
# File 'lib/win32/sspi.rb', line 188

def initialize(value)
  # convert to unsigned long
  value &= 0xffffffff
  raise "#{value.to_s(16)} is not a recognized result" unless RESULT_MAP.key? value
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



186
187
188
# File 'lib/win32/sspi.rb', line 186

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/win32/sspi.rb', line 203

def ==(other)
  case other
  when SSPIResult
    @value == other.value
  when Integer
    @value == other
  when Symbol
    RESULT_MAP[@value] == other
  else
    false
  end
end

#ok?Boolean

Returns:

  • (Boolean)


199
200
201
# File 'lib/win32/sspi.rb', line 199

def ok?
  @value == SEC_I_CONTINUE_NEEDED || @value == SEC_E_OK
end

#to_sObject



195
196
197
# File 'lib/win32/sspi.rb', line 195

def to_s
  RESULT_MAP[@value].to_s
end