diff options
author | Stephen Gallagher <sgallagh@redhat.com> | 2013-08-21 12:44:47 -0400 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-08-22 19:29:08 +0200 |
commit | 8340ca480e0fe823441633720d67efc9e4a4bc64 (patch) | |
tree | 0913f1a34803b2684c8adfa207c6086f40991226 | |
parent | 628f47f0faa5ce5dc0b3790b0dd2f987dddcab19 (diff) | |
download | sssd-8340ca480e0fe823441633720d67efc9e4a4bc64.tar.gz sssd-8340ca480e0fe823441633720d67efc9e4a4bc64.tar.bz2 sssd-8340ca480e0fe823441633720d67efc9e4a4bc64.zip |
KRB5: Add new #define for collection cache types
Kerberos now supports multiple types of collection caches, not just
DIR: caches. We should add a macro for generic collection behavior
and use that where appropriate.
-rw-r--r-- | src/providers/krb5/krb5_child.c | 16 | ||||
-rw-r--r-- | src/providers/krb5/krb5_common.c | 4 | ||||
-rw-r--r-- | src/providers/krb5/krb5_utils.c | 12 | ||||
-rw-r--r-- | src/providers/krb5/krb5_utils.h | 4 | ||||
-rw-r--r-- | src/tests/krb5_child-test.c | 4 | ||||
-rw-r--r-- | src/tests/krb5_utils-tests.c | 8 | ||||
-rw-r--r-- | src/util/sss_krb5.c | 16 | ||||
-rw-r--r-- | src/util/sss_krb5.h | 6 |
8 files changed, 35 insertions, 35 deletions
diff --git a/src/providers/krb5/krb5_child.c b/src/providers/krb5/krb5_child.c index 4ba0f366..8fce600f 100644 --- a/src/providers/krb5/krb5_child.c +++ b/src/providers/krb5/krb5_child.c @@ -436,7 +436,7 @@ done: return kerr; } -#ifdef HAVE_KRB5_DIRCACHE +#ifdef HAVE_KRB5_CC_COLLECTION static bool need_switch_to_principal(krb5_context ctx, krb5_principal princ) { krb5_error_code kerr; @@ -497,7 +497,7 @@ done: return ret; } -#endif /* HAVE_KRB5_DIRCACHE */ +#endif /* HAVE_KRB5_CC_COLLECTION */ static krb5_error_code store_creds_in_ccache(krb5_context ctx, krb5_principal princ, @@ -528,7 +528,7 @@ store_creds_in_ccache(krb5_context ctx, krb5_principal princ, goto done; } -#ifdef HAVE_KRB5_DIRCACHE +#ifdef HAVE_KRB5_CC_COLLECTION if (need_switch_to_principal(ctx, princ)) { kerr = krb5_cc_switch(ctx, cc); if (kerr != 0) { @@ -536,7 +536,7 @@ store_creds_in_ccache(krb5_context ctx, krb5_principal princ, goto done; } } -#endif /* HAVE_KRB5_DIRCACHE */ +#endif /* HAVE_KRB5_CC_COLLECTION */ kerr = krb5_cc_close(ctx, cc); if (kerr != 0) { @@ -654,7 +654,7 @@ done: return kerr; } -#ifdef HAVE_KRB5_DIRCACHE +#ifdef HAVE_KRB5_CC_COLLECTION static errno_t create_ccdir(const char *dirname, uid_t uid, gid_t gid) @@ -781,7 +781,7 @@ done: return kerr; } -#endif /* HAVE_KRB5_DIRCACHE */ +#endif /* HAVE_KRB5_CC_COLLECTION */ static krb5_error_code create_ccache(uid_t uid, gid_t gid, krb5_context ctx, @@ -793,10 +793,10 @@ create_ccache(uid_t uid, gid_t gid, krb5_context ctx, switch (cctype) { case SSS_KRB5_TYPE_FILE: return create_ccache_file(ctx, princ, ccname, creds); -#ifdef HAVE_KRB5_DIRCACHE +#ifdef HAVE_KRB5_CC_COLLECTION case SSS_KRB5_TYPE_DIR: return create_ccache_in_dir(uid, gid, ctx, princ, ccname, creds); -#endif /* HAVE_KRB5_DIRCACHE */ +#endif /* HAVE_KRB5_CC_COLLECTION */ default: DEBUG(SSSDBG_CRIT_FAILURE, ("Unknown cache type\n")); return EINVAL; diff --git a/src/providers/krb5/krb5_common.c b/src/providers/krb5/krb5_common.c index 0e1c10be..e56dc624 100644 --- a/src/providers/krb5/krb5_common.c +++ b/src/providers/krb5/krb5_common.c @@ -210,12 +210,12 @@ errno_t check_and_export_options(struct dp_option *opts, } break; -#ifdef HAVE_KRB5_DIRCACHE +#ifdef HAVE_KRB5_CC_COLLECTION case SSS_KRB5_TYPE_DIR: DEBUG(SSSDBG_CONF_SETTINGS, ("ccache is of type DIR\n")); krb5_ctx->cc_be = &dir_cc; break; -#endif +#endif /* HAVE_KRB5_CC_COLLECTION */ default: DEBUG(SSSDBG_OP_FAILURE, ("Unknown ccname database\n")); diff --git a/src/providers/krb5/krb5_utils.c b/src/providers/krb5/krb5_utils.c index 1b6d57c6..675a6b71 100644 --- a/src/providers/krb5/krb5_utils.c +++ b/src/providers/krb5/krb5_utils.c @@ -715,11 +715,11 @@ get_cc_be_ops(enum sss_krb5_cc_type type) be = &file_cc; break; -#ifdef HAVE_KRB5_DIRCACHE +#ifdef HAVE_KRB5_CC_COLLECTION case SSS_KRB5_TYPE_DIR: be = &dir_cc; break; -#endif /* HAVE_KRB5_DIRCACHE */ +#endif /* HAVE_KRB5_CC_COLLECTION */ case SSS_KRB5_TYPE_UNKNOWN: be = NULL; @@ -792,11 +792,11 @@ cc_residual_is_used(uid_t uid, const char *ccname, } switch (type) { -#ifdef HAVE_KRB5_DIRCACHE +#ifdef HAVE_KRB5_CC_COLLECTION case SSS_KRB5_TYPE_DIR: ret = S_ISDIR(stat_buf.st_mode); break; -#endif /* HAVE_KRB5_DIRCACHE */ +#endif /* HAVE_KRB5_CC_COLLECTION */ case SSS_KRB5_TYPE_FILE: ret = S_ISREG(stat_buf.st_mode); break; @@ -952,7 +952,7 @@ struct sss_krb5_cc_be file_cc = { .remove = cc_file_remove, }; -#ifdef HAVE_KRB5_DIRCACHE +#ifdef HAVE_KRB5_CC_COLLECTION /*======== Operations on the DIR: back end ========*/ errno_t cc_dir_create(const char *location, pcre *illegal_re, @@ -1190,7 +1190,7 @@ struct sss_krb5_cc_be dir_cc = { .remove = cc_dir_remove }; -#endif /* HAVE_KRB5_DIRCACHE */ +#endif /* HAVE_KRB5_CC_COLLECTION */ errno_t get_domain_or_subdomain(TALLOC_CTX *mem_ctx, struct be_ctx *be_ctx, char *domain_name, diff --git a/src/providers/krb5/krb5_utils.h b/src/providers/krb5/krb5_utils.h index 2e1bec71..4a5904cd 100644 --- a/src/providers/krb5/krb5_utils.h +++ b/src/providers/krb5/krb5_utils.h @@ -84,14 +84,14 @@ errno_t become_user(uid_t uid, gid_t gid); errno_t get_ccache_file_data(const char *ccache_file, const char *client_name, struct tgt_times *tgtt); -#ifdef HAVE_KRB5_DIRCACHE +#ifdef HAVE_KRB5_CC_COLLECTION extern struct sss_krb5_cc_be dir_cc; errno_t cc_dir_create(const char *location, pcre *illegal_re, uid_t uid, gid_t gid, bool private_path); -#endif /* HAVE_KRB5_DIRCACHE */ +#endif /* HAVE_KRB5_CC_COLLECTION */ errno_t get_domain_or_subdomain(TALLOC_CTX *mem_ctx, struct be_ctx *be_ctx, char *domain_name, diff --git a/src/tests/krb5_child-test.c b/src/tests/krb5_child-test.c index 423f8bb8..24d07728 100644 --- a/src/tests/krb5_child-test.c +++ b/src/tests/krb5_child-test.c @@ -267,11 +267,11 @@ create_dummy_req(TALLOC_CTX *mem_ctx, const char *user, case SSS_KRB5_TYPE_FILE: kr->krb5_ctx->cc_be = &file_cc; break; -#ifdef HAVE_KRB5_DIRCACHE +#ifdef HAVE_KRB5_CC_COLLECTION case SSS_KRB5_TYPE_DIR: kr->krb5_ctx->cc_be = &dir_cc; break; -#endif /* HAVE_KRB5_DIRCACHE */ +#endif /* HAVE_KRB5_CC_COLLECTION */ default: if (tmpl[0] != '/') { DEBUG(SSSDBG_OP_FAILURE, ("Unkown ccname database\n")); diff --git a/src/tests/krb5_utils-tests.c b/src/tests/krb5_utils-tests.c index fdfe00ac..4be3ad04 100644 --- a/src/tests/krb5_utils-tests.c +++ b/src/tests/krb5_utils-tests.c @@ -357,7 +357,7 @@ START_TEST(test_illegal_patterns) } END_TEST -#ifdef HAVE_KRB5_DIRCACHE +#ifdef HAVE_KRB5_CC_COLLECTION START_TEST(test_cc_dir_create) { char *residual; @@ -408,7 +408,7 @@ START_TEST(test_cc_dir_create) free(cwd); } END_TEST -#endif /* HAVE_KRB5_DIRCACHE */ +#endif /* HAVE_KRB5_CC_COLLECTION */ void setup_talloc_context(void) @@ -744,9 +744,9 @@ Suite *krb5_utils_suite (void) tcase_add_checked_fixture (tc_create_dir, setup_create_dir, teardown_create_dir); tcase_add_test (tc_create_dir, test_illegal_patterns); -#ifdef HAVE_KRB5_DIRCACHE +#ifdef HAVE_KRB5_CC_COLLECTION tcase_add_test (tc_create_dir, test_cc_dir_create); -#endif /* HAVE_KRB5_DIRCACHE */ +#endif /* HAVE_KRB5_CC_COLLECTION */ if (getuid() == 0) { tcase_add_test (tc_create_dir, test_priv_ccache_dir); tcase_add_test (tc_create_dir, test_private_ccache_dir_in_user_dir); diff --git a/src/util/sss_krb5.c b/src/util/sss_krb5.c index b871b13c..77234b98 100644 --- a/src/util/sss_krb5.c +++ b/src/util/sss_krb5.c @@ -939,12 +939,12 @@ sss_krb5_get_type(const char *full_location) sizeof(SSS_KRB5_FILE)-1) == 0) { return SSS_KRB5_TYPE_FILE; } -#ifdef HAVE_KRB5_DIRCACHE +#ifdef HAVE_KRB5_CC_COLLECTION else if (strncmp(full_location, SSS_KRB5_DIR, sizeof(SSS_KRB5_DIR)-1) == 0) { return SSS_KRB5_TYPE_DIR; } -#endif /* HAVE_KRB5_DIRCACHE */ +#endif /* HAVE_KRB5_CC_COLLECTION */ else if (full_location[0] == '/') { return SSS_KRB5_TYPE_FILE; } @@ -968,11 +968,11 @@ sss_krb5_residual_by_type(const char *full_location, offset = sizeof(SSS_KRB5_FILE)-1; } break; -#ifdef HAVE_KRB5_DIRCACHE +#ifdef HAVE_KRB5_CC_COLLECTION case SSS_KRB5_TYPE_DIR: offset = sizeof(SSS_KRB5_DIR)-1; break; -#endif /* HAVE_KRB5_DIRCACHE */ +#endif /* HAVE_KRB5_CC_COLLECTION */ default: return NULL; } @@ -992,14 +992,14 @@ sss_krb5_cc_file_path(const char *full_location) switch(cc_type) { case SSS_KRB5_TYPE_FILE: return residual; -#ifdef HAVE_KRB5_DIRCACHE +#ifdef HAVE_KRB5_CC_COLLECTION case SSS_KRB5_TYPE_DIR: /* DIR::/run/user/tkt_foo */ if (residual[0] == ':') { ++residual; } return residual; -#endif +#endif /* HAVE_KRB5_CC_COLLECTION */ case SSS_KRB5_TYPE_UNKNOWN: break; } @@ -1185,7 +1185,7 @@ char * sss_get_ccache_name_for_principal(TALLOC_CTX *mem_ctx, krb5_principal principal, const char *location) { -#ifdef HAVE_KRB5_DIRCACHE +#ifdef HAVE_KRB5_CC_COLLECTION krb5_error_code kerr; krb5_ccache tmp_cc = NULL; char *tmp_ccname = NULL; @@ -1229,5 +1229,5 @@ done: return ret_ccname; #else return NULL; -#endif /* HAVE_KRB5_DIRCACHE */ +#endif /* HAVE_KRB5_CC_COLLECTION */ } diff --git a/src/util/sss_krb5.h b/src/util/sss_krb5.h index 601a8acf..1c10d471 100644 --- a/src/util/sss_krb5.h +++ b/src/util/sss_krb5.h @@ -45,7 +45,7 @@ #define KEYTAB_CLEAN_NAME keytab_name ? keytab_name : "default" #if defined HAVE_KRB5_CC_CACHE_MATCH && defined HAVE_KRB5_CC_GET_FULL_NAME -#define HAVE_KRB5_DIRCACHE 1 +#define HAVE_KRB5_CC_COLLECTION 1 #endif const char * KRB5_CALLCONV sss_krb5_get_error_message (krb5_context, @@ -145,9 +145,9 @@ void sss_krb5_get_init_creds_opt_set_canonicalize(krb5_get_init_creds_opt *opts, enum sss_krb5_cc_type { SSS_KRB5_TYPE_FILE, -#ifdef HAVE_KRB5_DIRCACHE +#ifdef HAVE_KRB5_CC_COLLECTION SSS_KRB5_TYPE_DIR, -#endif /* HAVE_KRB5_DIRCACHE */ +#endif /* HAVE_KRB5_CC_COLLECTION */ SSS_KRB5_TYPE_UNKNOWN }; |