summaryrefslogtreecommitdiffstats
path: root/src/kadmin/cli/kadmin.c
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2011-05-16 03:54:16 +0000
committerGreg Hudson <ghudson@mit.edu>2011-05-16 03:54:16 +0000
commit9883d15e9ffb89a0c1e3a9d8d6afda86ccb8e5e2 (patch)
tree9f30a298a73dee017227a7f10a9c623ab1240257 /src/kadmin/cli/kadmin.c
parentddee20e40587f45cb5efd7e2a990a42b7b5a35da (diff)
downloadkrb5-9883d15e9ffb89a0c1e3a9d8d6afda86ccb8e5e2.tar.gz
krb5-9883d15e9ffb89a0c1e3a9d8d6afda86ccb8e5e2.tar.xz
krb5-9883d15e9ffb89a0c1e3a9d8d6afda86ccb8e5e2.zip
In kadmin, try using get_date() for lockout-related duration inputs to
modpol and addpol, but still allow bare numbers of seconds since that's what we took in 1.8 and 1.9. Use strdur() to display lockout-related durations in getpol. Reported by shawn.emery@oracle.com. ticket: 6911 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24931 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/kadmin/cli/kadmin.c')
-rw-r--r--src/kadmin/cli/kadmin.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/kadmin/cli/kadmin.c b/src/kadmin/cli/kadmin.c
index ac08ffac0..05561b671 100644
--- a/src/kadmin/cli/kadmin.c
+++ b/src/kadmin/cli/kadmin.c
@@ -38,6 +38,7 @@
#include <errno.h>
#include <stdio.h>
#include <string.h>
+#include <ctype.h>
#include <sys/types.h>
#include <math.h>
#include <unistd.h>
@@ -1607,7 +1608,12 @@ kadmin_parse_policy_args(int argc, char *argv[], kadm5_policy_ent_t policy,
if (++i > argc - 2)
return -1;
else {
- policy->pw_failcnt_interval = atoi(argv[i]);
+ date = get_date(argv[i]);
+ /* Allow bare numbers for compatibility with 1.8-1.9. */
+ if (date == (time_t)-1 && isdigit(*argv[i]))
+ policy->pw_failcnt_interval = atoi(argv[i]);
+ else
+ policy->pw_failcnt_interval = date - now;
*mask |= KADM5_PW_FAILURE_COUNT_INTERVAL;
continue;
}
@@ -1616,7 +1622,12 @@ kadmin_parse_policy_args(int argc, char *argv[], kadm5_policy_ent_t policy,
if (++i > argc - 2)
return -1;
else {
- policy->pw_lockout_duration = atoi(argv[i]);
+ date = get_date(argv[i]);
+ /* Allow bare numbers for compatibility with 1.8-1.9. */
+ if (date == (time_t)-1 && isdigit(*argv[i]))
+ policy->pw_lockout_duration = atoi(argv[i]);
+ else
+ policy->pw_lockout_duration = date - now;
*mask |= KADM5_PW_LOCKOUT_DURATION;
continue;
}
@@ -1734,10 +1745,10 @@ kadmin_getpol(int argc, char *argv[])
printf("Reference count: %ld\n", policy.policy_refcnt);
printf("Maximum password failures before lockout: %lu\n",
(unsigned long)policy.pw_max_fail);
- printf("Password failure count reset interval: %ld\n",
- (long)policy.pw_failcnt_interval);
- printf("Password lockout duration: %ld\n",
- (long)policy.pw_lockout_duration);
+ printf("Password failure count reset interval: %s\n",
+ strdur(policy.pw_failcnt_interval));
+ printf("Password lockout duration: %s\n",
+ strdur(policy.pw_lockout_duration));
} else {
printf("\"%s\"\t%ld\t%ld\t%ld\t%ld\t%ld\t%ld\t%lu\t%ld\t%ld\n",
policy.policy, policy.pw_max_life, policy.pw_min_life,