• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/MITKerberosShim-66/mittestcc/

Lines Matching refs:ccache

21         ccache_p *ccache = NULL;
23 err = cc_open(context, info[i]->name, info[i]->vers, 0, &ccache);
25 if (!err) { cc_destroy(context, &ccache); }
220 ccache_p *ccache = NULL;
228 * a ccache is created
229 * a ccache is destroyed
232 * a ccache principal is changed
245 // create a ccache
246 err = cc_create(context, "TEST_CCACHE", "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
248 log_error("failed to create a ccache - %s (%d)", translate_ccapi_error(err), err);
251 check_once_cc_get_change_time(context, &last_change_time, CC_NOERROR, "after creating a new ccache");
255 err = cc_set_principal(context, ccache, CC_CRED_V5, "foo@BAR.ORG");
257 log_error("failed to change ccache's principal - %s (%d)", translate_ccapi_error(err), err);
268 err = cc_store(context, ccache, creds_union);
279 err = cc_remove_cred(context, ccache, creds_union);
290 if (ccache) {
291 // destroy a ccache
292 err = cc_destroy(context, &ccache);
293 check_once_cc_get_change_time(context, &last_change_time, CC_NOERROR, "after destroying a ccache");
343 ccache_p *ccache = NULL;
350 // create a ccache
351 err = cc_create(context, name, "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
353 log_error("failed to create a ccache - %s (%d)", translate_ccapi_error(err), err);
357 err = cc_close(context, &ccache);
358 ccache = NULL;
361 // try default ccache
363 err = check_once_cc_open(context, name, CC_CRED_V5, &ccache, CC_NOERROR, NULL);
368 err = check_once_cc_open(context, name, CC_CRED_V4, &ccache, CC_ERR_CRED_VERSION, NULL);
371 err = check_once_cc_open(context, NULL, CC_CRED_V5, &ccache, CC_BAD_PARM, NULL);
373 err = check_once_cc_open(context, name, CC_CRED_UNKNOWN, &ccache, CC_ERR_CRED_VERSION, NULL);
383 cc_result check_once_cc_open(apiCB *context, const char *name, cc_int32 version, ccache_p **ccache, cc_result expected_err, const char *description) {
399 if (ccache != NULL) { // if we were passed NULL, then we're looking to pass a bad param
400 err = cc_open(context, name, version, 0, ccache);
409 check_if(*ccache == NULL, NULL);
412 err = cc_get_name(context, *ccache, &stored_name);
420 if (ccache && *ccache) {
421 cc_ccache_release(*ccache);
422 *ccache = NULL;
436 ccache_p *ccache = NULL;
444 err = cc_open(context, name, CC_CRED_V5, 0, &ccache);
446 err = cc_destroy (context, &ccache);
448 err = CC_NOERROR; /* ccache does not exist */
451 // try making a ccache with a unique name (the now destroyed cache's name)
453 err = check_once_cc_create(context, name, CC_CRED_V5, "foo@BAR.ORG", &ccache, CC_NOERROR, NULL);
456 // try making a ccache with a non-unique name (the existing cache's name)
458 err = check_once_cc_create(context, name, CC_CRED_V5, "foo/baz@BAR.ORG", &ccache, CC_NOERROR, NULL);
462 err = check_once_cc_create(context, NULL, CC_CRED_V5, "foo@BAR.ORG", &ccache, CC_BAD_PARM, "NULL name"); // NULL name
463 err = check_once_cc_create(context, "name", CC_CRED_MAX, "foo@BAR.ORG", &ccache, CC_ERR_CRED_VERSION, "invalid creds_vers"); // invalid creds_vers
464 err = check_once_cc_create(context, "name", CC_CRED_V5, NULL, &ccache, CC_BAD_PARM, "NULL principal"); // NULL principal
465 err = check_once_cc_create(context, "name", CC_CRED_V5, "foo@BAR.ORG", NULL, CC_BAD_PARM, "NULL ccache"); // NULL ccache
468 if (ccache) { cc_destroy(context, &ccache); }
476 cc_result check_once_cc_create(apiCB *context, const char *name, cc_int32 cred_vers, const char *principal, ccache_p **ccache, cc_int32 expected_err, const char *description) {
494 err = cc_create(context, name, principal, cred_vers, 0, ccache);
500 check_if(*ccache == NULL, NULL);
502 // make sure all of the ccache's info matches what we gave it
504 err = cc_get_name(context, *ccache, &stored_name);
508 err = cc_get_cred_version(context, *ccache, &stored_creds_vers);
511 err = cc_get_principal(context, *ccache, &stored_principal);
515 if (ccache && *ccache) {
516 cc_destroy(context, ccache);
517 *ccache = NULL;
531 ccache_p *ccache = NULL;
539 err = cc_create(context, name, "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
543 check_once_cc_close(context, ccache, CC_NOERROR, NULL);
544 ccache = NULL;
554 cc_result check_once_cc_close(apiCB *context, ccache_p *ccache, cc_result expected_err, const char *description) {
564 err = cc_get_name(context, ccache, &name);
565 err = cc_close(context, &ccache);
566 ccache = NULL;
575 if (!err && name) { // try opening released ccache to make sure it still exists
576 err = cc_open(context, name, CC_CRED_V5, 0, &ccache);
578 check_if(err == CC_NO_EXIST, "released ccache was actually destroyed instead");
579 check_if(err != CC_NOERROR, "released ccache cannot be opened");
581 if (ccache) { cc_destroy(context, &ccache); }
594 ccache_p *ccache = NULL;
602 err = cc_create(context, name, "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
606 check_once_cc_destroy(context, ccache, CC_NOERROR, NULL);
607 ccache = NULL;
617 cc_result check_once_cc_destroy(apiCB *context, ccache_p *ccache, cc_int32 expected_err, const char *description) {
633 err = cc_get_name(context, ccache, &name);
634 err = cc_destroy(context, &ccache);
635 ccache = NULL;
640 if (!err && name) { // try opening released ccache to make sure it still exists
641 err = cc_open(context, name, CC_CRED_V5, 0, &ccache);
643 check_if(err != CC_NO_EXIST, "destroyed ccache was actually released instead");
645 if (ccache) { cc_destroy(context, &ccache); }
660 ccache_p *ccache = NULL;
669 err = cc_create(context, name, "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
672 check_once_cc_get_cred_version(context, ccache, CC_CRED_V5, CC_NOERROR, "v5 creds");
679 if (ccache) {
680 cc_destroy(context, &ccache);
681 ccache = NULL;
688 err = cc_create(context, name, "foo@BAR.ORG", CC_CRED_V4, 0, &ccache);
691 check_once_cc_get_cred_version(context, ccache, CC_CRED_V4, CC_NOERROR, "v4 creds");
697 if (ccache) {
698 cc_destroy(context, &ccache);
699 ccache = NULL;
709 cc_result check_once_cc_get_cred_version(apiCB *context, ccache_p *ccache, cc_int32 expected_cred_vers, cc_int32 expected_err, const char *description) {
724 err = cc_get_cred_version(context, ccache, &stored_cred_vers);
743 ccache_p *ccache = NULL;
753 // try with unique ccache (which happens to be default)
755 err = cc_create(context, "0", "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
758 check_once_cc_get_name(context, ccache, "0", CC_NOERROR, "unique ccache (which happens to be default)");
764 if (ccache) {
765 cc_close(context, &ccache);
766 ccache = NULL;
769 // try with unique ccache (which is not default)
771 err = cc_context_create_ccache(context, "1", CC_CRED_V5, "foo@BAR.ORG", &ccache);
774 check_once_cc_get_name(context, ccache, "1", CC_NOERROR, "unique ccache (which is not default)");
783 check_once_cc_get_name(context, ccache, NULL, CC_BAD_PARM, "NULL param");
785 if (ccache) {
786 cc_close(context, &ccache);
787 ccache = NULL;
800 cc_int32 check_once_cc_get_name(apiCB *context, ccache_p *ccache, const char *expected_name, cc_int32 expected_err, const char *description) {
817 err = cc_get_name(context, ccache, NULL);
820 err = cc_get_name(context, ccache, &stored_name);
843 ccache_p *ccache = NULL;
857 err = cc_create(context, name_v5, "foo/BAR@BAZ.ORG", CC_CRED_V5, 0, &ccache);
860 check_once_cc_get_principal(context, ccache, "foo/BAR@BAZ.ORG", CC_NOERROR, "trying to get krb5 princ for krb5 ccache");
866 if (ccache) {
867 cc_close(context, &ccache);
868 ccache = NULL;
873 err = cc_create(context, name_v4, "foo.BAR@BAZ.ORG", CC_CRED_V4, 0, &ccache);
876 check_once_cc_get_principal(context, ccache, "foo.BAR@BAZ.ORG", CC_NOERROR, "trying to get krb4 princ for krb4 ccache");
885 check_once_cc_get_principal(context, ccache, NULL, CC_BAD_PARM, "passed null out param");
888 if (ccache) {
889 cc_close(context, &ccache);
890 ccache = NULL;
904 ccache_p *ccache,
923 err = cc_get_principal(context, ccache, NULL);
926 err = cc_get_principal(context, ccache, &stored_principal);
948 ccache_p *ccache = NULL;
962 err = cc_create(context, name_v5, "foo@BAZ.ORG", CC_CRED_V5, 0, &ccache);
965 check_once_cc_set_principal(context, ccache, CC_CRED_MAX, "foo/BAZ@BAR.ORG", CC_ERR_CRED_VERSION, "CC_CRED_MAX (not allowed)");
966 check_once_cc_set_principal(context, ccache, CC_CRED_V5, NULL, CC_BAD_PARM, "NULL principal");
972 if (ccache) {
973 cc_destroy(context, &ccache);
974 ccache = NULL;
977 // empty ccache
979 // replace v5 ccache's principal
981 err = cc_create(context, name_v5, "foo@BAZ.ORG", CC_CRED_V5, 0, &ccache);
984 check_once_cc_set_principal(context, ccache, CC_CRED_V5, "foo/BAZ@BAR.ORG", CC_NOERROR, "replace v5 only ccache's principal (empty ccache)");
985 check_once_cc_set_principal(context, ccache, CC_CRED_V4, "foo.BAZ@BAR.ORG", CC_ERR_CRED_VERSION, "replace v5 principal with v4");
991 if (ccache) {
992 cc_destroy(context, &ccache);
993 ccache = NULL;
996 // replace v4 ccache's principal
998 err = cc_create(context, name_v4, "foo@BAZ.ORG", CC_CRED_V4, 0, &ccache);
1001 check_once_cc_set_principal(context, ccache, CC_CRED_V4, "foo.BAZ@BAR.ORG", CC_NOERROR, "replace v4 only ccache's principal (empty ccache)");
1002 check_once_cc_set_principal(context, ccache, CC_CRED_V5, "foo/BAZ@BAR.ORG", CC_ERR_CRED_VERSION, "replace v4 principal with v5");
1008 if (ccache) {
1009 cc_destroy(context, &ccache);
1010 ccache = NULL;
1023 cc_int32 check_once_cc_set_principal(apiCB *context, ccache_p *ccache, cc_int32 cred_vers, const char *in_principal, cc_int32 expected_err, const char *description) {
1039 err = cc_set_principal(context, ccache, cred_vers, (char *) in_principal);
1045 err = cc_get_principal(context, ccache, &stored_principal);
1065 ccache_p *ccache = NULL;
1079 err = cc_create(context, "TEST_CC_STORE", "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
1087 check_once_cc_store(context, ccache, creds_union, CC_NOERROR, "ok creds");
1101 check_once_cc_store(context, ccache, creds_union, CC_BAD_PARM, "invalid creds (NULL client string)");
1113 check_once_cc_store(context, ccache, creds_union, CC_ERR_CRED_VERSION, "CC_CRED_MAX (invalid) into a ccache with only v5 princ");
1115 check_once_cc_store(context, ccache, creds_union, CC_ERR_CRED_VERSION, "v4 creds into a v5 ccache");
1122 // non-existent ccache
1123 if (ccache) {
1124 err = cc_get_name(context, ccache, &name);
1136 check_once_cc_store(context, ccache, creds_union, CC_NO_EXIST, "invalid ccache");
1142 if (ccache) { cc_close(context, &ccache); }
1153 cc_result check_once_cc_store(apiCB *context, ccache_p *ccache, const cred_union in_creds, cc_int32 expected_err, const char *description) {
1170 err = cc_store(context, ccache, in_creds);
1177 err = cc_seq_fetch_creds_begin(context, ccache, &iterator);
1191 check_if(found, "stored credentials not found in ccache");
1207 ccache_p *ccache = NULL;
1222 err = cc_create(context, "TEST_CC_REMOVE_CRED", "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
1230 err = cc_store(context, ccache, creds);
1238 err = cc_seq_fetch_creds_begin(context, ccache, &iterator);
1249 check_once_cc_remove_cred(context, ccache, *creds_array[i], CC_NOERROR, "10 ok creds");
1253 check_once_cc_remove_cred(context, ccache, *creds_array[0], CC_NOTFOUND, "removed same creds twice");
1255 // non-existent ccache
1256 if (ccache) {
1259 err = cc_get_name(context, ccache, &name);
1267 check_once_cc_remove_cred(context, ccache, *creds_array[0], CC_NO_EXIST, "invalid ccache");
1279 if (ccache) { cc_close(context, &ccache); }
1290 cc_result check_once_cc_remove_cred(apiCB *context, ccache_p *ccache, cred_union in_creds, cc_int32 expected_err, const char *description) {
1307 err = cc_remove_cred(context, ccache, in_creds);
1314 err = cc_seq_fetch_creds_begin(context, ccache, &iterator);
1329 check_if(found, "credentials not removed from ccache");
1345 ccache_p *ccache = NULL;
1358 err = cc_create(context, "TEST_CC_SEQ_FETCH_NCS_BEGIN", "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
1361 // try making when at least one ccache already exists (just to cover all our bases)
1362 check_once_cc_seq_fetch_NCs_begin(context, &iterator, CC_NOERROR, "when at least one ccache already exists");
1369 if (ccache ) { cc_close(context, &ccache); }
1406 ccache_p *ccache = NULL;
1428 // iterate with one ccache
1431 err = cc_create(context, "TEST_CC_SEQ_FETCH_NCS_NEXT", "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
1433 if (ccache) {
1434 cc_close(context, &ccache);
1435 ccache = NULL;
1440 check_once_cc_seq_fetch_NCs_next(context, iterator, 1, CC_NOERROR, "iterating over a collection of 1 ccache");
1456 err = cc_create(context, name, "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
1457 if (ccache) {
1458 cc_close(context, &ccache);
1459 ccache = NULL;
1466 check_once_cc_seq_fetch_NCs_next(context, iterator, 1000, CC_NOERROR, "iterating over a collection of 1000 ccache");
1473 if (ccache) { cc_close(context, &ccache); }
1497 ccache_p *ccache = NULL;
1503 err = cc_seq_fetch_NCs_next(context, &ccache, iterator);
1504 if (ccache) {
1506 cc_close(context, &ccache);
1507 ccache = NULL;
1529 ccache_p *ccache = NULL;
1543 // iterate with one ccache
1546 err = cc_create(context, "TEST_CC_GET_NC_INFO", "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
1548 if (ccache) {
1549 cc_close(context, &ccache);
1550 ccache = NULL;
1552 check_once_cc_get_NC_info(context, "TEST_CC_GET_NC_INFO", "foo@BAR.ORG", CC_CRED_V5, 1, CC_NOERROR, "iterating over a collection of 1 ccache");
1564 err = cc_create(context, name, "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
1565 if (ccache) {
1566 cc_close(context, &ccache);
1567 ccache = NULL;
1571 check_once_cc_get_NC_info(context, "TEST_CC_GET_NC_INFO", "foo@BAR.ORG", CC_CRED_V5, 1000, CC_NOERROR, "iterating over a collection of 1000 ccache");
1573 if (ccache) { cc_close(context, &ccache); }
1609 check_if(strncmp(info[actual_count]->name, expected_name_prefix, strlen(expected_name_prefix)), "got incorrect ccache name");
1630 ccache_p *ccache = NULL;
1644 err = cc_create(context, "TEST_CC_SEQ_FETCH_CREDS_BEGIN", "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
1649 check_once_cc_seq_fetch_creds_begin(context, ccache, &creds_iterator, CC_NOERROR, "valid params");
1658 check_once_cc_seq_fetch_creds_begin(context, ccache, NULL, CC_BAD_PARM, "NULL out iterator param");
1665 // non-existent ccache
1666 if (ccache) {
1667 err = cc_get_name(context, ccache, &name);
1676 check_once_cc_seq_fetch_creds_begin(context, ccache, &creds_iterator, CC_NO_EXIST, "invalid ccache");
1683 if (ccache) { cc_close(context, &ccache); }
1694 cc_result check_once_cc_seq_fetch_creds_begin(apiCB *context, ccache_p *ccache, ccache_cit **iterator, cc_result expected_err, const char *description) {
1708 err = cc_seq_fetch_creds_begin(context, ccache, iterator);
1723 ccache_p *ccache = NULL;
1738 err = cc_create(context, "TEST_CC_SEQ_FETCH_CREDS_NEXT", "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
1741 err = cc_seq_fetch_creds_begin(context, ccache, &iterator);
1743 check_once_cc_seq_fetch_creds_next(context, iterator, 0, CC_NOERROR, "iterating over an empty ccache");
1748 if (ccache) {
1749 cc_close(context, &ccache);
1750 ccache = NULL;
1756 err = cc_create(context, "TEST_CC_SEQ_FETCH_CREDS_NEXT", "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
1760 err = cc_store(context, ccache, creds_union);
1764 err = cc_seq_fetch_creds_begin(context, ccache, &iterator);
1766 check_once_cc_seq_fetch_creds_next(context, iterator, 1, CC_NOERROR, "iterating over a ccache with 1 cred");
1771 if (ccache) {
1772 cc_close(context, &ccache);
1773 ccache = NULL;
1779 err = cc_create(context, "TEST_CC_SEQ_FETCH_CREDS_NEXT", "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
1784 err = cc_store(context, ccache, creds_union);
1788 err = cc_seq_fetch_creds_begin(context, ccache, &iterator);
1790 check_once_cc_seq_fetch_creds_next(context, iterator, 1000, CC_NOERROR, "iterating over a ccache with 1000 creds");
1792 if (ccache) { cc_close(context, &ccache); }