diff options
author | Stephen Gallagher <sgallagh@redhat.com> | 2012-06-15 13:59:44 -0400 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2012-06-15 14:38:22 -0400 |
commit | 6ca87e797982061576885f944e2ccfaba9573897 (patch) | |
tree | 6128b84210a53f5f0f98feb8aba1d8056dffc8d7 /src/providers | |
parent | 7cc8729dec26c1fd5b06323237acc9ba2bdaaa17 (diff) | |
download | sssd-6ca87e797982061576885f944e2ccfaba9573897.tar.gz sssd-6ca87e797982061576885f944e2ccfaba9573897.tar.xz sssd-6ca87e797982061576885f944e2ccfaba9573897.zip |
KRB5: Auto-detect DIR cache support in configure
We can't support the DIR cache features in systems with kerberos
libraries older than 1.10. Make sure we don't build it on those
systems.
Diffstat (limited to 'src/providers')
-rw-r--r-- | src/providers/krb5/krb5_child.c | 8 | ||||
-rw-r--r-- | src/providers/krb5/krb5_common.c | 6 | ||||
-rw-r--r-- | src/providers/krb5/krb5_utils.c | 9 | ||||
-rw-r--r-- | src/providers/krb5/krb5_utils.h | 15 |
4 files changed, 33 insertions, 5 deletions
diff --git a/src/providers/krb5/krb5_child.c b/src/providers/krb5/krb5_child.c index bfec956b6..c434c97ff 100644 --- a/src/providers/krb5/krb5_child.c +++ b/src/providers/krb5/krb5_child.c @@ -244,11 +244,13 @@ store_creds_in_ccache(krb5_context ctx, krb5_principal princ, goto done; } +#ifdef HAVE_KRB5_DIRCACHE kerr = krb5_cc_switch(ctx, cc); if (kerr != 0) { KRB5_CHILD_DEBUG(SSSDBG_OP_FAILURE, kerr); goto done; } +#endif /* HAVE_KRB5_DIRCACHE */ kerr = krb5_cc_close(ctx, cc); if (kerr != 0) { @@ -366,6 +368,8 @@ done: return kerr; } +#ifdef HAVE_KRB5_DIRCACHE + static errno_t create_ccdir(const char *dirname, uid_t uid, gid_t gid) { @@ -491,6 +495,8 @@ done: return kerr; } +#endif /* HAVE_KRB5_DIRCACHE */ + static krb5_error_code create_ccache(uid_t uid, gid_t gid, krb5_context ctx, krb5_principal princ, char *ccname, krb5_creds *creds) @@ -501,8 +507,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 case SSS_KRB5_TYPE_DIR: return create_ccache_in_dir(uid, gid, ctx, princ, ccname, creds); +#endif /* HAVE_KRB5_DIRCACHE */ 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 f4033d295..ee35b522e 100644 --- a/src/providers/krb5/krb5_common.c +++ b/src/providers/krb5/krb5_common.c @@ -204,12 +204,16 @@ errno_t check_and_export_options(struct dp_option *opts, return ret; } break; + +#ifdef HAVE_KRB5_DIRCACHE case SSS_KRB5_TYPE_DIR: DEBUG(SSSDBG_CONF_SETTINGS, ("ccache is of type DIR\n")); krb5_ctx->cc_be = &dir_cc; break; +#endif + default: - DEBUG(SSSDBG_OP_FAILURE, ("Unkown ccname database\n")); + DEBUG(SSSDBG_OP_FAILURE, ("Unknown ccname database\n")); return EINVAL; break; } diff --git a/src/providers/krb5/krb5_utils.c b/src/providers/krb5/krb5_utils.c index 8cea7ccea..68a6aab33 100644 --- a/src/providers/krb5/krb5_utils.c +++ b/src/providers/krb5/krb5_utils.c @@ -583,9 +583,13 @@ get_cc_be_ops(enum sss_krb5_cc_type type) case SSS_KRB5_TYPE_FILE: be = &file_cc; break; + +#ifdef HAVE_KRB5_DIRCACHE case SSS_KRB5_TYPE_DIR: be = &dir_cc; break; +#endif /* HAVE_KRB5_DIRCACHE */ + case SSS_KRB5_TYPE_UNKNOWN: be = NULL; break; @@ -649,9 +653,11 @@ cc_residual_is_used(uid_t uid, const char *ccname, } switch (type) { +#ifdef HAVE_KRB5_DIRCACHE case SSS_KRB5_TYPE_DIR: ret = S_ISDIR(stat_buf.st_mode); break; +#endif /* HAVE_KRB5_DIRCACHE */ case SSS_KRB5_TYPE_FILE: ret = S_ISREG(stat_buf.st_mode); break; @@ -789,6 +795,7 @@ struct sss_krb5_cc_be file_cc = { .remove = cc_file_remove, }; +#ifdef HAVE_KRB5_DIRCACHE /*======== Operations on the DIR: back end ========*/ errno_t cc_dir_create(const char *location, pcre *illegal_re, @@ -1000,3 +1007,5 @@ struct sss_krb5_cc_be dir_cc = { .ccache_for_princ = cc_dir_cache_for_princ, .remove = cc_dir_remove }; + +#endif /* HAVE_KRB5_DIRCACHE */ diff --git a/src/providers/krb5/krb5_utils.h b/src/providers/krb5/krb5_utils.h index 5f677cae2..d8d96d258 100644 --- a/src/providers/krb5/krb5_utils.h +++ b/src/providers/krb5/krb5_utils.h @@ -27,6 +27,7 @@ #define __KRB5_UTILS_H__ #include <talloc.h> +#include "config.h" #include "providers/krb5/krb5_auth.h" #include "providers/data_provider.h" @@ -53,7 +54,6 @@ struct sss_krb5_cc_be { }; struct sss_krb5_cc_be file_cc; -struct sss_krb5_cc_be dir_cc; errno_t create_ccache_dir(const char *dirname, pcre *illegal_re, uid_t uid, gid_t gid, bool private_path); @@ -61,9 +61,6 @@ errno_t create_ccache_dir(const char *dirname, pcre *illegal_re, errno_t cc_file_create(const char *filename, pcre *illegal_re, uid_t uid, gid_t gid, bool private_path); -errno_t cc_dir_create(const char *location, pcre *illegal_re, - uid_t uid, gid_t gid, bool private_path); - struct sss_krb5_cc_be *get_cc_be_ops(enum sss_krb5_cc_type type); struct sss_krb5_cc_be *get_cc_be_ops_ccache(const char *ccache); @@ -75,4 +72,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 + +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 /* __KRB5_UTILS_H__ */ |