diff options
author | Sumit Bose <sbose@redhat.com> | 2010-11-08 16:00:57 +0100 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2010-12-03 10:41:28 -0500 |
commit | c8b8901b05da9e31dba320f305ec20301e928cfb (patch) | |
tree | d503cc9d102a727a100dd6e599290e862f64cdb0 /src/providers | |
parent | 7470bb938429c7a723f5aad971cc50a805a9ead8 (diff) | |
download | sssd-c8b8901b05da9e31dba320f305ec20301e928cfb.tar.gz sssd-c8b8901b05da9e31dba320f305ec20301e928cfb.tar.xz sssd-c8b8901b05da9e31dba320f305ec20301e928cfb.zip |
Add krb5_renewable_lifetime option
Diffstat (limited to 'src/providers')
-rw-r--r-- | src/providers/ipa/ipa_common.c | 3 | ||||
-rw-r--r-- | src/providers/ipa/ipa_common.h | 2 | ||||
-rw-r--r-- | src/providers/krb5/krb5_child.c | 18 | ||||
-rw-r--r-- | src/providers/krb5/krb5_common.c | 24 | ||||
-rw-r--r-- | src/providers/krb5/krb5_common.h | 2 |
5 files changed, 45 insertions, 4 deletions
diff --git a/src/providers/ipa/ipa_common.c b/src/providers/ipa/ipa_common.c index a7f4494ba..149a352fa 100644 --- a/src/providers/ipa/ipa_common.c +++ b/src/providers/ipa/ipa_common.c @@ -139,7 +139,8 @@ struct dp_option ipa_def_krb5_opts[] = { { "krb5_keytab", DP_OPT_STRING, { "/etc/krb5.keytab" }, NULL_STRING }, { "krb5_validate", DP_OPT_BOOL, BOOL_TRUE, BOOL_TRUE }, { "krb5_kpasswd", DP_OPT_STRING, NULL_STRING, NULL_STRING }, - { "krb5_store_password_if_offline", DP_OPT_BOOL, BOOL_FALSE, BOOL_FALSE } + { "krb5_store_password_if_offline", DP_OPT_BOOL, BOOL_FALSE, BOOL_FALSE }, + { "krb5_renewable_lifetime", DP_OPT_STRING, NULL_STRING, NULL_STRING } }; int ipa_get_options(TALLOC_CTX *memctx, diff --git a/src/providers/ipa/ipa_common.h b/src/providers/ipa/ipa_common.h index ef1cac207..33b325c0b 100644 --- a/src/providers/ipa/ipa_common.h +++ b/src/providers/ipa/ipa_common.h @@ -40,7 +40,7 @@ struct ipa_service { /* the following define is used to keep track of the options in the krb5 * module, so that if they change and ipa is not updated correspondingly * this will trigger a runtime abort error */ -#define IPA_KRB5_OPTS_TEST 9 +#define IPA_KRB5_OPTS_TEST 10 enum ipa_basic_opt { IPA_DOMAIN = 0, diff --git a/src/providers/krb5/krb5_child.c b/src/providers/krb5/krb5_child.c index 0e5556048..2a2ed9b47 100644 --- a/src/providers/krb5/krb5_child.c +++ b/src/providers/krb5/krb5_child.c @@ -1084,6 +1084,8 @@ static int krb5_cleanup(void *ptr) static int krb5_child_setup(struct krb5_req *kr, uint32_t offline) { krb5_error_code kerr = 0; + char *lifetime_str; + krb5_deltat lifetime; kr->krb5_ctx = talloc_zero(kr, struct krb5_child_ctx); if (kr->krb5_ctx == NULL) { @@ -1162,9 +1164,23 @@ static int krb5_child_setup(struct krb5_req *kr, uint32_t offline) goto failed; } + lifetime_str = getenv(SSSD_KRB5_RENEWABLE_LIFETIME); + if (lifetime_str == NULL) { + DEBUG(7, ("Cannot read [%s] from environment.\n", + SSSD_KRB5_RENEWABLE_LIFETIME)); + } else { + kerr = krb5_string_to_deltat(lifetime_str, &lifetime); + if (kerr != 0) { + DEBUG(1, ("krb5_string_to_deltat failed for [%s].\n", + lifetime_str)); + KRB5_DEBUG(1, kerr); + goto failed; + } + krb5_get_init_creds_opt_set_renew_life(kr->options, lifetime); + } + /* TODO: set options, e.g. * krb5_get_init_creds_opt_set_tkt_life - * krb5_get_init_creds_opt_set_renew_life * krb5_get_init_creds_opt_set_forwardable * krb5_get_init_creds_opt_set_proxiable * krb5_get_init_creds_opt_set_etype_list diff --git a/src/providers/krb5/krb5_common.c b/src/providers/krb5/krb5_common.c index bf47dcc47..1a62bbe32 100644 --- a/src/providers/krb5/krb5_common.c +++ b/src/providers/krb5/krb5_common.c @@ -40,7 +40,8 @@ struct dp_option default_krb5_opts[] = { { "krb5_keytab", DP_OPT_STRING, { "/etc/krb5.keytab" }, NULL_STRING }, { "krb5_validate", DP_OPT_BOOL, BOOL_FALSE, BOOL_FALSE }, { "krb5_kpasswd", DP_OPT_STRING, NULL_STRING, NULL_STRING }, - { "krb5_store_password_if_offline", DP_OPT_BOOL, BOOL_FALSE, BOOL_FALSE } + { "krb5_store_password_if_offline", DP_OPT_BOOL, BOOL_FALSE, BOOL_FALSE }, + { "krb5_renewable_lifetime", DP_OPT_STRING, NULL_STRING, NULL_STRING } }; errno_t check_and_export_options(struct dp_option *opts, @@ -49,6 +50,8 @@ errno_t check_and_export_options(struct dp_option *opts, int ret; const char *realm; const char *dummy; + char *str; + krb5_deltat lifetime; realm = dp_opt_get_cstring(opts, KRB5_REALM); if (realm == NULL) { @@ -66,6 +69,25 @@ errno_t check_and_export_options(struct dp_option *opts, SSSD_KRB5_REALM)); } + str = dp_opt_get_string(opts, KRB5_RENEWABLE_LIFETIME); + if (str == NULL) { + DEBUG(5, ("No renewable lifetime configured.\n")); + } else { + ret = krb5_string_to_deltat(str, &lifetime); + if (ret != 0) { + DEBUG(1, ("Invalid value [%s] for krb5_renewable_lifetime.\n", + str)); + return EINVAL; + } + + ret = setenv(SSSD_KRB5_RENEWABLE_LIFETIME, str, 1); + if (ret != EOK) { + DEBUG(2, ("setenv [%s] failed.\n", + SSSD_KRB5_RENEWABLE_LIFETIME)); + return ret; + } + } + dummy = dp_opt_get_cstring(opts, KRB5_KDC); if (dummy == NULL) { DEBUG(1, ("No KDC explicitly configured, using defaults.\n")); diff --git a/src/providers/krb5/krb5_common.h b/src/providers/krb5/krb5_common.h index 139ce400b..15ef437ba 100644 --- a/src/providers/krb5/krb5_common.h +++ b/src/providers/krb5/krb5_common.h @@ -35,6 +35,7 @@ #define SSSD_KRB5_KDC "SSSD_KRB5_KDC" #define SSSD_KRB5_REALM "SSSD_KRB5_REALM" +#define SSSD_KRB5_RENEWABLE_LIFETIME "SSSD_KRB5_RENEWABLE_LIFETIME" #define KDCINFO_TMPL PUBCONF_PATH"/kdcinfo.%s" #define KPASSWDINFO_TMPL PUBCONF_PATH"/kpasswdinfo.%s" @@ -52,6 +53,7 @@ enum krb5_opts { KRB5_VALIDATE, KRB5_KPASSWD, KRB5_STORE_PASSWORD_IF_OFFLINE, + KRB5_RENEWABLE_LIFETIME, KRB5_OPTS }; |