Use loadparm helper to find lifetime defaults
authorSimo Sorce <idra@samba.org>
Thu, 19 Apr 2012 15:17:25 +0000 (11:17 -0400)
committerSimo Sorce <idra@samba.org>
Thu, 19 Apr 2012 22:14:02 +0000 (18:14 -0400)
Implictly fixes buggy use of int for time_t

source4/kdc/policy.c

index e9cc608e10c65be7d2de99ec69eac701ccdab190..4109cb4c853e3f1a47acee9bfc3d412b69af282f 100644 (file)
@@ -29,17 +29,21 @@ void kdc_get_policy(struct loadparm_context *lp_ctx,
                    struct smb_krb5_context *smb_krb5_context, 
                    struct lsa_DomainInfoKerberos *k)
 {
+       time_t svc_tkt_lifetime;
+       time_t usr_tkt_lifetime;
+       time_t renewal_lifetime;
+
        /* These should be set and stored via Group Policy, but until then, some defaults are in order */
 
        /* Our KDC always re-validates the client */
        k->authentication_options = LSA_POLICY_KERBEROS_VALIDATE_CLIENT;
 
-       unix_to_nt_time(&k->service_tkt_lifetime,
-                       lpcfg_parm_int(lp_ctx, NULL, "kdc", "service ticket lifetime", 10) * 60 * 60);
-       unix_to_nt_time(&k->user_tkt_lifetime,
-                       lpcfg_parm_int(lp_ctx, NULL, "kdc", "user ticket lifetime", 10) * 60 * 60);
-       unix_to_nt_time(&k->user_tkt_renewaltime,
-                       lpcfg_parm_int(lp_ctx, NULL, "kdc", "renewal lifetime", 24*7) * 60 * 60);
+       lpcfg_default_kdc_policy(lp_ctx, &svc_tkt_lifetime,
+                                &usr_tkt_lifetime, &renewal_lifetime);
+
+       unix_to_nt_time(&k->service_tkt_lifetime, svc_tkt_lifetime);
+       unix_to_nt_time(&k->user_tkt_lifetime, usr_tkt_lifetime);
+       unix_to_nt_time(&k->user_tkt_renewaltime, renewal_lifetime);
        if (smb_krb5_context) {
                unix_to_nt_time(&k->clock_skew, 
                                krb5_get_max_time_skew(smb_krb5_context->krb5_context));