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
ctx = (@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
maj_stat = LibGSSAPI.gss_accept_sec_context(min_stat,
ctx,
@scred,
in_tok.pointer,
no_chn_bind,
@client,
mech,
out_tok.pointer,
ret_flags,
nil, nil)
raise GssApiError.new(maj_stat, min_stat), "gss_accept_sec_context did not return GSS_S_COMPLETE" if maj_stat > 1
@context = LibGSSAPI::GssCtxIdT.new(ctx.get_pointer(0))
out_tok.length > 0 ? out_tok.value : true
end