loadparm: Add helper function to fetch default lifetime policies
authorSimo Sorce <idra@samba.org>
Thu, 19 Apr 2012 15:16:03 +0000 (11:16 -0400)
committerSimo Sorce <idra@samba.org>
Thu, 19 Apr 2012 22:14:02 +0000 (18:14 -0400)
This use long to fetch time_t quantities, because there are architectures were
time_t is a signed long but long != int, So long is the proper way to deal with
it.

lib/param/param.h
lib/param/util.c

index 079ef8b9a661570a302abd224d2083f1293fe79b..7842a843f6cd921973ffe71af6090de2c3c0c64f 100644 (file)
@@ -297,6 +297,11 @@ struct smb_iconv_handle *smb_iconv_handle_reinit_lp(TALLOC_CTX *mem_ctx,
 
 const char *lpcfg_sam_name(struct loadparm_context *lp_ctx);
 
+void lpcfg_default_kdc_policy(struct loadparm_context *lp_ctx,
+                               time_t *svc_tkt_lifetime,
+                               time_t *usr_tkt_lifetime,
+                               time_t *renewal_lifetime);
+
 /* The following definitions come from lib/version.c  */
 
 const char *samba_version_string(void);
index 3a6a004043da6b94b32f8a5b993e7231ef3f96c0..f60abb9773279963f0b6a938e48a25e4f6d63cbb 100644 (file)
@@ -266,3 +266,22 @@ const char *lpcfg_sam_name(struct loadparm_context *lp_ctx)
        }
 }
 
+void lpcfg_default_kdc_policy(struct loadparm_context *lp_ctx,
+                               time_t *svc_tkt_lifetime,
+                               time_t *usr_tkt_lifetime,
+                               time_t *renewal_lifetime)
+{
+       long val;
+
+       val = lpcfg_parm_long(lp_ctx, NULL,
+                               "kdc", "service ticket lifetime", 10);
+       *svc_tkt_lifetime = val * 60 * 60;
+
+       val = lpcfg_parm_long(lp_ctx, NULL,
+                               "kdc", "user ticket lifetime", 10);
+       *usr_tkt_lifetime = val * 60 * 60;
+
+       val = lpcfg_parm_long(lp_ctx, NULL,
+                               "kdc", "renewal lifetime", 24 * 7);
+       *renewal_lifetime = val * 60 * 60;
+}