#include <errno.h>
#include <stdio.h>
#include <string.h>
+#include <ctype.h>
#include <sys/types.h>
#include <math.h>
#include <unistd.h>
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;
}
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;
}
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,