remove trailing whitespace
[heimdal.git] / lib / krb5 / test_cc.c
bloba800c69a93ed8c77f5fa83403dbb9e8a6687bd2a
1 /*
2 * Copyright (c) 2003 - 2007 Kungliga Tekniska Högskolan
3 * (Royal Institute of Technology, Stockholm, Sweden).
4 * All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of KTH nor the names of its contributors may be
18 * used to endorse or promote products derived from this software without
19 * specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY KTH AND ITS CONTRIBUTORS ``AS IS'' AND ANY
22 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KTH OR ITS CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
28 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
33 #include "krb5_locl.h"
34 #include <getarg.h>
35 #include <err.h>
37 static int debug_flag = 0;
38 static int version_flag = 0;
39 static int help_flag = 0;
41 #ifdef KRB5_USE_PATH_TOKENS
42 #define TEST_CC_NAME "%{TEMP}/krb5-cc-test-foo"
43 #else
44 #define TEST_CC_NAME "/tmp/krb5-cc-test-foo"
45 #endif
47 static void
48 test_default_name(krb5_context context)
50 krb5_error_code ret;
51 const char *p, *test_cc_name = TEST_CC_NAME;
52 char *p1, *p2, *p3;
54 p = krb5_cc_default_name(context);
55 if (p == NULL)
56 krb5_errx (context, 1, "krb5_cc_default_name 1 failed");
57 p1 = estrdup(p);
59 ret = krb5_cc_set_default_name(context, NULL);
60 if (p == NULL)
61 krb5_errx (context, 1, "krb5_cc_set_default_name failed");
63 p = krb5_cc_default_name(context);
64 if (p == NULL)
65 krb5_errx (context, 1, "krb5_cc_default_name 2 failed");
66 p2 = estrdup(p);
68 if (strcmp(p1, p2) != 0)
69 krb5_errx (context, 1, "krb5_cc_default_name no longer same");
71 ret = krb5_cc_set_default_name(context, test_cc_name);
72 if (p == NULL)
73 krb5_errx (context, 1, "krb5_cc_set_default_name 1 failed");
75 p = krb5_cc_default_name(context);
76 if (p == NULL)
77 krb5_errx (context, 1, "krb5_cc_default_name 2 failed");
78 p3 = estrdup(p);
80 #ifndef KRB5_USE_PATH_TOKENS
81 /* If we are using path tokens, we don't expect the p3 and
82 test_cc_name to match since p3 is going to have expanded
83 tokens. */
84 if (strcmp(p3, test_cc_name) != 0)
85 krb5_errx (context, 1, "krb5_cc_set_default_name 1 failed");
86 #endif
88 free(p1);
89 free(p2);
90 free(p3);
94 * Check that a closed cc still keeps it data and that it's no longer
95 * there when it's destroyed.
98 static void
99 test_mcache(krb5_context context)
101 krb5_error_code ret;
102 krb5_ccache id, id2;
103 const char *nc, *tc;
104 char *c;
105 krb5_principal p, p2;
107 ret = krb5_parse_name(context, "lha@SU.SE", &p);
108 if (ret)
109 krb5_err(context, 1, ret, "krb5_parse_name");
111 ret = krb5_cc_new_unique(context, krb5_cc_type_memory, NULL, &id);
112 if (ret)
113 krb5_err(context, 1, ret, "krb5_cc_new_unique");
115 ret = krb5_cc_initialize(context, id, p);
116 if (ret)
117 krb5_err(context, 1, ret, "krb5_cc_initialize");
119 nc = krb5_cc_get_name(context, id);
120 if (nc == NULL)
121 krb5_errx(context, 1, "krb5_cc_get_name");
123 tc = krb5_cc_get_type(context, id);
124 if (tc == NULL)
125 krb5_errx(context, 1, "krb5_cc_get_name");
127 if (asprintf(&c, "%s:%s", tc, nc) < 0 || c == NULL)
128 errx(1, "malloc");
130 krb5_cc_close(context, id);
132 ret = krb5_cc_resolve(context, c, &id2);
133 if (ret)
134 krb5_err(context, 1, ret, "krb5_cc_resolve");
136 ret = krb5_cc_get_principal(context, id2, &p2);
137 if (ret)
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);
148 if (ret)
149 krb5_err(context, 1, ret, "krb5_cc_resolve");
151 ret = krb5_cc_get_principal(context, id2, &p2);
152 if (ret == 0)
153 krb5_errx(context, 1, "krb5_cc_get_principal");
155 krb5_cc_destroy(context, id2);
156 free(c);
160 * Test that init works on a destroyed cc.
163 static void
164 test_init_vs_destroy(krb5_context context, const char *type)
166 krb5_error_code ret;
167 krb5_ccache id, id2;
168 krb5_principal p, p2;
169 char *n = NULL;
171 ret = krb5_parse_name(context, "lha@SU.SE", &p);
172 if (ret)
173 krb5_err(context, 1, ret, "krb5_parse_name");
175 ret = krb5_cc_new_unique(context, type, NULL, &id);
176 if (ret)
177 krb5_err(context, 1, ret, "krb5_cc_new_unique");
179 if (asprintf(&n, "%s:%s",
180 krb5_cc_get_type(context, id),
181 krb5_cc_get_name(context, id)) < 0 || n == NULL)
182 errx(1, "malloc");
185 ret = krb5_cc_resolve(context, n, &id2);
186 free(n);
187 if (ret)
188 krb5_err(context, 1, ret, "krb5_cc_resolve");
190 krb5_cc_destroy(context, id);
192 ret = krb5_cc_initialize(context, id2, p);
193 if (ret)
194 krb5_err(context, 1, ret, "krb5_cc_initialize");
196 ret = krb5_cc_get_principal(context, id2, &p2);
197 if (ret)
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);
205 static void
206 test_cache_remove(krb5_context context, const char *type)
208 krb5_error_code ret;
209 krb5_ccache id;
210 krb5_principal p;
211 krb5_creds cred;
213 ret = krb5_parse_name(context, "lha@SU.SE", &p);
214 if (ret)
215 krb5_err(context, 1, ret, "krb5_parse_name");
217 ret = krb5_cc_new_unique(context, type, NULL, &id);
218 if (ret)
219 krb5_err(context, 1, ret, "krb5_cc_gen_new");
221 ret = krb5_cc_initialize(context, id, p);
222 if (ret)
223 krb5_err(context, 1, ret, "krb5_cc_initialize");
225 /* */
226 memset(&cred, 0, sizeof(cred));
227 ret = krb5_parse_name(context, "krbtgt/SU.SE@SU.SE", &cred.server);
228 if (ret)
229 krb5_err(context, 1, ret, "krb5_parse_name");
230 ret = krb5_parse_name(context, "lha@SU.SE", &cred.client);
231 if (ret)
232 krb5_err(context, 1, ret, "krb5_parse_name");
234 ret = krb5_cc_store_cred(context, id, &cred);
235 if (ret)
236 krb5_err(context, 1, ret, "krb5_cc_store_cred");
238 ret = krb5_cc_remove_cred(context, id, 0, &cred);
239 if (ret)
240 krb5_err(context, 1, ret, "krb5_cc_remove_cred");
242 ret = krb5_cc_destroy(context, id);
243 if (ret)
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);
251 static void
252 test_mcc_default(void)
254 krb5_context context;
255 krb5_error_code ret;
256 krb5_ccache id, id2;
257 int i;
259 for (i = 0; i < 10; i++) {
261 ret = krb5_init_context(&context);
262 if (ret)
263 krb5_err(context, 1, ret, "krb5_init_context");
265 ret = krb5_cc_set_default_name(context, "MEMORY:foo");
266 if (ret)
267 krb5_err(context, 1, ret, "krb5_cc_set_default_name");
269 ret = krb5_cc_default(context, &id);
270 if (ret)
271 krb5_err(context, 1, ret, "krb5_cc_default");
273 ret = krb5_cc_default(context, &id2);
274 if (ret)
275 krb5_err(context, 1, ret, "krb5_cc_default");
277 ret = krb5_cc_close(context, id);
278 if (ret)
279 krb5_err(context, 1, ret, "krb5_cc_close");
281 ret = krb5_cc_close(context, id2);
282 if (ret)
283 krb5_err(context, 1, ret, "krb5_cc_close");
285 krb5_free_context(context);
289 struct {
290 char *str;
291 int fail;
292 char *res;
293 } cc_names[] = {
294 { "foo", 0, "foo" },
295 { "foo%}", 0, "foo%}" },
296 { "%{uid}", 0 },
297 { "foo%{null}", 0, "foo" },
298 { "foo%{null}bar", 0, "foobar" },
299 { "%{", 1 },
300 { "%{foo %{", 1 },
301 { "%{{", 1 },
302 { "%{{}", 1 },
303 { "%{nulll}", 1 },
304 { "%{does not exist}", 1 },
305 { "%{}", 1 },
306 #ifdef KRB5_USE_PATH_TOKENS
307 { "%{APPDATA}", 0 },
308 { "%{COMMON_APPDATA}", 0},
309 { "%{LOCAL_APPDATA}", 0},
310 { "%{SYSTEM}", 0},
311 { "%{WINDOWS}", 0},
312 { "%{TEMP}", 0},
313 { "%{USERID}", 0},
314 { "%{uid}", 0},
315 { "%{USERCONFIG}", 0},
316 { "%{COMMONCONFIG}", 0},
317 { "%{LIBDIR}", 0},
318 { "%{BINDIR}", 0},
319 { "%{LIBEXEC}", 0},
320 { "%{SBINDIR}", 0},
321 #endif
324 static void
325 test_def_cc_name(krb5_context context)
327 krb5_error_code ret;
328 char *str;
329 int i;
331 for (i = 0; i < sizeof(cc_names)/sizeof(cc_names[0]); i++) {
332 ret = _krb5_expand_default_cc_name(context, cc_names[i].str, &str);
333 if (ret) {
334 if (cc_names[i].fail == 0)
335 krb5_errx(context, 1, "test %d \"%s\" failed",
336 i, cc_names[i].str);
337 } else {
338 if (cc_names[i].fail)
339 krb5_errx(context, 1, "test %d \"%s\" was successful",
340 i, cc_names[i].str);
341 if (cc_names[i].res && strcmp(cc_names[i].res, str) != 0)
342 krb5_errx(context, 1, "test %d %s != %s",
343 i, cc_names[i].res, str);
344 if (debug_flag)
345 printf("%s => %s\n", cc_names[i].str, str);
346 free(str);
351 static void
352 test_cache_find(krb5_context context, const char *principal, int find)
354 krb5_principal client;
355 krb5_error_code ret;
356 krb5_ccache id = NULL;
358 ret = krb5_parse_name(context, principal, &client);
359 if (ret)
360 krb5_err(context, 1, ret, "parse_name for %s failed", principal);
362 ret = krb5_cc_cache_match(context, client, &id);
363 if (ret && find)
364 krb5_err(context, 1, ret, "cc_cache_match for %s failed", principal);
365 if (ret == 0 && !find)
366 krb5_err(context, 1, ret, "cc_cache_match for %s found", principal);
368 if (id)
369 krb5_cc_close(context, id);
370 krb5_free_principal(context, client);
374 static void
375 test_cache_iter(krb5_context context, const char *type, int destroy)
377 krb5_cc_cache_cursor cursor;
378 krb5_error_code ret;
379 krb5_ccache id;
381 ret = krb5_cc_cache_get_first (context, type, &cursor);
382 if (ret == KRB5_CC_NOSUPP)
383 return;
384 else if (ret)
385 krb5_err(context, 1, ret, "krb5_cc_cache_get_first(%s)", type);
388 while ((ret = krb5_cc_cache_next (context, cursor, &id)) == 0) {
389 krb5_principal principal;
390 char *name;
392 if (debug_flag)
393 printf("name: %s\n", krb5_cc_get_name(context, id));
394 ret = krb5_cc_get_principal(context, id, &principal);
395 if (ret == 0) {
396 ret = krb5_unparse_name(context, principal, &name);
397 if (ret == 0) {
398 if (debug_flag)
399 printf("\tprincipal: %s\n", name);
400 free(name);
402 krb5_free_principal(context, principal);
404 if (destroy)
405 krb5_cc_destroy(context, id);
406 else
407 krb5_cc_close(context, id);
410 krb5_cc_cache_end_seq_get(context, cursor);
413 static void
414 test_cache_iter_all(krb5_context context)
416 krb5_cccol_cursor cursor;
417 krb5_error_code ret;
418 krb5_ccache id;
420 ret = krb5_cccol_cursor_new (context, &cursor);
421 if (ret)
422 krb5_err(context, 1, ret, "krb5_cccol_cursor_new");
425 while ((ret = krb5_cccol_cursor_next (context, cursor, &id)) == 0 && id != NULL) {
426 krb5_principal principal;
427 char *name;
429 if (debug_flag)
430 printf("name: %s\n", krb5_cc_get_name(context, id));
431 ret = krb5_cc_get_principal(context, id, &principal);
432 if (ret == 0) {
433 ret = krb5_unparse_name(context, principal, &name);
434 if (ret == 0) {
435 if (debug_flag)
436 printf("\tprincipal: %s\n", name);
437 free(name);
439 krb5_free_principal(context, principal);
441 krb5_cc_close(context, id);
444 krb5_cccol_cursor_free(context, &cursor);
448 static void
449 test_copy(krb5_context context, const char *from, const char *to)
451 krb5_ccache fromid, toid;
452 krb5_error_code ret;
453 krb5_principal p, p2;
455 ret = krb5_parse_name(context, "lha@SU.SE", &p);
456 if (ret)
457 krb5_err(context, 1, ret, "krb5_parse_name");
459 ret = krb5_cc_new_unique(context, from, NULL, &fromid);
460 if (ret)
461 krb5_err(context, 1, ret, "krb5_cc_new_unique");
463 ret = krb5_cc_initialize(context, fromid, p);
464 if (ret)
465 krb5_err(context, 1, ret, "krb5_cc_initialize");
467 ret = krb5_cc_new_unique(context, to, NULL, &toid);
468 if (ret)
469 krb5_err(context, 1, ret, "krb5_cc_gen_new");
471 ret = krb5_cc_copy_cache(context, fromid, toid);
472 if (ret)
473 krb5_err(context, 1, ret, "krb5_cc_copy_cache");
475 ret = krb5_cc_get_principal(context, toid, &p2);
476 if (ret)
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);
489 static void
490 test_move(krb5_context context, const char *type)
492 const krb5_cc_ops *ops;
493 krb5_ccache fromid, toid;
494 krb5_error_code ret;
495 krb5_principal p, p2;
497 ops = krb5_cc_get_prefix_ops(context, type);
498 if (ops == NULL)
499 return;
501 ret = krb5_cc_new_unique(context, type, NULL, &fromid);
502 if (ret == KRB5_CC_NOSUPP)
503 return;
504 else if (ret)
505 krb5_err(context, 1, ret, "krb5_cc_new_unique");
507 ret = krb5_parse_name(context, "lha@SU.SE", &p);
508 if (ret)
509 krb5_err(context, 1, ret, "krb5_parse_name");
511 ret = krb5_cc_initialize(context, fromid, p);
512 if (ret)
513 krb5_err(context, 1, ret, "krb5_cc_initialize");
515 ret = krb5_cc_new_unique(context, type, NULL, &toid);
516 if (ret)
517 krb5_err(context, 1, ret, "krb5_cc_new_unique");
519 ret = krb5_cc_initialize(context, toid, p);
520 if (ret)
521 krb5_err(context, 1, ret, "krb5_cc_initialize");
523 ret = krb5_cc_get_principal(context, toid, &p2);
524 if (ret)
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);
538 static void
539 test_prefix_ops(krb5_context context, const char *name, const krb5_cc_ops *ops)
541 const krb5_cc_ops *o;
543 o = krb5_cc_get_prefix_ops(context, name);
544 if (o == NULL)
545 krb5_errx(context, 1, "found no match for prefix '%s'", name);
546 if (strcmp(o->prefix, ops->prefix) != 0)
547 krb5_errx(context, 1, "ops for prefix '%s' is not "
548 "the expected %s != %s", name, o->prefix, ops->prefix);
551 static void
552 test_cc_config(krb5_context context)
554 krb5_error_code ret;
555 krb5_principal p;
556 krb5_ccache id;
557 unsigned int i;
559 ret = krb5_cc_new_unique(context, "MEMORY", "bar", &id);
560 if (ret)
561 krb5_err(context, 1, ret, "krb5_cc_new_unique");
563 ret = krb5_parse_name(context, "lha@SU.SE", &p);
564 if (ret)
565 krb5_err(context, 1, ret, "krb5_parse_name");
567 ret = krb5_cc_initialize(context, id, p);
568 if (ret)
569 krb5_err(context, 1, ret, "krb5_cc_initialize");
571 for (i = 0; i < 1000; i++) {
572 krb5_data data, data2;
573 const char *name = "foo";
574 krb5_principal p1 = NULL;
576 if (i & 1)
577 p1 = p;
579 data.data = rk_UNCONST(name);
580 data.length = strlen(name);
582 ret = krb5_cc_set_config(context, id, p1, "FriendlyName", &data);
583 if (ret)
584 krb5_errx(context, 1, "krb5_cc_set_config: add");
586 ret = krb5_cc_get_config(context, id, p1, "FriendlyName", &data2);
587 if (ret)
588 krb5_errx(context, 1, "krb5_cc_get_config: first");
589 krb5_data_free(&data2);
591 ret = krb5_cc_set_config(context, id, p1, "FriendlyName", &data);
592 if (ret)
593 krb5_errx(context, 1, "krb5_cc_set_config: add -second");
595 ret = krb5_cc_get_config(context, id, p1, "FriendlyName", &data2);
596 if (ret)
597 krb5_errx(context, 1, "krb5_cc_get_config: second");
598 krb5_data_free(&data2);
600 ret = krb5_cc_set_config(context, id, p1, "FriendlyName", NULL);
601 if (ret)
602 krb5_errx(context, 1, "krb5_cc_set_config: delete");
604 ret = krb5_cc_get_config(context, id, p1, "FriendlyName", &data2);
605 if (ret == 0)
606 krb5_errx(context, 1, "krb5_cc_get_config: non-existant");
609 krb5_cc_destroy(context, id);
610 krb5_free_principal(context, p);
614 static struct getargs args[] = {
615 {"debug", 'd', arg_flag, &debug_flag,
616 "turn on debuggin", NULL },
617 {"version", 0, arg_flag, &version_flag,
618 "print version", NULL },
619 {"help", 0, arg_flag, &help_flag,
620 NULL, NULL }
623 static void
624 usage (int ret)
626 arg_printusage (args, sizeof(args)/sizeof(*args), NULL, "hostname ...");
627 exit (ret);
631 main(int argc, char **argv)
633 krb5_context context;
634 krb5_error_code ret;
635 int optidx = 0;
636 krb5_ccache id1, id2;
638 setprogname(argv[0]);
640 if(getarg(args, sizeof(args) / sizeof(args[0]), argc, argv, &optidx))
641 usage(1);
643 if (help_flag)
644 usage (0);
646 if(version_flag){
647 print_version(NULL);
648 exit(0);
651 argc -= optidx;
652 argv += optidx;
654 ret = krb5_init_context(&context);
655 if (ret)
656 errx (1, "krb5_init_context failed: %d", ret);
658 test_cache_remove(context, krb5_cc_type_file);
659 test_cache_remove(context, krb5_cc_type_memory);
660 #ifdef USE_SQLITE
661 test_cache_remove(context, krb5_cc_type_scc);
662 #endif
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);
668 #if 0
669 test_init_vs_destroy(context, krb5_cc_type_api);
670 #endif
671 test_init_vs_destroy(context, krb5_cc_type_scc);
672 test_mcc_default();
673 test_def_cc_name(context);
675 test_cache_iter_all(context);
677 test_cache_iter(context, krb5_cc_type_memory, 0);
679 krb5_principal p;
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);
709 #ifdef HAVE_KCM
710 test_move(context, krb5_cc_type_kcm);
711 #endif
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);
719 #ifdef HAVE_SCC
720 test_prefix_ops(context, "SCC:", &krb5_scc_ops);
721 test_prefix_ops(context, "SCC:foo", &krb5_scc_ops);
722 #endif
724 krb5_cc_destroy(context, id1);
725 krb5_cc_destroy(context, id2);
727 test_cc_config(context);
729 krb5_free_context(context);
731 #if 0
732 sleep(60);
733 #endif
735 return 0;