From 8340ca480e0fe823441633720d67efc9e4a4bc64 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Wed, 21 Aug 2013 12:44:47 -0400 Subject: 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. --- src/providers/krb5/krb5_child.c | 16 ++++++++-------- src/providers/krb5/krb5_common.c | 4 ++-- src/providers/krb5/krb5_utils.c | 12 ++++++------ src/providers/krb5/krb5_utils.h | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-) (limited to 'src/providers') 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, -- cgit