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
@@map =
{}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ SSPIResult

Returns a new instance of SSPIResult.



182
183
184
185
186
187
# File 'lib/win32/sspi.rb', line 182

def initialize(value)
	# convert to unsigned long
	value = [value].pack("L").unpack("L").first
	raise "#{value.to_s(16)} is not a recognized result" unless @@map.has_key? value
	@value = value
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



180
181
182
# File 'lib/win32/sspi.rb', line 180

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



197
198
199
200
201
202
203
204
205
# File 'lib/win32/sspi.rb', line 197

def ==(other)
	if other.is_a?(SSPIResult)
		@value == other.value
	elsif other.is_a?(Fixnum)
		@value == @@map[other]
	else
		false
	end
end

#ok?Boolean

Returns:

  • (Boolean)


193
194
195
# File 'lib/win32/sspi.rb', line 193

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

#to_sObject



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

def to_s
	@@map[@value].to_s
end