Hi

I got sick when adding a expire date for an useraccount with chsh.
The line with the format shows "[month day year]" but
the parameter you have to insert is the monthname as local name
or an abbreviation.

My patch adds the possibility to enter the old format and
the numerical format as well.

Maybe you'll find that ok or better helpful

--- usr.bin/chpass/util.c.orig  Tue Dec 16 06:25:55 2008
+++ usr.bin/chpass/util.c       Fri Feb 27 21:36:03 2009
@@ -75,11 +75,16 @@
                 return (0);
         }
         (void) memset(&tm, 0, sizeof(tm));
-       for (t = p; (t = strchr(t, ',')) != NULL; t++)
-               *t = ' ';
+       for (t = p; *t != NULL; t++ )
+               if( *t == ',' || *t == '/' || *t == '.' )
+                       *t = ' ';
         t = strptime(p, "%B %d %Y", &tm);
-       if (t == NULL || (*t != '\0' && *t != '\n'))
-               return 1;
+       if (t == NULL || (*t != '\0' && *t != '\n')) {
+               t = strptime( p, "%m %d %Y", &tm );
+               if (t == NULL || (*t != '\0' && *t != '\n')) {
+                       return 1;
+               }
+       }
         tm.tm_isdst = -1;
         *store = mktime(&tm);
         if (*store == (time_t) -1)


Regards
Karl-Heinz

[demime 1.01d removed an attachment of type application/pkcs7-signature which 
had a name of smime.p7s]

Reply via email to