Lines Matching defs:handle

53  * Purpose: Check a server handle and return a com_err code if it is
58 * handle The server handle.
61 static int check_handle(void *handle)
63 CHECK_HANDLE(handle);
67 static int dup_db_args(kadm5_server_handle_t handle, char **db_args)
74 handle->db_args = NULL;
78 handle->db_args = calloc(sizeof(char*), count+1);
79 if (handle->db_args == NULL) {
85 handle->db_args[count] = strdup(db_args[count]);
86 if (handle->db_args[count] == NULL) {
93 if (ret && handle->db_args) {
94 for (count=0; handle->db_args[count]; count++)
95 free(handle->db_args[count]);
97 free(handle->db_args), handle->db_args = NULL;
103 static void free_db_args(kadm5_server_handle_t handle)
107 if (handle->db_args) {
108 for (count=0; handle->db_args[count]; count++)
109 free(handle->db_args[count]);
111 free(handle->db_args), handle->db_args = NULL;
202 kadm5_server_handle_t handle;
215 if (! (handle = (kadm5_server_handle_t) malloc(sizeof *handle)))
217 memset(handle, 0, sizeof(*handle));
219 ret = dup_db_args(handle, db_args);
221 free(handle);
225 handle->context = context;
234 handle->magic_number = KADM5_SERVER_HANDLE_MAGIC;
235 handle->struct_version = struct_version;
236 handle->api_version = api_version;
242 GENERIC_CHECK_HANDLE(handle, KADM5_OLD_SERVER_API_VERSION,
256 free_db_args(handle);
257 free(handle);
262 ret = kadm5_get_config_params(handle->context, 1, params_in,
263 &handle->params);
265 free_db_args(handle);
266 free(handle);
289 if ((handle->params.mask & REQUIRED_PARAMS) != REQUIRED_PARAMS) {
291 kadm5_free_config_params(handle->context, &handle->params);
292 free_db_args(handle);
293 free(handle);
296 if ((handle->params.mask & KADM5_CONFIG_IPROP_ENABLED) == KADM5_CONFIG_IPROP_ENABLED
297 && handle->params.iprop_enabled) {
298 if ((handle->params.mask & IPROP_REQUIRED_PARAMS) != IPROP_REQUIRED_PARAMS) {
299 free_db_args(handle);
300 free(handle);
305 ret = krb5_set_default_realm(handle->context, handle->params.realm);
308 kadm5_free_config_params(handle->context, &handle->params);
309 free_db_args(handle);
310 free(handle);
314 ret = krb5_db_open(handle->context, db_args,
319 const char *m = krb5_get_error_message(handle->context, ret);
321 krb5_free_error_message(handle->context, m);
323 kadm5_free_config_params(handle->context, &handle->params);
324 free_db_args(handle);
325 free(handle);
329 if ((ret = krb5_parse_name(handle->context, client_name,
330 &handle->current_caller))) {
331 krb5_db_fini(handle->context);
333 kadm5_free_config_params(handle->context, &handle->params);
334 free_db_args(handle);
335 free(handle);
339 if (! (handle->lhandle = malloc(sizeof(*handle)))) {
340 krb5_db_fini(handle->context);
342 kadm5_free_config_params(handle->context, &handle->params);
343 free_db_args(handle);
344 free(handle);
347 *handle->lhandle = *handle;
348 handle->lhandle->api_version = KADM5_API_VERSION_3;
349 handle->lhandle->struct_version = KADM5_STRUCT_VERSION;
350 handle->lhandle->lhandle = handle->lhandle;
352 /* can't check the handle until current_caller is set */
353 ret = check_handle((void *) handle);
356 krb5_db_fini(handle->context);
357 kadm5_free_config_params(handle->context, &handle->params);
358 free_db_args(handle);
359 free(handle);
368 if (handle->params.enctype == DEFAULT_KDC_ENCTYPE)
369 handle->params.enctype = ENCTYPE_UNKNOWN;
371 ret = kdb_init_master(handle, handle->params.realm,
372 (handle->params.mask & KADM5_CONFIG_MKEY_FROM_KBD)
373 && handle->params.mkey_from_kbd);
375 krb5_db_fini(handle->context);
377 kadm5_free_config_params(handle->context, &handle->params);
378 free_db_args(handle);
379 free(handle);
386 handle->params.enctype = master_keyblock.enctype;
388 ret = kdb_init_hist(handle, handle->params.realm);
390 krb5_db_fini(handle->context);
392 kadm5_free_config_params(handle->context, &handle->params);
393 free_db_args(handle);
394 free(handle);
398 ret = init_dict(&handle->params);
400 krb5_db_fini(handle->context);
401 krb5_free_principal(handle->context, handle->current_caller);
403 kadm5_free_config_params(handle->context, &handle->params);
404 free_db_args(handle);
405 free(handle);
409 *server_handle = (void *) handle;
429 kadm5_server_handle_t handle = server_handle;
435 adb_policy_close(handle);
436 krb5_db_fini(handle->context);
437 krb5_free_principal(handle->context, handle->current_caller);
438 kadm5_free_config_params(handle->context, &handle->params);
439 handle->magic_number = 0;
440 free(handle->lhandle);
441 free_db_args(handle);
442 free(handle);
449 kadm5_server_handle_t handle = server_handle;
453 ret = krb5_db_lock(handle->context, KRB5_DB_LOCKMODE_EXCLUSIVE);
462 kadm5_server_handle_t handle = server_handle;
466 ret = krb5_db_unlock(handle->context);
475 kadm5_server_handle_t handle = server_handle;
480 if ((ret = krb5_db_fini(handle->context)) ||
481 (ret = krb5_db_open(handle->context, handle->db_args,
483 (ret = adb_policy_close(handle)) ||
484 (ret = adb_policy_init(handle))) {
491 int _kadm5_check_handle(void *handle)
493 CHECK_HANDLE(handle);
515 kadm5_init_iprop(void *handle, char **db_args)
520 iprop_h = handle;