Skip to content

Instantly share code, notes, and snippets.

@mkomitee
Created April 29, 2015 17:21
Show Gist options
  • Save mkomitee/b24aa34c457d9cefe599 to your computer and use it in GitHub Desktop.
Save mkomitee/b24aa34c457d9cefe599 to your computer and use it in GitHub Desktop.
How do?
#include <stdio.h>
#include <krb5.h>
/*
In krb5.h ...
krb5_error_code is defined as:
typedef int krb5_int32
typedef krb5_int32 krb5_error_code;
krb5_context is defined as:
struct _krb5_context;
typedef struct _krb5_context * krb5_context;
krb5_init_context is defined as:
krb5_error_code krb5_init_context(krb5_context *context);
*/
int main() {
krb5_context kcontext = NULL;
krb5_error_code code;
code = krb5_init_context(&kcontext);
if (code == 0) {
/* Do something w/ kcontext, usually passing it as a handle
into other k5b5 functions. */
printf("Code: %d\n");
}
if (kcontext != NULL) {
krb5_free_context(kcontext);
}
}
/*
The actual implementation of krb5_context isn't included in the
header files. It's used as an opaque data type. How can I construct
one, initialize it to NULL, and pass it by reference to a
krb5_init_context via ffi.
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment