lib/gssapi/simple.rb
def init_context(in_token = nil, opts = {})
      min_stat = FFI::MemoryPointer.new :OM_uint32
      pctx = (@context.nil? ? LibGSSAPI::GssCtxIdT.gss_c_no_context.address_of : @context.address_of)
      mech = LibGSSAPI::GssOID.gss_c_no_oid
      if(opts[:flags])
        flags = opts[:flags]
      else
        flags = (LibGSSAPI::GSS_C_MUTUAL_FLAG | LibGSSAPI::GSS_C_SEQUENCE_FLAG | LibGSSAPI::GSS_C_CONF_FLAG | LibGSSAPI::GSS_C_INTEG_FLAG)
        flags |= LibGSSAPI::GSS_C_DELEG_FLAG  if opts[:delegate]
        flags |= LibGSSAPI::GSS_C_DELEG_POLICY_FLAG  if opts[:delegate]
      end
      in_tok = LibGSSAPI::UnManagedGssBufferDesc.new
      in_tok.value = in_token
      out_tok = LibGSSAPI::ManagedGssBufferDesc.new
      ret_flags = FFI::MemoryPointer.new :OM_uint32


      maj_stat = LibGSSAPI.gss_init_sec_context(min_stat,
                                                opts[:credentials],
                                                pctx,
                                                @int_svc_name,
                                                mech,
                                                flags,
                                                0,
                                                nil,
                                                in_tok.pointer,
                                                nil,
                                                out_tok.pointer,
                                                ret_flags,
                                                nil)

      raise GssApiError.new(maj_stat, min_stat), "gss_init_sec_context did not return GSS_S_COMPLETE" if maj_stat > 1

      # 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.
      ctx = pctx.get_pointer(0)
      @context = LibGSSAPI::GssCtxIdT.new(ctx) if ctx != @context

      maj_stat == 1 ? out_tok.value : true
    end
# Initialize the GSS security context (client initiator).  If there was a previous call that issued a
#   continue you can pass the continuation token in via the token param.
#   If no flags are set the default flags are LibGSSAPI::GSS_C_MUTUAL_FLAG | LibGSSAPI::GSS_C_SEQUENCE_FLAG
# @param [String] in_token an input token sent from the remote service in a continuation.
# @param [Hash] opts misc opts to be set
# @option opts [Fixnum] :flags override all other flags.  If you set the :delegate option this option will override it.
#   @see http://tools.ietf.org/html/rfc4121#section-4.1.1.1
# @option opts [Boolean] :delegate if true set the credential delegate flag
#              [Credentials] :credentials set to open the context in behalf of someone (delegated_credentials)
# @return [String, true] if a continuation flag is set it will return the output token that is needed to send
#   to the remote host.  Otherwise it returns true and the GSS security context has been established.
Initialize the GSS security context (client initiator).  If there was a previous call that issued a
continue you can pass the continuation token in via the token param.
Initialize the GSS security context ( client initiator ) . If there was a previous call that issued a continue you can pass the continuation token in via the token param .
def init_context(in_token = nil, opts = {})
      min_stat = FFI::MemoryPointer.new :OM_uint32
      pctx = (@context.nil? ? LibGSSAPI::GssCtxIdT.gss_c_no_context.address_of : @context.address_of)
      mech = LibGSSAPI::GssOID.gss_c_no_oid
      if(opts[:flags])
        flags = opts[:flags]
      else
        flags = (LibGSSAPI::GSS_C_MUTUAL_FLAG | LibGSSAPI::GSS_C_SEQUENCE_FLAG | LibGSSAPI::GSS_C_CONF_FLAG | LibGSSAPI::GSS_C_INTEG_FLAG)
        flags |= LibGSSAPI::GSS_C_DELEG_FLAG  if opts[:delegate]
        flags |= LibGSSAPI::GSS_C_DELEG_POLICY_FLAG  if opts[:delegate]
      end
      in_tok = LibGSSAPI::UnManagedGssBufferDesc.new
      in_tok.value = in_token
      out_tok = LibGSSAPI::ManagedGssBufferDesc.new
      ret_flags = FFI::MemoryPointer.new :OM_uint32
      maj_stat = LibGSSAPI.gss_init_sec_context(min_stat,
                                                opts[:credentials],
                                                pctx,
                                                @int_svc_name,
                                                mech,
                                                flags,
                                                0,
                                                nil,
                                                in_tok.pointer,
                                                nil,
                                                out_tok.pointer,
                                                ret_flags,
                                                nil)
      raise GssApiError.new(maj_stat, min_stat), "gss_init_sec_context did not return GSS_S_COMPLETE" if maj_stat > 1
      ctx = pctx.get_pointer(0)
      @context = LibGSSAPI::GssCtxIdT.new(ctx) if ctx != @context
      maj_stat == 1 ? out_tok.value : true
    end
def init_context ( in_token = nil , opts = { } ) min_stat = FFI :: MemoryPointer . new :OM_uint32 pctx = ( @context . nil? ? LibGSSAPI :: GssCtxIdT . gss_c_no_context . address_of : @context . address_of ) mech = LibGSSAPI :: GssOID . gss_c_no_oid if ( opts [ :flags ] ) flags = opts [ :flags ] else flags = ( LibGSSAPI :: GSS_C_MUTUAL_FLAG | LibGSSAPI :: GSS_C_SEQUENCE_FLAG | LibGSSAPI :: GSS_C_CONF_FLAG | LibGSSAPI :: GSS_C_INTEG_FLAG ) flags |= LibGSSAPI :: GSS_C_DELEG_FLAG if opts [ :delegate ] flags |= LibGSSAPI :: GSS_C_DELEG_POLICY_FLAG if opts [ :delegate ] end in_tok = LibGSSAPI :: UnManagedGssBufferDesc . new in_tok . value = in_token out_tok = LibGSSAPI :: ManagedGssBufferDesc . new ret_flags = FFI :: MemoryPointer . new :OM_uint32 maj_stat = LibGSSAPI . gss_init_sec_context ( min_stat , opts [ :credentials ] , pctx , @int_svc_name , mech , flags , 0 , nil , in_tok . pointer , nil , out_tok . pointer , ret_flags , nil ) raise GssApiError . new ( maj_stat , min_stat ) , "gss_init_sec_context did not return GSS_S_COMPLETE" if maj_stat > 1 ctx = pctx . get_pointer ( 0 ) @context = LibGSSAPI :: GssCtxIdT . new ( ctx ) if ctx != @context maj_stat == 1 ? out_tok . value : true end
Initialize the GSS security context (client initiator).
Initialize the GSS security context ( client initiator ) .
# 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 a continuation flag is set it will return the output token that is needed to send to the remote host. Otherwise it returns true and the GSS security context has been established.
if a continuation flag is set it will return the output token that is needed to send to the remote host . Otherwise it returns true and the GSS security context has been established .
String, true
in_token
opts
:delegate if true set the credential delegate flag [Credentials] :credentials set to open the context in behalf of someone (delegated_credentials)
: delegate if true set the credential delegate flag [ Credentials ] : credentials set to open the context in behalf of someone ( delegated_credentials )
opts misc opts to be set
opts misc opts to be set