* str_conv.c (krb5_string_to_timestamp): Ensure that all fields of
authorEzra Peisach <epeisach@mit.edu>
Tue, 18 Jun 1996 00:26:53 +0000 (00:26 +0000)
committerEzra Peisach <epeisach@mit.edu>
Tue, 18 Jun 1996 00:26:53 +0000 (00:26 +0000)
the timestamp are filled in if strptime does not fill in
unspecified fields.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@8376 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/krb/ChangeLog
src/lib/krb5/krb/str_conv.c

index df4c1e5d800f64ef26d37a1aae6d67bfe3a4f9c4..d0a9f230afecf68e056d3abf258d8cf74617fd4e 100644 (file)
@@ -1,3 +1,9 @@
+Mon Jun 17 20:23:48 1996  Ezra Peisach  <epeisach@kangaroo.mit.edu>
+
+       * str_conv.c (krb5_string_to_timestamp): Ensure that all fields of
+               the timestamp are filled in if strptime does not fill in
+               unspecified fields.
+
 Wed Jun 12 01:10:09 1996  Theodore Ts'o  <tytso@rsts-11.mit.edu>
 
        * sendauth.c (krb5_sendauth): If ECCONABORTED is not defined, try
index c45321ee6a4bec92c53e1ab83c3c89ed6b4c4703..76a79a86b27620f67707cb5f94c085d317bf44b8 100644 (file)
@@ -432,11 +432,17 @@ krb5_string_to_timestamp(string, timestampp)
     int i;
     int found;
     struct tm timebuf;
+    time_t now;
     char *s;
 
     found = 0;
-    memset(&timebuf, 0, sizeof(timebuf));
+    now = time((time_t *) NULL);
     for (i=0; i<atime_format_table_nents; i++) {
+        /* We reset every time throughout the loop as the manual page
+        * indicated that no guarantees are made as to preserving timebuf
+        * when parsing fails
+        */
+       memcpy(&timebuf, localtime(&now), sizeof(timebuf));
        if ((s = strptime(string, atime_format_table[i], &timebuf))
            && (s != string)) {
            found = 1;