]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Add more formats to krb5_timestamp_to_sfstring
authorTom Yu <tlyu@mit.edu>
Fri, 21 Dec 2012 20:45:53 +0000 (15:45 -0500)
committerTom Yu <tlyu@mit.edu>
Sat, 22 Dec 2012 17:40:11 +0000 (12:40 -0500)
krb5_timestamp_to_string() can produce ambiguous dates.  The final
fallback, "%d/%m/%Y %R", contains a European order date format that
can be confused with a US date format.  Add some additional strftime()
format strings, including locale-dependent formats and some ISO 8601
formats.  Remove the hardcoded strftime() format that had an ambiguous
date order.

ticket: 7458
target_version: 1.11
tags: pullup

src/lib/krb5/krb/str_conv.c

index e39cd669643ea7daf0c9b6c4796edabe1a5a5e2c..1ffd026761711f4327fb2aed8ead91da98c31028 100644 (file)
@@ -239,7 +239,12 @@ krb5_timestamp_to_sfstring(krb5_timestamp timestamp, char *buffer, size_t buflen
         "%c",                   /* Default locale-dependent date and time */
         "%d %b %Y %T",          /* dd mon yyyy hh:mm:ss                 */
         "%x %X",                /* locale-dependent short format        */
-        "%d/%m/%Y %R"           /* dd/mm/yyyy hh:mm                     */
+        "%x %T",                /* locale-dependent date + hh:mm:ss     */
+        "%x %R",                /* locale-dependent date + hh:mm        */
+        "%Y-%m-%dT%H:%M:%S",    /* ISO 8601 date + time                 */
+        "%Y-%m-%dT%H:%M",       /* ISO 8601 date + hh:mm                */
+        "%Y%m%d%H%M%S",         /* ISO 8601 date + time, basic          */
+        "%Y%m%d%H%M"            /* ISO 8601 date + hh:mm, basic         */
     };
     static const unsigned int sftime_format_table_nents =
         sizeof(sftime_format_table)/sizeof(sftime_format_table[0]);