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

ghudson@MIT.EDU ghudson at MIT.EDU
Fri Jun 10 16:01:23 EDT 2011


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

Handle invalid intervals in lockout-related kadmin parameters.


Changed Files:
U   trunk/src/kadmin/cli/kadmin.c
Modified: trunk/src/kadmin/cli/kadmin.c
===================================================================
--- trunk/src/kadmin/cli/kadmin.c	2011-06-10 19:33:36 UTC (rev 24965)
+++ trunk/src/kadmin/cli/kadmin.c	2011-06-10 20:01:23 UTC (rev 24966)
@@ -1638,12 +1638,17 @@
             if (++i > argc - 2)
                 return -1;
             else {
+                /* Allow bare numbers for compatibility with 1.8-1.9. */
                 date = get_date(argv[i]);
-                /* Allow bare numbers for compatibility with 1.8-1.9. */
-                if (date == (time_t)-1 && isdigit(*argv[i]))
+                if (date != (time_t)-1)
+                    policy->pw_failcnt_interval = date - now;
+                else if (isdigit(*argv[i]))
                     policy->pw_failcnt_interval = atoi(argv[i]);
-                else
-                    policy->pw_failcnt_interval = date - now;
+                else {
+                    fprintf(stderr, _("Invalid date specification \"%s\".\n"),
+                            argv[i]);
+                    return -1;
+                }
                 *mask |= KADM5_PW_FAILURE_COUNT_INTERVAL;
                 continue;
             }
@@ -1652,12 +1657,17 @@
             if (++i > argc - 2)
                 return -1;
             else {
+                /* Allow bare numbers for compatibility with 1.8-1.9. */
                 date = get_date(argv[i]);
-                /* Allow bare numbers for compatibility with 1.8-1.9. */
-                if (date == (time_t)-1 && isdigit(*argv[i]))
+                if (date != (time_t)-1)
+                    policy->pw_lockout_duration = date - now;
+                else if (isdigit(*argv[i]))
                     policy->pw_lockout_duration = atoi(argv[i]);
-                else
-                    policy->pw_lockout_duration = date - now;
+                else {
+                    fprintf(stderr, _("Invalid date specification \"%s\".\n"),
+                            argv[i]);
+                    return -1;
+                }
                 *mask |= KADM5_PW_LOCKOUT_DURATION;
                 continue;
             }




More information about the cvs-krb5 mailing list