• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-12-stable/crypto/heimdal/lib/krb5/

Lines Matching refs:context

66     krb5_context context;
72 if (krb5_init_context (&context) != 0)
75 ret = krb5_cc_default (context, &id);
77 krb5_err(context, 1, ret, "krb5_cc_default");
79 ret = krb5_cc_start_seq_get(context, id, &cursor);
81 krb5_err(context, 1, ret, "krb5_cc_start_seq_get");
83 while((ret = krb5_cc_next_cred(context, id, &cursor, &creds)) == 0){
86 krb5_unparse_name(context, creds.server, &principal);
89 krb5_free_cred_contents (context, &creds);
91 ret = krb5_cc_end_seq_get(context, id, &cursor);
93 krb5_err(context, 1, ret, "krb5_cc_end_seq_get");
95 krb5_cc_close(context, id);
97 krb5_free_context(context);
107 * @param context a Keberos context
118 krb5_cc_register(krb5_context context,
124 for(i = 0; i < context->num_cc_ops && context->cc_ops[i]->prefix; i++) {
125 if(strcmp(context->cc_ops[i]->prefix, ops->prefix) == 0) {
127 krb5_set_error_message(context,
136 if(i == context->num_cc_ops) {
137 const krb5_cc_ops **o = realloc(rk_UNCONST(context->cc_ops),
138 (context->num_cc_ops + 1) *
139 sizeof(context->cc_ops[0]));
141 krb5_set_error_message(context, KRB5_CC_NOMEM,
145 context->cc_ops = o;
146 context->cc_ops[context->num_cc_ops] = NULL;
147 context->num_cc_ops++;
149 context->cc_ops[i] = ops;
159 _krb5_cc_allocate(krb5_context context,
167 krb5_set_error_message(context, KRB5_CC_NOMEM,
183 allocate_ccache (krb5_context context,
192 ret = _krb5_expand_path_tokens(context, residual, &exp_residual);
199 ret = _krb5_cc_allocate(context, ops, id);
208 ret = (*id)->ops->resolve(context, id, residual);
245 * @param context a Keberos context.
257 krb5_cc_resolve(krb5_context context,
265 for(i = 0; i < context->num_cc_ops && context->cc_ops[i]->prefix; i++) {
266 size_t prefix_len = strlen(context->cc_ops[i]->prefix);
268 if(strncmp(context->cc_ops[i]->prefix, name, prefix_len) == 0
270 return allocate_ccache (context, context->cc_ops[i],
276 return allocate_ccache (context, &krb5_fcc_ops, name, id);
278 krb5_set_error_message(context, KRB5_CC_UNKNOWN_TYPE,
297 krb5_cc_new_unique(krb5_context context, const char *type,
303 ops = krb5_cc_get_prefix_ops(context, type);
305 krb5_set_error_message(context, KRB5_CC_UNKNOWN_TYPE,
310 ret = _krb5_cc_allocate(context, ops, id);
313 ret = (*id)->ops->gen_new(context, id);
329 krb5_cc_get_name(krb5_context context,
332 return id->ops->get_name(context, id);
343 krb5_cc_get_type(krb5_context context,
352 * @param context a Keberos context
363 krb5_cc_get_full_name(krb5_context context,
371 type = krb5_cc_get_type(context, id);
373 krb5_set_error_message(context, KRB5_CC_UNKNOWN_TYPE,
378 name = krb5_cc_get_name(context, id);
380 krb5_set_error_message(context, KRB5_CC_BADNAME,
386 krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
401 krb5_cc_get_ops(krb5_context context, krb5_ccache id)
411 _krb5_expand_default_cc_name(krb5_context context, const char *str, char **res)
413 return _krb5_expand_path_tokens(context, str, res);
422 environment_changed(krb5_context context)
427 if (context->default_cc_name_set)
431 if (context->default_cc_name &&
432 (strncmp(context->default_cc_name, "KCM:", 4) == 0 ||
433 strncmp(context->default_cc_name, "API:", 4) == 0))
441 if (context->default_cc_name_env) {
442 free(context->default_cc_name_env);
443 context->default_cc_name_env = NULL;
447 if (context->default_cc_name_env == NULL)
449 if (strcmp(e, context->default_cc_name_env) != 0)
465 krb5_cc_switch(krb5_context context, krb5_ccache id)
468 _krb5_set_default_cc_name_to_registry(context, id);
474 return (*id->ops->set_default)(context, id);
484 krb5_cc_support_switch(krb5_context context, const char *type)
488 ops = krb5_cc_get_prefix_ops(context, type);
495 * Set the default cc name for `context' to `name'.
501 krb5_cc_set_default_name(krb5_context context, const char *name)
513 if (context->default_cc_name_env)
514 free(context->default_cc_name_env);
515 context->default_cc_name_env = strdup(e);
521 e = p = _krb5_get_default_cc_name_from_registry(context);
525 e = krb5_config_get_string(context, NULL, "libdefaults",
528 ret = _krb5_expand_default_cc_name(context, e, &p);
534 e = krb5_config_get_string(context, NULL, "libdefaults",
537 ops = krb5_cc_get_prefix_ops(context, e);
539 krb5_set_error_message(context,
546 ret = (*ops->get_default_name)(context, &p);
551 context->default_cc_name_set = 0;
554 context->default_cc_name_set = 1;
558 krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
562 ret = _krb5_expand_path_tokens(context, p, &exp_p);
567 if (context->default_cc_name)
568 free(context->default_cc_name);
570 context->default_cc_name = exp_p;
576 * Return a pointer to a context static string containing the default
586 krb5_cc_default_name(krb5_context context)
588 if (context->default_cc_name == NULL || environment_changed(context))
589 krb5_cc_set_default_name(context, NULL);
591 return context->default_cc_name;
604 krb5_cc_default(krb5_context context,
607 const char *p = krb5_cc_default_name(context);
610 krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
613 return krb5_cc_resolve(context, p, id);
626 krb5_cc_initialize(krb5_context context,
630 return (*id->ops->init)(context, id, primary_principal);
644 krb5_cc_destroy(krb5_context context,
649 ret = (*id->ops->destroy)(context, id);
650 krb5_cc_close (context, id);
664 krb5_cc_close(krb5_context context,
668 ret = (*id->ops->close)(context, id);
683 krb5_cc_store_cred(krb5_context context,
687 return (*id->ops->store)(context, id, creds);
695 * @param context A Kerberos 5 context
709 krb5_cc_retrieve_cred(krb5_context context,
719 return (*id->ops->retrieve)(context, id, whichfields,
723 ret = krb5_cc_start_seq_get(context, id, &cursor);
726 while((ret = krb5_cc_next_cred(context, id, &cursor, creds)) == 0){
727 if(krb5_compare_creds(context, whichfields, mcreds, creds)){
731 krb5_free_cred_contents (context, creds);
733 krb5_cc_end_seq_get(context, id, &cursor);
747 krb5_cc_get_principal(krb5_context context,
751 return (*id->ops->get_princ)(context, id, principal);
765 krb5_cc_start_seq_get (krb5_context context,
769 return (*id->ops->get_first)(context, id, cursor);
783 krb5_cc_next_cred (krb5_context context,
788 return (*id->ops->get_next)(context, id, cursor, creds);
799 krb5_cc_end_seq_get (krb5_context context,
803 return (*id->ops->end_get)(context, id, cursor);
814 krb5_cc_remove_cred(krb5_context context,
820 krb5_set_error_message(context,
826 return (*id->ops->remove_cred)(context, id, which, cred);
837 krb5_cc_set_flags(krb5_context context,
841 return (*id->ops->set_flags)(context, id, flags);
851 krb5_cc_get_flags(krb5_context context,
863 * @param context A Kerberos 5 context.
867 * @param matchctx context passed to match function.
876 krb5_cc_copy_match_f(krb5_context context,
891 ret = krb5_cc_get_principal(context, from, &princ);
894 ret = krb5_cc_initialize(context, to, princ);
896 krb5_free_principal(context, princ);
899 ret = krb5_cc_start_seq_get(context, from, &cursor);
901 krb5_free_principal(context, princ);
905 while ((ret = krb5_cc_next_cred(context, from, &cursor, &cred)) == 0) {
906 if (match == NULL || (*match)(context, matchctx, &cred) == 0) {
909 ret = krb5_cc_store_cred(context, to, &cred);
913 krb5_free_cred_contents(context, &cred);
915 krb5_cc_end_seq_get(context, from, &cursor);
916 krb5_free_principal(context, princ);
929 krb5_cc_copy_cache(krb5_context context,
933 return krb5_cc_copy_match_f(context, from, to, NULL, NULL, NULL);
944 krb5_cc_get_version(krb5_context context,
948 return (*id->ops->get_version)(context, id);
967 * Get the cc ops that is registered in `context' to handle the
980 krb5_cc_get_prefix_ops(krb5_context context, const char *prefix)
992 krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
999 for(i = 0; i < context->num_cc_ops && context->cc_ops[i]->prefix; i++) {
1000 if(strcmp(context->cc_ops[i]->prefix, p) == 0) {
1002 return context->cc_ops[i];
1018 * @param context A Kerberos 5 context
1029 krb5_cc_cache_get_first (krb5_context context,
1037 type = krb5_cc_default_name(context);
1039 ops = krb5_cc_get_prefix_ops(context, type);
1041 krb5_set_error_message(context, KRB5_CC_UNKNOWN_TYPE,
1048 krb5_set_error_message(context, KRB5_CC_NOSUPP,
1057 krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
1063 ret = ops->get_cache_first(context, &(*cursor)->cursor);
1075 * @param context A Kerberos 5 context
1087 krb5_cc_cache_next (krb5_context context,
1091 return cursor->ops->get_cache_next(context, cursor->cursor, id);
1104 krb5_cc_cache_end_seq_get (krb5_context context,
1108 ret = cursor->ops->end_cache_get(context, cursor->cursor);
1119 * @param context A Kerberos 5 context
1130 krb5_cc_cache_match (krb5_context context,
1140 ret = krb5_cccol_cursor_new (context, &cursor);
1144 while (krb5_cccol_cursor_next (context, cursor, &cache) == 0 && cache != NULL) {
1147 ret = krb5_cc_get_principal(context, cache, &principal);
1151 match = krb5_principal_compare(context, principal, client);
1152 krb5_free_principal(context, principal);
1157 krb5_cc_close(context, cache);
1161 krb5_cccol_cursor_free(context, &cursor);
1166 krb5_unparse_name(context, client, &str);
1168 krb5_set_error_message(context, KRB5_CC_NOTFOUND,
1185 * @param context a Keberos context
1196 krb5_cc_move(krb5_context context, krb5_ccache from, krb5_ccache to)
1201 krb5_set_error_message(context, KRB5_CC_NOSUPP,
1207 ret = (*to->ops->move)(context, from, to);
1219 build_conf_principals(krb5_context context, krb5_ccache id,
1229 ret = krb5_cc_get_principal(context, id, &client);
1234 ret = krb5_unparse_name(context, principal, &pname);
1239 ret = krb5_make_principal(context, &cred->server,
1244 krb5_free_principal(context, client);
1247 ret = krb5_copy_principal(context, client, &cred->client);
1248 krb5_free_principal(context, client);
1257 * @param context a Keberos context
1264 krb5_is_config_principal(krb5_context context,
1281 * @param context a Keberos context
1292 krb5_cc_set_config(krb5_context context, krb5_ccache id,
1299 ret = build_conf_principals(context, id, principal, name, &cred);
1304 ret = krb5_cc_remove_cred(context, id, 0, &cred);
1317 ret = krb5_cc_store_cred(context, id, &cred);
1321 krb5_free_cred_contents (context, &cred);
1328 * @param context a Keberos context
1340 krb5_cc_get_config(krb5_context context, krb5_ccache id,
1350 ret = build_conf_principals(context, id, principal, name, &mcred);
1354 ret = krb5_cc_retrieve_cred(context, id, 0, &mcred, &cred);
1361 krb5_free_cred_contents (context, &cred);
1362 krb5_free_cred_contents (context, &mcred);
1379 * @param context a Keberos context
1388 krb5_cccol_cursor_new(krb5_context context, krb5_cccol_cursor *cursor)
1392 krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
1404 * @param context A Kerberos 5 context
1420 krb5_cccol_cursor_next(krb5_context context, krb5_cccol_cursor cursor,
1427 while (cursor->idx < context->num_cc_ops) {
1430 ret = krb5_cc_cache_get_first (context,
1431 context->cc_ops[cursor->idx]->prefix,
1438 ret = krb5_cc_cache_next(context, cursor->cursor, cache);
1442 krb5_cc_cache_end_seq_get(context, cursor->cursor);
1449 if (cursor->idx >= context->num_cc_ops) {
1450 krb5_set_error_message(context, KRB5_CC_END,
1461 * @param context A Kerberos 5 context
1471 krb5_cccol_cursor_free(krb5_context context, krb5_cccol_cursor *cursor)
1478 krb5_cc_cache_end_seq_get(context, c->cursor);
1487 * @param context A Kerberos 5 context
1498 krb5_cc_last_change_time(krb5_context context,
1503 return (*id->ops->lastchange)(context, id, mtime);
1511 * @param context A Kerberos 5 context
1521 krb5_cccol_last_change_time(krb5_context context,
1532 ret = krb5_cccol_cursor_new (context, &cursor);
1536 while (krb5_cccol_cursor_next(context, cursor, &id) == 0 && id != NULL) {
1538 if (type && strcmp(krb5_cc_get_type(context, id), type) != 0)
1541 ret = krb5_cc_last_change_time(context, id, &t);
1542 krb5_cc_close(context, id);
1549 krb5_cccol_cursor_free(context, &cursor);
1562 krb5_cc_get_friendly_name(krb5_context context,
1569 ret = krb5_cc_get_config(context, id, NULL, "FriendlyName", &data);
1572 ret = krb5_cc_get_principal(context, id, &principal);
1575 ret = krb5_unparse_name(context, principal, name);
1576 krb5_free_principal(context, principal);
1582 krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
1599 krb5_cc_set_friendly_name(krb5_context context,
1608 return krb5_cc_set_config(context, id, NULL, "FriendlyName", &data);
1617 * @param context A Kerberos 5 context.
1627 krb5_cc_get_lifetime(krb5_context context, krb5_ccache id, time_t *t)
1637 ret = krb5_cc_start_seq_get(context, id, &cursor);
1641 while ((ret = krb5_cc_next_cred(context, id, &cursor, &cred)) == 0) {
1645 krb5_free_cred_contents(context, &cred);
1648 krb5_free_cred_contents(context, &cred);
1651 krb5_cc_end_seq_get(context, id, &cursor);
1659 * If the backend doesn't support KDC offset, use the context global setting.
1661 * @param context A Kerberos 5 context.
1671 krb5_cc_set_kdc_offset(krb5_context context, krb5_ccache id, krb5_deltat offset)
1674 context->kdc_sec_offset = offset;
1675 context->kdc_usec_offset = 0;
1678 return (*id->ops->set_kdc_offset)(context, id, offset);
1684 * If the backend doesn't support KDC offset, use the context global setting.
1686 * @param context A Kerberos 5 context.
1696 krb5_cc_get_kdc_offset(krb5_context context, krb5_ccache id, krb5_deltat *offset)
1699 *offset = context->kdc_sec_offset;
1702 return (*id->ops->get_kdc_offset)(context, id, offset);
1710 _krb5_get_default_cc_name_from_registry(krb5_context context)
1723 ccname = _krb5_parse_reg_value_as_string(context, hk_k5, "ccname",
1732 _krb5_set_default_cc_name_to_registry(krb5_context context, krb5_ccache id)
1746 ret = asprintf(&ccname, "%s:%s", krb5_cc_get_type(context, id), krb5_cc_get_name(context, id));
1750 ret = _krb5_store_string_to_reg_value(context, hk_k5, "ccname",