From af23757829f05580aa36d4163576a91b4e159b14 Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Mon, 18 Jul 2011 15:40:59 -0500 Subject: [PATCH] Trivial policy bug fix. --- kadmin/util.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/kadmin/util.c b/kadmin/util.c index 515f77fdd..e5a16c48c 100644 --- a/kadmin/util.c +++ b/kadmin/util.c @@ -186,7 +186,9 @@ edit_policy (const char *prompt, char **policy, int *mask, int bit) if (mask && (*mask & bit)) return 0; - strlcpy(buf, *policy, sizeof (buf)); + buf[0] = '\0'; + if (*policy) + strlcpy(buf, *policy, sizeof (buf)); for (;;) { if(get_response("Policy", buf, resp, sizeof(resp)) != 0) return 1; @@ -444,6 +446,14 @@ set_defaults(kadm5_principal_ent_t ent, int *mask, && (default_mask & KADM5_ATTRIBUTES) && !(*mask & KADM5_ATTRIBUTES)) ent->attributes = default_ent->attributes & ~KRB5_KDB_DISALLOW_ALL_TIX; + + if (default_ent + && (default_mask & KADM5_POLICY) + && !(*mask & KADM5_POLICY)) { + ent->policy = strdup(default_ent->policy); + if (ent->policy == NULL) + abort(); + } } int