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

Lines Matching refs:context

48 test_default_name(krb5_context context)
54 p = krb5_cc_default_name(context);
56 krb5_errx (context, 1, "krb5_cc_default_name 1 failed");
59 ret = krb5_cc_set_default_name(context, NULL);
61 krb5_errx (context, 1, "krb5_cc_set_default_name failed");
63 p = krb5_cc_default_name(context);
65 krb5_errx (context, 1, "krb5_cc_default_name 2 failed");
69 krb5_errx (context, 1, "krb5_cc_default_name no longer same");
71 ret = krb5_cc_set_default_name(context, test_cc_name);
73 krb5_errx (context, 1, "krb5_cc_set_default_name 1 failed");
75 p = krb5_cc_default_name(context);
77 krb5_errx (context, 1, "krb5_cc_default_name 2 failed");
85 krb5_errx (context, 1, "krb5_cc_set_default_name 1 failed");
99 test_mcache(krb5_context context)
107 ret = krb5_parse_name(context, "lha@SU.SE", &p);
109 krb5_err(context, 1, ret, "krb5_parse_name");
111 ret = krb5_cc_new_unique(context, krb5_cc_type_memory, NULL, &id);
113 krb5_err(context, 1, ret, "krb5_cc_new_unique");
115 ret = krb5_cc_initialize(context, id, p);
117 krb5_err(context, 1, ret, "krb5_cc_initialize");
119 nc = krb5_cc_get_name(context, id);
121 krb5_errx(context, 1, "krb5_cc_get_name");
123 tc = krb5_cc_get_type(context, id);
125 krb5_errx(context, 1, "krb5_cc_get_name");
130 krb5_cc_close(context, id);
132 ret = krb5_cc_resolve(context, c, &id2);
134 krb5_err(context, 1, ret, "krb5_cc_resolve");
136 ret = krb5_cc_get_principal(context, id2, &p2);
138 krb5_err(context, 1, ret, "krb5_cc_get_principal");
140 if (krb5_principal_compare(context, p, p2) == FALSE)
141 krb5_errx(context, 1, "p != p2");
143 krb5_cc_destroy(context, id2);
144 krb5_free_principal(context, p);
145 krb5_free_principal(context, p2);
147 ret = krb5_cc_resolve(context, c, &id2);
149 krb5_err(context, 1, ret, "krb5_cc_resolve");
151 ret = krb5_cc_get_principal(context, id2, &p2);
153 krb5_errx(context, 1, "krb5_cc_get_principal");
155 krb5_cc_destroy(context, id2);
164 test_init_vs_destroy(krb5_context context, const char *type)
171 ret = krb5_parse_name(context, "lha@SU.SE", &p);
173 krb5_err(context, 1, ret, "krb5_parse_name");
175 ret = krb5_cc_new_unique(context, type, NULL, &id);
177 krb5_err(context, 1, ret, "krb5_cc_new_unique: %s", type);
180 krb5_cc_get_type(context, id),
181 krb5_cc_get_name(context, id)) < 0 || n == NULL)
185 ret = krb5_cc_resolve(context, n, &id2);
188 krb5_err(context, 1, ret, "krb5_cc_resolve");
190 krb5_cc_destroy(context, id);
192 ret = krb5_cc_initialize(context, id2, p);
194 krb5_err(context, 1, ret, "krb5_cc_initialize");
196 ret = krb5_cc_get_principal(context, id2, &p2);
198 krb5_err(context, 1, ret, "krb5_cc_get_principal");
200 krb5_cc_destroy(context, id2);
201 krb5_free_principal(context, p);
202 krb5_free_principal(context, p2);
206 test_cache_remove(krb5_context context, const char *type)
213 ret = krb5_parse_name(context, "lha@SU.SE", &p);
215 krb5_err(context, 1, ret, "krb5_parse_name");
217 ret = krb5_cc_new_unique(context, type, NULL, &id);
219 krb5_err(context, 1, ret, "krb5_cc_gen_new: %s", type);
221 ret = krb5_cc_initialize(context, id, p);
223 krb5_err(context, 1, ret, "krb5_cc_initialize");
227 ret = krb5_parse_name(context, "krbtgt/SU.SE@SU.SE", &cred.server);
229 krb5_err(context, 1, ret, "krb5_parse_name");
230 ret = krb5_parse_name(context, "lha@SU.SE", &cred.client);
232 krb5_err(context, 1, ret, "krb5_parse_name");
234 ret = krb5_cc_store_cred(context, id, &cred);
236 krb5_err(context, 1, ret, "krb5_cc_store_cred");
238 ret = krb5_cc_remove_cred(context, id, 0, &cred);
240 krb5_err(context, 1, ret, "krb5_cc_remove_cred");
242 ret = krb5_cc_destroy(context, id);
244 krb5_err(context, 1, ret, "krb5_cc_destroy");
246 krb5_free_principal(context, p);
247 krb5_free_principal(context, cred.server);
248 krb5_free_principal(context, cred.client);
254 krb5_context context;
261 ret = krb5_init_context(&context);
263 krb5_err(context, 1, ret, "krb5_init_context");
265 ret = krb5_cc_set_default_name(context, "MEMORY:foo");
267 krb5_err(context, 1, ret, "krb5_cc_set_default_name");
269 ret = krb5_cc_default(context, &id);
271 krb5_err(context, 1, ret, "krb5_cc_default");
273 ret = krb5_cc_default(context, &id2);
275 krb5_err(context, 1, ret, "krb5_cc_default");
277 ret = krb5_cc_close(context, id);
279 krb5_err(context, 1, ret, "krb5_cc_close");
281 ret = krb5_cc_close(context, id2);
283 krb5_err(context, 1, ret, "krb5_cc_close");
285 krb5_free_context(context);
325 test_def_cc_name(krb5_context context)
332 ret = _krb5_expand_default_cc_name(context, cc_names[i].str, &str);
335 krb5_errx(context, 1, "test %d \"%s\" failed",
339 krb5_errx(context, 1, "test %d \"%s\" was successful",
342 krb5_errx(context, 1, "test %d %s != %s",
352 test_cache_find(krb5_context context, const char *principal, int find)
358 ret = krb5_parse_name(context, principal, &client);
360 krb5_err(context, 1, ret, "parse_name for %s failed", principal);
362 ret = krb5_cc_cache_match(context, client, &id);
364 krb5_err(context, 1, ret, "cc_cache_match for %s failed", principal);
366 krb5_err(context, 1, ret, "cc_cache_match for %s found", principal);
369 krb5_cc_close(context, id);
370 krb5_free_principal(context, client);
375 test_cache_iter(krb5_context context, const char *type, int destroy)
381 ret = krb5_cc_cache_get_first (context, type, &cursor);
385 krb5_err(context, 1, ret, "krb5_cc_cache_get_first(%s)", type);
388 while ((ret = krb5_cc_cache_next (context, cursor, &id)) == 0) {
393 printf("name: %s\n", krb5_cc_get_name(context, id));
394 ret = krb5_cc_get_principal(context, id, &principal);
396 ret = krb5_unparse_name(context, principal, &name);
402 krb5_free_principal(context, principal);
405 krb5_cc_destroy(context, id);
407 krb5_cc_close(context, id);
410 krb5_cc_cache_end_seq_get(context, cursor);
414 test_cache_iter_all(krb5_context context)
420 ret = krb5_cccol_cursor_new (context, &cursor);
422 krb5_err(context, 1, ret, "krb5_cccol_cursor_new");
425 while ((ret = krb5_cccol_cursor_next (context, cursor, &id)) == 0 && id != NULL) {
430 printf("name: %s\n", krb5_cc_get_name(context, id));
431 ret = krb5_cc_get_principal(context, id, &principal);
433 ret = krb5_unparse_name(context, principal, &name);
439 krb5_free_principal(context, principal);
441 krb5_cc_close(context, id);
444 krb5_cccol_cursor_free(context, &cursor);
449 test_copy(krb5_context context, const char *from, const char *to)
455 ret = krb5_parse_name(context, "lha@SU.SE", &p);
457 krb5_err(context, 1, ret, "krb5_parse_name");
459 ret = krb5_cc_new_unique(context, from, NULL, &fromid);
461 krb5_err(context, 1, ret, "krb5_cc_new_unique: %s", from);
463 ret = krb5_cc_initialize(context, fromid, p);
465 krb5_err(context, 1, ret, "krb5_cc_initialize");
467 ret = krb5_cc_new_unique(context, to, NULL, &toid);
469 krb5_err(context, 1, ret, "krb5_cc_gen_new: %s", to);
471 ret = krb5_cc_copy_cache(context, fromid, toid);
473 krb5_err(context, 1, ret, "krb5_cc_copy_cache");
475 ret = krb5_cc_get_principal(context, toid, &p2);
477 krb5_err(context, 1, ret, "krb5_cc_get_principal");
479 if (krb5_principal_compare(context, p, p2) == FALSE)
480 krb5_errx(context, 1, "p != p2");
482 krb5_free_principal(context, p);
483 krb5_free_principal(context, p2);
485 krb5_cc_destroy(context, fromid);
486 krb5_cc_destroy(context, toid);
490 test_move(krb5_context context, const char *type)
497 ops = krb5_cc_get_prefix_ops(context, type);
501 ret = krb5_cc_new_unique(context, type, NULL, &fromid);
505 krb5_err(context, 1, ret, "krb5_cc_new_unique: %s", type);
507 ret = krb5_parse_name(context, "lha@SU.SE", &p);
509 krb5_err(context, 1, ret, "krb5_parse_name");
511 ret = krb5_cc_initialize(context, fromid, p);
513 krb5_err(context, 1, ret, "krb5_cc_initialize");
515 ret = krb5_cc_new_unique(context, type, NULL, &toid);
517 krb5_err(context, 1, ret, "krb5_cc_new_unique");
519 ret = krb5_cc_initialize(context, toid, p);
521 krb5_err(context, 1, ret, "krb5_cc_initialize");
523 ret = krb5_cc_get_principal(context, toid, &p2);
525 krb5_err(context, 1, ret, "krb5_cc_get_principal");
527 if (krb5_principal_compare(context, p, p2) == FALSE)
528 krb5_errx(context, 1, "p != p2");
530 krb5_free_principal(context, p);
531 krb5_free_principal(context, p2);
533 krb5_cc_destroy(context, toid);
534 krb5_cc_destroy(context, fromid);
539 test_prefix_ops(krb5_context context, const char *name, const krb5_cc_ops *ops)
543 o = krb5_cc_get_prefix_ops(context, name);
545 krb5_errx(context, 1, "found no match for prefix '%s'", name);
547 krb5_errx(context, 1, "ops for prefix '%s' is not "
552 test_cc_config(krb5_context context)
559 ret = krb5_cc_new_unique(context, "MEMORY", "bar", &id);
561 krb5_err(context, 1, ret, "krb5_cc_new_unique");
563 ret = krb5_parse_name(context, "lha@SU.SE", &p);
565 krb5_err(context, 1, ret, "krb5_parse_name");
567 ret = krb5_cc_initialize(context, id, p);
569 krb5_err(context, 1, ret, "krb5_cc_initialize");
582 ret = krb5_cc_set_config(context, id, p1, "FriendlyName", &data);
584 krb5_errx(context, 1, "krb5_cc_set_config: add");
586 ret = krb5_cc_get_config(context, id, p1, "FriendlyName", &data2);
588 krb5_errx(context, 1, "krb5_cc_get_config: first");
591 ret = krb5_cc_set_config(context, id, p1, "FriendlyName", &data);
593 krb5_errx(context, 1, "krb5_cc_set_config: add -second");
595 ret = krb5_cc_get_config(context, id, p1, "FriendlyName", &data2);
597 krb5_errx(context, 1, "krb5_cc_get_config: second");
600 ret = krb5_cc_set_config(context, id, p1, "FriendlyName", NULL);
602 krb5_errx(context, 1, "krb5_cc_set_config: delete");
604 ret = krb5_cc_get_config(context, id, p1, "FriendlyName", &data2);
606 krb5_errx(context, 1, "krb5_cc_get_config: non-existant");
609 krb5_cc_destroy(context, id);
610 krb5_free_principal(context, p);
633 krb5_context context;
654 ret = krb5_init_context(&context);
658 test_cache_remove(context, krb5_cc_type_file);
659 test_cache_remove(context, krb5_cc_type_memory);
661 test_cache_remove(context, krb5_cc_type_scc);
664 test_default_name(context);
665 test_mcache(context);
666 test_init_vs_destroy(context, krb5_cc_type_memory);
667 test_init_vs_destroy(context, krb5_cc_type_file);
669 test_init_vs_destroy(context, krb5_cc_type_api);
671 test_init_vs_destroy(context, krb5_cc_type_scc);
673 test_def_cc_name(context);
675 test_cache_iter_all(context);
677 test_cache_iter(context, krb5_cc_type_memory, 0);
680 krb5_cc_new_unique(context, krb5_cc_type_memory, "bar", &id1);
681 krb5_cc_new_unique(context, krb5_cc_type_memory, "baz", &id2);
682 krb5_parse_name(context, "lha@SU.SE", &p);
683 krb5_cc_initialize(context, id1, p);
684 krb5_free_principal(context, p);
687 test_cache_find(context, "lha@SU.SE", 1);
688 test_cache_find(context, "hulabundulahotentot@SU.SE", 0);
690 test_cache_iter(context, krb5_cc_type_memory, 0);
691 test_cache_iter(context, krb5_cc_type_memory, 1);
692 test_cache_iter(context, krb5_cc_type_memory, 0);
693 test_cache_iter(context, krb5_cc_type_file, 0);
694 test_cache_iter(context, krb5_cc_type_api, 0);
695 test_cache_iter(context, krb5_cc_type_scc, 0);
696 test_cache_iter(context, krb5_cc_type_scc, 1);
698 test_copy(context, krb5_cc_type_file, krb5_cc_type_file);
699 test_copy(context, krb5_cc_type_memory, krb5_cc_type_memory);
700 test_copy(context, krb5_cc_type_file, krb5_cc_type_memory);
701 test_copy(context, krb5_cc_type_memory, krb5_cc_type_file);
702 test_copy(context, krb5_cc_type_scc, krb5_cc_type_file);
703 test_copy(context, krb5_cc_type_file, krb5_cc_type_scc);
704 test_copy(context, krb5_cc_type_scc, krb5_cc_type_memory);
705 test_copy(context, krb5_cc_type_memory, krb5_cc_type_scc);
707 test_move(context, krb5_cc_type_file);
708 test_move(context, krb5_cc_type_memory);
710 test_move(context, krb5_cc_type_kcm);
712 test_move(context, krb5_cc_type_scc);
714 test_prefix_ops(context, "FILE:/tmp/foo", &krb5_fcc_ops);
715 test_prefix_ops(context, "FILE", &krb5_fcc_ops);
716 test_prefix_ops(context, "MEMORY", &krb5_mcc_ops);
717 test_prefix_ops(context, "MEMORY:foo", &krb5_mcc_ops);
718 test_prefix_ops(context, "/tmp/kaka", &krb5_fcc_ops);
720 test_prefix_ops(context, "SCC:", &krb5_scc_ops);
721 test_prefix_ops(context, "SCC:foo", &krb5_scc_ops);
724 krb5_cc_destroy(context, id1);
725 krb5_cc_destroy(context, id2);
727 test_cc_config(context);
729 krb5_free_context(context);