Class: Kerberos::Krb5::Context

Inherits:
Object
  • Object
show all
Defined in:
ext/rkerberos/context.c

Instance Method Summary collapse

Constructor Details

#Kerberos::Context.newObject

Creates and returns a new Kerberos::Context object.

This class is not typically instantiated directly, but is used internally by the krb5-auth library.



51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'ext/rkerberos/context.c', line 51

static VALUE rkrb5_context_initialize(VALUE self){
  RUBY_KRB5_CONTEXT* ptr;
  krb5_error_code kerror;

  Data_Get_Struct(self, RUBY_KRB5_CONTEXT, ptr);

  kerror = krb5_init_context(&ptr->ctx);

  if(kerror)
    rb_raise(cKrb5Exception, "krb5_init_context: %s", error_message(kerror));
  
  return self;
}

Instance Method Details

#closeObject

Closes the context object.



29
30
31
32
33
34
35
36
37
38
39
40
# File 'ext/rkerberos/context.c', line 29

static VALUE rkrb5_context_close(VALUE self){
  RUBY_KRB5_CONTEXT* ptr;

  Data_Get_Struct(self, RUBY_KRB5_CONTEXT, ptr);

  if(ptr->ctx)
    krb5_free_context(ptr->ctx);

  ptr->ctx = NULL;

  return self;
}