/*
- * Copyright (C) 1989,1990,1991,1992,1993,1994,1995,2000,2001, 2003,2006,2007 by the Massachusetts Institute of Technology,
+ * Copyright (C) 1989,1990,1991,1992,1993,1994,1995,2000,2001, 2003,2006,2007,2008 by the Massachusetts Institute of Technology,
* Cambridge, MA, USA. All Rights Reserved.
*
* This software is being provided to you, the LICENSEE, by the
#include "com_err.h"
#include "k5-plugin.h"
+struct _kdb5_dal_handle; /* private, in kdb5.h */
+typedef struct _kdb5_dal_handle kdb5_dal_handle;
struct _krb5_context {
krb5_magic magic;
krb5_enctype *in_tkt_ktypes;
struct _krb5_os_context os_context;
char *default_realm;
profile_t profile;
- void *db_context;
+ kdb5_dal_handle *dal_handle;
int ser_ctx_count;
void *ser_ctx;
/* allowable clock skew */
}
dal_handle->lib_handle = lib;
- kcontext->db_context = (void *) dal_handle;
+ kcontext->dal_handle = dal_handle;
clean_n_exit:
free(library);
{
krb5_error_code status = 0;
- status =
- kdb_free_library(((kdb5_dal_handle *) kcontext->db_context)->
- lib_handle);
+ status = kdb_free_library(kcontext->dal_handle->lib_handle);
if (status) {
goto clean_n_exit;
}
- free(kcontext->db_context);
- kcontext->db_context = NULL;
+ free(kcontext->dal_handle);
+ kcontext->dal_handle = NULL;
clean_n_exit:
return status;
return;
assert(kcontext != NULL);
/* Must be called with dal_handle->lib_handle locked! */
- assert(kcontext->db_context != NULL);
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ assert(kcontext->dal_handle != NULL);
+ dal_handle = kcontext->dal_handle;
if (dal_handle->lib_handle->vftabl.errcode_2_string == NULL)
return;
e = dal_handle->lib_handle->vftabl.errcode_2_string(kcontext, err_code);
goto clean_n_exit;
}
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
status = kdb_setup_lib_handle(kcontext);
if (status) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
if (status) {
goto clean_n_exit;
krb5_error_code
krb5_db_inited(krb5_context kcontext)
{
- return !(kcontext && kcontext->db_context &&
- ((kdb5_dal_handle *) kcontext->db_context)->db_context);
+ return !(kcontext && kcontext->dal_handle &&
+ kcontext->dal_handle->db_context);
}
krb5_error_code
goto clean_n_exit;
}
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
status = kdb_setup_lib_handle(kcontext);
if (status) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
if (status) {
goto clean_n_exit;
krb5_error_code status = 0;
kdb5_dal_handle *dal_handle;
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
/* module not loaded. So nothing to be done */
goto clean_n_exit;
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
if (status) {
goto clean_n_exit;
goto clean_n_exit;
}
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
status = kdb_setup_lib_handle(kcontext);
if (status) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
if (status) {
goto clean_n_exit;
krb5_error_code status = 0;
kdb5_dal_handle *dal_handle;
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
status = kdb_setup_lib_handle(kcontext);
if (status) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
if (status) {
goto clean_n_exit;
krb5_error_code status = 0;
kdb5_dal_handle *dal_handle;
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
status = kdb_setup_lib_handle(kcontext);
if (status) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
if (status) {
goto clean_n_exit;
krb5_error_code status = 0;
kdb5_dal_handle *dal_handle;
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
status = kdb_setup_lib_handle(kcontext);
if (status) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
/* acquire an exclusive lock, ensures no other thread uses this context */
status = kdb_lock_lib_lock(dal_handle->lib_handle, TRUE);
if (status) {
krb5_error_code status = 0;
kdb5_dal_handle *dal_handle;
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
status = kdb_setup_lib_handle(kcontext);
if (status) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
/* normal lock acquired and exclusive lock released */
status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
if (status) {
krb5_error_code status = 0;
kdb5_dal_handle *dal_handle;
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
status = kdb_setup_lib_handle(kcontext);
if (status) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
if (status) {
goto clean_n_exit;
krb5_error_code status = 0;
kdb5_dal_handle *dal_handle;
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
status = kdb_setup_lib_handle(kcontext);
if (status) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
if (status) {
goto clean_n_exit;
krb5_tl_data *prev, *curr, *next;
int db_args_size = 0;
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
status = kdb_setup_lib_handle(kcontext);
if (status) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
if (status) {
goto clean_n_exit;
krb5_error_code status = 0;
kdb5_dal_handle *dal_handle;
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
status = kdb_setup_lib_handle(kcontext);
if (status) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
if (status) {
goto clean_n_exit;
krb5_error_code status = 0;
kdb5_dal_handle *dal_handle;
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
status = kdb_setup_lib_handle(kcontext);
if (status) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
if (status) {
goto clean_n_exit;
krb5_error_code status = 0;
kdb5_dal_handle *dal_handle;
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
status = kdb_setup_lib_handle(kcontext);
if (status) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
if (status) {
goto clean_n_exit;
krb5_error_code status = 0;
kdb5_dal_handle *dal_handle;
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
status = kdb_setup_lib_handle(kcontext);
if (status) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
if (status) {
goto clean_n_exit;
krb5_error_code status = 0;
kdb5_dal_handle *dal_handle;
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
status = kdb_setup_lib_handle(kcontext);
if (status) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
if (status) {
goto clean_n_exit;
krb5_error_code status = 0;
kdb5_dal_handle *dal_handle;
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
status = kdb_setup_lib_handle(kcontext);
if (status) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
if (status) {
goto clean_n_exit;
krb5_error_code status = 0;
kdb5_dal_handle *dal_handle;
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
status = kdb_setup_lib_handle(kcontext);
if (status) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
if (status) {
goto clean_n_exit;
} else {
kdb5_dal_handle *dal_handle;
- if (context->db_context == NULL) {
+ if (context->dal_handle == NULL) {
retval = kdb_setup_lib_handle(context);
if (retval) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) context->db_context;
+ dal_handle = context->dal_handle;
retval = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
if (retval) {
goto clean_n_exit;
krb5_error_code status = 0;
kdb5_dal_handle *dal_handle;
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
status = kdb_setup_lib_handle(kcontext);
if (status) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
if (status) {
goto clean_n_exit;
kdb5_dal_handle *dal_handle;
void *new_ptr = NULL;
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
status = kdb_setup_lib_handle(kcontext);
if (status) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
new_ptr = dal_handle->lib_handle->vftabl.db_alloc(kcontext, ptr, size);
krb5_error_code status;
kdb5_dal_handle *dal_handle;
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
status = kdb_setup_lib_handle(kcontext);
if (status) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
dal_handle->lib_handle->vftabl.db_free(kcontext, ptr);
krb5_error_code status = 0;
kdb5_dal_handle *dal_handle;
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
status = kdb_setup_lib_handle(kcontext);
if (status) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
if (status) {
goto clean_n_exit;
krb5_error_code status = 0;
kdb5_dal_handle *dal_handle;
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
status = kdb_setup_lib_handle(kcontext);
if (status) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
if (status) {
goto clean_n_exit;
krb5_error_code status = 0;
kdb5_dal_handle *dal_handle;
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
status = kdb_setup_lib_handle(kcontext);
if (status) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
if (status) {
goto clean_n_exit;
krb5_error_code status = 0;
kdb5_dal_handle *dal_handle;
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
status = kdb_setup_lib_handle(kcontext);
if (status) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
if (status) {
goto clean_n_exit;
krb5_error_code status = 0;
kdb5_dal_handle *dal_handle;
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
status = kdb_setup_lib_handle(kcontext);
if (status) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
if (status) {
goto clean_n_exit;
krb5_error_code status = 0;
kdb5_dal_handle *dal_handle;
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
status = kdb_setup_lib_handle(kcontext);
if (status) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
if (status) {
goto clean_n_exit;
krb5_error_code status = 0;
kdb5_dal_handle *dal_handle;
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
status = kdb_setup_lib_handle(kcontext);
if (status) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
if (status) {
goto clean_n_exit;
krb5_error_code status = 0;
kdb5_dal_handle *dal_handle;
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
status = kdb_setup_lib_handle(kcontext);
if (status) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
if (status) {
goto clean_n_exit;
goto clean_n_exit;
}
- if (kcontext->db_context == NULL) {
+ if (kcontext->dal_handle == NULL) {
status = kdb_setup_lib_handle(kcontext);
if (status) {
goto clean_n_exit;
}
}
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE);
if (status) {
goto clean_n_exit;
struct _db_library *next, *prev;
} *db_library;
-typedef struct _kdb5_dal_handle
+struct _kdb5_dal_handle
{
/* Helps us to change db_library without affecting modules to some
extent. */
void *db_context;
db_library lib_handle;
-} kdb5_dal_handle;
+};
+/* typedef kdb5_dal_handle is in k5-int.h now */
#endif /* end of _KRB5_KDB5_H_ */
/*
* lib/krb5/krb/init_ctx.c
*
- * Copyright 1994,1999,2000, 2002, 2003, 2007 by the Massachusetts Institute of Technology.
+ * Copyright 1994,1999,2000, 2002, 2003, 2007, 2008 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
nctx->tgs_ktype_count = 0;
nctx->default_realm = NULL;
nctx->profile = NULL;
- nctx->db_context = NULL;
+ nctx->dal_handle = NULL;
nctx->ser_ctx_count = 0;
nctx->ser_ctx = NULL;
nctx->prompt_types = NULL;
/*
* lib/krb5/krb/ser_ctx.c
*
- * Copyright 1995, 2007 by the Massachusetts Institute of Technology.
+ * Copyright 1995, 2007, 2008 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
&required);
/* Calculate size required by db_context, if appropriate */
- if (!kret && context->db_context)
+ if (!kret && context->dal_handle)
kret = krb5_size_opaque(kcontext,
KV5M_DB_CONTEXT,
- (krb5_pointer) context->db_context,
+ (krb5_pointer) context->dal_handle,
&required);
/* Finally, calculate size required by profile, if appropriate */
return (kret);
/* Now handle database context, if appropriate */
- if (context->db_context) {
+ if (context->dal_handle) {
kret = krb5_externalize_opaque(kcontext, KV5M_DB_CONTEXT,
- (krb5_pointer) context->db_context,
+ (krb5_pointer) context->dal_handle,
&bp, &remain);
if (kret)
return (kret);
/* Attempt to read in the db_context */
kret = krb5_internalize_opaque(kcontext, KV5M_DB_CONTEXT,
- (krb5_pointer *) &context->db_context,
+ (krb5_pointer *) &context->dal_handle,
&bp, &remain);
if (kret && (kret != EINVAL) && (kret != ENOENT))
goto cleanup;
/*
* lib/kdb/kdb_db2.c
*
- * Copyright 1997,2006,2007 by the Massachusetts Institute of Technology.
+ * Copyright 1997,2006,2007,2008 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
/*
* Routines to deal with context.
*/
-#define k5db2_inited(c) (c && c->db_context \
- && ((kdb5_dal_handle*)c->db_context)->db_context \
- && ((krb5_db2_context *) ((kdb5_dal_handle*)c->db_context)->db_context)->db_inited)
+#define k5db2_inited(c) (c && c->dal_handle \
+ && c->dal_handle->db_context \
+ && ((krb5_db2_context *) c->dal_handle->db_context)->db_inited)
static krb5_error_code
krb5_db2_get_db_opt(char *input, char **opt, char **val)
krb5_db2_context *db_ctx;
kdb5_dal_handle *dal_handle;
- dal_handle = (kdb5_dal_handle *) context->db_context;
+ dal_handle = context->dal_handle;
if (dal_handle->db_context == NULL) {
db_ctx = (krb5_db2_context *) malloc(sizeof(krb5_db2_context));
if (k5db2_inited(context))
return KRB5_KDB_DBNOTINITED;
- dal_handle = (kdb5_dal_handle *) context->db_context;
+ dal_handle = context->dal_handle;
dbc = (krb5_db2_context *) dal_handle->db_context;
dbc->hashfirst = hashfirst;
return 0;
if ((retval = k5db2_init_context(context)))
return (retval);
- dal_handle = (kdb5_dal_handle *) context->db_context;
+ dal_handle = context->dal_handle;
db_ctx = dal_handle->db_context;
db_ctx->db = NULL;
krb5_db2_context *db_ctx;
kdb5_dal_handle *dal_handle;
- dal_handle = (kdb5_dal_handle *) context->db_context;
+ dal_handle = context->dal_handle;
if (dal_handle == NULL) {
return 0;
}
if (!k5db2_inited(context))
return (KRB5_KDB_DBNOTINITED);
- dal_handle = (kdb5_dal_handle *) context->db_context;
+ dal_handle = context->dal_handle;
db_ctx = dal_handle->db_context;
db_ctx->db_master_key = key;
return 0;
if (!k5db2_inited(context))
return (KRB5_KDB_DBNOTINITED);
- dal_handle = (kdb5_dal_handle *) context->db_context;
+ dal_handle = context->dal_handle;
db_ctx = dal_handle->db_context;
*key = db_ctx->db_master_key;
if (name == NULL)
name = default_db_name;
- dal_handle = (kdb5_dal_handle *) context->db_context;
+ dal_handle = context->dal_handle;
db_ctx = dal_handle->db_context;
db_ctx->tempdb = tempdb;
db = k5db2_dbopen(db_ctx, name, O_RDONLY, 0, tempdb);
if (!k5db2_inited(context))
return (KRB5_KDB_DBNOTINITED);
- dal_handle = (kdb5_dal_handle *) context->db_context;
+ dal_handle = context->dal_handle;
db_ctx = (krb5_db2_context *) dal_handle->db_context;
if (fstat(db_ctx->db_lf_file, &st) < 0)
return (KRB5_KDB_DBNOTINITED);
retval = 0;
- dal_handle = (kdb5_dal_handle *) context->db_context;
+ dal_handle = context->dal_handle;
db_ctx = dal_handle->db_context;
now = time((time_t *) NULL);
if (fstat(db_ctx->db_lf_file, &st) == 0) {
if (!k5db2_inited(context))
return KRB5_KDB_DBNOTINITED;
- dal_handle = (kdb5_dal_handle *) context->db_context;
+ dal_handle = context->dal_handle;
db_ctx = (krb5_db2_context *) dal_handle->db_context;
if (db_ctx->db_locks_held && (db_ctx->db_lock_mode >= mode)) {
/* No need to upgrade lock, just return */
if (!k5db2_inited(context))
return KRB5_KDB_DBNOTINITED;
- dal_handle = (kdb5_dal_handle *) context->db_context;
+ dal_handle = context->dal_handle;
db_ctx = (krb5_db2_context *) dal_handle->db_context;
if ((retval = osa_adb_release_lock(db_ctx->policy_db))) {
if ((retval = k5db2_init_context(context)))
return (retval);
- dal_handle = (kdb5_dal_handle *) context->db_context;
+ dal_handle = context->dal_handle;
db_ctx = (krb5_db2_context *) dal_handle->db_context;
switch (flags) {
case KRB5_KDB_CREATE_HASH:
char policy_db_name[1024], policy_lock_name[1024];
tmpcontext = 0;
- if (!context->db_context
- || !((kdb5_dal_handle *) context->db_context)->db_context) {
+ if (!context->dal_handle
+ || !context->dal_handle->db_context) {
tmpcontext = 1;
if ((retval1 = k5db2_init_context(context)))
return (retval1);
retval2 = destroy_file_suffix(dbname, KDB2_LOCK_EXT);
if (tmpcontext) {
- k5db2_clear_context((krb5_db2_context *) ((kdb5_dal_handle *) context->
- db_context)->db_context);
- free(((kdb5_dal_handle *) context->db_context)->db_context);
- ((kdb5_dal_handle *) context->db_context)->db_context = NULL;
+ k5db2_clear_context((krb5_db2_context *) context->dal_handle->db_context);
+ free(context->dal_handle->db_context);
+ context->dal_handle->db_context = NULL;
}
if (retval1 || retval2)
if (!k5db2_inited(context))
return KRB5_KDB_DBNOTINITED;
- dal_handle = (kdb5_dal_handle *) context->db_context;
+ dal_handle = context->dal_handle;
db_ctx = (krb5_db2_context *) dal_handle->db_context;
for (trynum = 0; trynum < KRB5_DB2_MAX_RETRY; trynum++) {
if (!k5db2_inited(context))
return KRB5_KDB_DBNOTINITED;
- dal_handle = (kdb5_dal_handle *) context->db_context;
+ dal_handle = context->dal_handle;
db_ctx = (krb5_db2_context *) dal_handle->db_context;
if ((retval = krb5_db2_db_lock(context, KRB5_LOCKMODE_EXCLUSIVE)))
return retval;
if (!k5db2_inited(context))
return KRB5_KDB_DBNOTINITED;
- dal_handle = (kdb5_dal_handle *) context->db_context;
+ dal_handle = context->dal_handle;
db_ctx = (krb5_db2_context *) dal_handle->db_context;
if ((retval = krb5_db2_db_lock(context, KRB5_LOCKMODE_EXCLUSIVE)))
return (retval);
if (!k5db2_inited(context))
return KRB5_KDB_DBNOTINITED;
- dal_handle = (kdb5_dal_handle *) context->db_context;
+ dal_handle = context->dal_handle;
db_ctx = (krb5_db2_context *) dal_handle->db_context;
retval = krb5_db2_db_lock(context, KRB5_LOCKMODE_SHARED);
krb5_db2_context *db_ctx;
kdb5_dal_handle *dal_handle;
- dal_handle = (kdb5_dal_handle *) context->db_context;
+ dal_handle = context->dal_handle;
old = mode;
if (dal_handle && (db_ctx = (krb5_db2_context *) dal_handle->db_context)) {
old = db_ctx->db_nb_locks;
if (!k5db2_inited(kcontext))
return KRB5_KDB_DBNOTINITED;
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
db_ctx = (krb5_db2_context *) dal_handle->db_context;
kdb5_dal_handle *dal_handle;
krb5_db2_context *dbc;
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
dbc = (krb5_db2_context *) dal_handle->db_context;
return osa_adb_create_policy(dbc->policy_db, policy);
kdb5_dal_handle *dal_handle;
krb5_db2_context *dbc;
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
dbc = (krb5_db2_context *) dal_handle->db_context;
return osa_adb_get_policy(dbc->policy_db, name, policy, cnt);
kdb5_dal_handle *dal_handle;
krb5_db2_context *dbc;
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
dbc = (krb5_db2_context *) dal_handle->db_context;
return osa_adb_put_policy(dbc->policy_db, policy);
kdb5_dal_handle *dal_handle;
krb5_db2_context *dbc;
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
dbc = (krb5_db2_context *) dal_handle->db_context;
return osa_adb_iter_policy(dbc->policy_db, func, data);
kdb5_dal_handle *dal_handle;
krb5_db2_context *dbc;
- dal_handle = (kdb5_dal_handle *) kcontext->db_context;
+ dal_handle = kcontext->dal_handle;
dbc = (krb5_db2_context *) dal_handle->db_context;
return osa_adb_destroy_policy(dbc->policy_db, policy);
krb5_clear_error_message (kcontext);
{
- kdb5_dal_handle *dal_handle = kcontext->db_context;
+ kdb5_dal_handle *dal_handle = kcontext->dal_handle;
krb5_db2_context *db_ctx = dal_handle->db_context;
db_name = strdup(db_ctx->db_name);
}
- assert(kcontext->db_context != NULL);
+ assert(kcontext->dal_handle != NULL);
temp_db_name = gen_dbsuffix(db_name, "~");
if (temp_db_name == NULL) {
status = ENOMEM;
char *fromok;
krb5_error_code retval;
krb5_db2_context *s_context, *db_ctx;
- kdb5_dal_handle *dal_handle = context->db_context;
+ kdb5_dal_handle *dal_handle = context->dal_handle;
s_context = dal_handle->db_context;
dal_handle->db_context = NULL;
kdb5_dal_handle *dal_handle = NULL;
krb5_ldap_context *ldap_context=NULL;
- dal_handle = (kdb5_dal_handle *) util_context->db_context;
+ dal_handle = util_context->dal_handle;
ldap_context = (krb5_ldap_context *) dal_handle->db_context;
if (!ldap_context) {
retval = EINVAL;
/*
* kadmin/ldap_util/kdb5_ldap_realm.c
*
- * Copyright 1990,1991,2001, 2002 by the Massachusetts Institute of Technology.
+ * Copyright 1990,1991,2001, 2002, 2008 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
goto err_nomsg;
}
- dal_handle = (kdb5_dal_handle *) util_context->db_context;
+ dal_handle = util_context->dal_handle;
ldap_context = (krb5_ldap_context *) dal_handle->db_context;
if (!ldap_context) {
retval = EINVAL;
int subtree_changed = 0;
#endif
- dal_handle = (kdb5_dal_handle *) util_context->db_context;
+ dal_handle = util_context->dal_handle;
ldap_context = (krb5_ldap_context *) dal_handle->db_context;
if (!(ldap_context)) {
retval = EINVAL;
krb5_ldap_context *ldap_context=NULL;
int mask = 0;
- dal_handle = (kdb5_dal_handle *) util_context->db_context;
+ dal_handle = util_context->dal_handle;
ldap_context = (krb5_ldap_context *) dal_handle->db_context;
if (!(ldap_context)) {
retval = EINVAL;
kdb5_dal_handle *dal_handle=NULL;
krb5_ldap_context *ldap_context=NULL;
- dal_handle = (kdb5_dal_handle *)util_context->db_context;
+ dal_handle = util_context->dal_handle;
ldap_context = (krb5_ldap_context *) dal_handle->db_context;
if (!(ldap_context)) {
retval = EINVAL;
retval = EINVAL;
goto cleanup;
}
- dal_handle = (kdb5_dal_handle *) context->db_context;
+ dal_handle = context->dal_handle;
ldap_context = (krb5_ldap_context *) dal_handle->db_context;
if (!(ldap_context)) {
retval = EINVAL;
printf("OK, deleting database of '%s'...\n", global_params.realm);
}
- dal_handle = (kdb5_dal_handle *)util_context->db_context;
+ dal_handle = util_context->dal_handle;
ldap_context = (krb5_ldap_context *) dal_handle->db_context;
if (!(ldap_context)) {
com_err(argv[0], EINVAL, "while initializing database");
/*
* kadmin/ldap_util/kdb5_ldap_util.c
*
- * (C) Copyright 1990,1991, 1996 by the Massachusetts Institute of Technology.
+ * (C) Copyright 1990,1991, 1996, 2008 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
goto cleanup;
}
dal_handle->db_context = ldap_context;
- util_context->db_context = (void *) dal_handle;
+ util_context->dal_handle = dal_handle;
db_retval = krb5_ldap_read_server_params(util_context, conf_section, KRB5_KDB_SRV_TYPE_OTHER);
if (db_retval) {
t_ptr++;
}
- dal_handle = (kdb5_dal_handle *) context->db_context;
+ dal_handle = context->dal_handle;
dal_handle->db_context = ldap_context;
status = krb5_ldap_read_server_params(context, conf_section, mode & 0x0300);
if (status) {
#define IGNORE_STATUS 0
#define CHECK_STATUS 1
-#define SETUP_CONTEXT() if (context == NULL || context->db_context == NULL \
- || ((kdb5_dal_handle *)context->db_context)->db_context == NULL) { \
+#define SETUP_CONTEXT() if (context == NULL || context->dal_handle == NULL \
+ || context->dal_handle->db_context == NULL) { \
return EINVAL; \
} \
- dal_handle = (kdb5_dal_handle *)context->db_context; \
+ dal_handle = context->dal_handle; \
ldap_context = (krb5_ldap_context *) dal_handle->db_context; \
if (ldap_context == NULL || ldap_context->server_info_list == NULL) \
return KRB5_KDB_DBNOTINITED;
krb5_ldap_context *ldap_context=NULL;
if (context == NULL ||
- context->db_context == NULL ||
- ((kdb5_dal_handle *)context->db_context)->db_context == NULL)
+ context->dal_handle == NULL ||
+ context->dal_handle->db_context == NULL)
return 0;
- dal_handle = (kdb5_dal_handle *) context->db_context;
+ dal_handle = context->dal_handle;
ldap_context = (krb5_ldap_context *) dal_handle->db_context;
dal_handle->db_context = NULL;
t_ptr++;
}
- dal_handle = (kdb5_dal_handle *) context->db_context;
+ dal_handle = context->dal_handle;
dal_handle->db_context = (kdb5_dal_handle *) ldap_context;
status = krb5_ldap_read_server_params(context, conf_section, KRB5_KDB_SRV_TYPE_ADMIN);
/* Clear the global error string */
krb5_clear_error_message(context);
- dal_handle = (kdb5_dal_handle *) context->db_context;
+ dal_handle = context->dal_handle;
ldap_context = (krb5_ldap_context *) dal_handle->db_context;
if (ldap_context == NULL || ldap_context->lrparams == NULL)
/* Clear the global error string */
krb5_clear_error_message(context);
- dal_handle = (kdb5_dal_handle *) context->db_context;
+ dal_handle = context->dal_handle;
ldap_context = (krb5_ldap_context *) dal_handle->db_context;
if (ldap_context == NULL || ldap_context->lrparams == NULL)
krb5_ldap_context *ldap_context=NULL;
krb5_ldap_server_info ***server_info=NULL;
- dal_handle = (kdb5_dal_handle *) context->db_context;
+ dal_handle = context->dal_handle;
ldap_context = (krb5_ldap_context *) dal_handle->db_context;
/* copy the conf_section into ldap_context for later use */
if (searchfor == NULL)
return EINVAL;
- dal_handle = (kdb5_dal_handle *) context->db_context;
+ dal_handle = context->dal_handle;
ldap_context = (krb5_ldap_context *) dal_handle->db_context;
CHECK_LDAP_HANDLE(ldap_context);