svn rev #24931: trunk/src/kadmin/cli/

ghudson@MIT.EDU ghudson at MIT.EDU
Sun May 15 23:54:16 EDT 2011


http://src.mit.edu/fisheye/changelog/krb5/?cs=24931
Commit By: ghudson
Log Message:
ticket: 6911

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 at oracle.com.



Changed Files:
U   trunk/src/kadmin/cli/kadmin.c
Modified: trunk/src/kadmin/cli/kadmin.c
===================================================================
--- trunk/src/kadmin/cli/kadmin.c	2011-05-15 14:47:19 UTC (rev 24930)
+++ trunk/src/kadmin/cli/kadmin.c	2011-05-16 03:54:16 UTC (rev 24931)
@@ -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 @@
             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 @@
             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 @@
         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,




More information about the cvs-krb5 mailing list