25RCSID(
"$Id: 83b6aa2e43b5cc2505baef721ca78f8de08d46d4 $")
27#define LOG_PREFIX inst->name
29#include <freeradius-devel/util/debug.h>
30#include <freeradius-devel/server/base.h>
33#ifdef HAVE_KRB5_GET_ERROR_MESSAGE
34# define KRB5_STRERROR_BUFSIZE (2048)
36static _Thread_local
char *krb5_error_buffer;
41static int _krb5_logging_free(
void *arg)
53 buffer = krb5_error_buffer;
55 buffer = talloc_array(NULL,
char, KRB5_STRERROR_BUFSIZE);
57 ERROR(
"Failed allocating memory for krb5 error buffer");
67# ifdef HAVE_KRB5_FREE_ERROR_MESSAGE
69# elif defined(HAVE_KRB5_FREE_ERROR_STRING)
72# error "No way to free error strings, missing krb5_free_error_message() and krb5_free_error_string()"
90 krb5_free_context(conn->
context);
95 if (conn->ccache) krb5_cc_destroy(conn->
context, conn->ccache);
106 ret = krb5_init_context(&conn->
context);
113 ret =
inst->keytabname ?
122 ret = krb5_cc_new_unique(conn->
context,
"MEMORY", NULL, &conn->ccache);
128 krb5_verify_opt_init(&conn->options);
129 krb5_verify_opt_set_ccache(&conn->options, conn->ccache);
131 krb5_verify_opt_set_keytab(&conn->options, conn->
keytab);
132 krb5_verify_opt_set_secure(&conn->options,
true);
134 if (
inst->service) krb5_verify_opt_set_service(&conn->options,
inst->service);
static int const char char buffer[256]
#define fr_atexit_thread_local(_name, _free, _uctx)
#define UNCONST(_type, _ptr)
Remove const qualification from a pointer.
#define fr_cond_assert(_x)
Calls panic_action ifndef NDEBUG, else logs error and evaluates to value of _x.
int krb5_handle_init(rlm_krb5_handle_t *conn, void *uctx)
void * krb5_mod_conn_create(TALLOC_CTX *ctx, void *instance, UNUSED fr_time_delta_t timeout)
Create and return a new connection.
static int _mod_conn_free(rlm_krb5_handle_t *conn)
Frees libkrb5 resources associated with the handle.
Context management functions for rlm_krb5.
#define rlm_krb5_error(_x, _y, _z)
Instance configuration for rlm_krb5.
eap_aka_sim_process_conf_t * inst
size_t strlcpy(char *dst, char const *src, size_t siz)
#define talloc_get_type_abort_const
A time delta, a difference in time measured in nanoseconds.