lib/gssapi/simple.rb
# Accept a security context that was initiated by a remote peer.
# @param [String] in_token The token sent by the remote client to initiate the context
# @return [String, true] If this is part of a continuation it will return a token to be passed back to the remote
#   otherwise it will simply return true.
Accept a security context that was initiated by a remote peer.
Accept a security context that was initiated by a remote peer .
def accept_context(in_token)
      raise GssApiError, "No credentials yet acquired. Call #{self.class.name}#acquire_credentials first" if @scred.nil?
      min_stat = FFI::MemoryPointer.new :OM_uint32
      pctx = (@context.nil? ? LibGSSAPI::GssCtxIdT.gss_c_no_context.address_of : @context.address_of)
      no_chn_bind = LibGSSAPI::GSS_C_NO_CHANNEL_BINDINGS
      @client = FFI::MemoryPointer.new :pointer  
      mech = FFI::MemoryPointer.new :pointer  
      in_tok = GSSAPI::LibGSSAPI::UnManagedGssBufferDesc.new
      in_tok.value = in_token
      out_tok = GSSAPI::LibGSSAPI::ManagedGssBufferDesc.new
      ret_flags = FFI::MemoryPointer.new :OM_uint32
      delegated_cred_handle = FFI::MemoryPointer.new :pointer
      maj_stat = LibGSSAPI.gss_accept_sec_context(min_stat,
                                                  pctx,
                                                  @scred,
                                                  in_tok.pointer,
                                                  no_chn_bind,
                                                  @client,
                                                  mech,
                                                  out_tok.pointer,
                                                  ret_flags,
                                                  nil,
                                                  delegated_cred_handle)
      raise GssApiError.new(maj_stat, min_stat), "gss_accept_sec_context did not return GSS_S_COMPLETE" if maj_stat > 1
      if (ret_flags.read_uint32 & LibGSSAPI::GSS_C_DELEG_FLAG) != 0
        @delegated_credentials = LibGSSAPI::GssCredIdT.new(delegated_cred_handle.get_pointer(0))
      end
      ctx = pctx.get_pointer(0)
      @context = LibGSSAPI::GssCtxIdT.new(ctx) if ctx != @context
      out_tok.length > 0 ? out_tok.value : true
    end
def accept_context ( in_token ) raise GssApiError , "No credentials yet acquired. Call #{self.class.name}#acquire_credentials first" if @scred . nil? min_stat = FFI :: MemoryPointer . new :OM_uint32 pctx = ( @context . nil? ? LibGSSAPI :: GssCtxIdT . gss_c_no_context . address_of : @context . address_of ) no_chn_bind = LibGSSAPI :: GSS_C_NO_CHANNEL_BINDINGS @client = FFI :: MemoryPointer . new :pointer mech = FFI :: MemoryPointer . new :pointer in_tok = GSSAPI :: LibGSSAPI :: UnManagedGssBufferDesc . new in_tok . value = in_token out_tok = GSSAPI :: LibGSSAPI :: ManagedGssBufferDesc . new ret_flags = FFI :: MemoryPointer . new :OM_uint32 delegated_cred_handle = FFI :: MemoryPointer . new :pointer maj_stat = LibGSSAPI . gss_accept_sec_context ( min_stat , pctx , @scred , in_tok . pointer , no_chn_bind , @client , mech , out_tok . pointer , ret_flags , nil , delegated_cred_handle ) raise GssApiError . new ( maj_stat , min_stat ) , "gss_accept_sec_context did not return GSS_S_COMPLETE" if maj_stat > 1 if ( ret_flags . read_uint32 & LibGSSAPI :: GSS_C_DELEG_FLAG ) != 0 @delegated_credentials = LibGSSAPI :: GssCredIdT . new ( delegated_cred_handle . get_pointer ( 0 ) ) end ctx = pctx . get_pointer ( 0 ) @context = LibGSSAPI :: GssCtxIdT . new ( ctx ) if ctx != @context out_tok . length > 0 ? out_tok . value : true end
Accept a security context that was initiated by a remote peer.
Accept a security context that was initiated by a remote peer .
# Will hold the initiating client name after the call # Will hold the mech being used after the call # The returned context may be equal to the passed in @context. If so, we # must not create another AutoPointer to the same gss_buffer_t. If we do # we will double delete it.
If this is part of a continuation it will return a token to be passed back to the remote otherwise it will simply return true.
If this is part of a continuation it will return a token to be passed back to the remote otherwise it will simply return true .
String, true
in_token
in_token The token sent by the remote client to initiate the context
in_token The token sent by the remote client to initiate the context