From efe1bcc986d492f0c64fd6a10ae7c52a9ed89ea6 Mon Sep 17 00:00:00 2001 From: Johan Danielsson Date: Fri, 7 May 2004 09:03:31 +0000 Subject: [PATCH] (str2time_t): fix end-of-day logic, from Duncan McEwan/Mark Davies. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@13840 ec53bebd-3082-4978-b11e-865c3cabbd6b --- kadmin/util.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/kadmin/util.c b/kadmin/util.c index ff37aaa08..0b9010ca9 100644 --- a/kadmin/util.c +++ b/kadmin/util.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997 - 2002 Kungliga Tekniska Högskolan + * Copyright (c) 1997 - 2004 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -194,15 +194,18 @@ str2time_t (const char *str, time_t *t) if (p == NULL) return -1; - /* Do it on the end of the day */ - tm2.tm_hour = 23; - tm2.tm_min = 59; - tm2.tm_sec = 59; + /* XXX this is really a bit optimistic, we should really complain + if there was a problem parsing the time */ if(strptime (p, "%t%H:%M:%S", &tm2) != NULL) { tm.tm_hour = tm2.tm_hour; tm.tm_min = tm2.tm_min; tm.tm_sec = tm2.tm_sec; + } else { + /* Do it on the end of the day */ + tm.tm_hour = 23; + tm.tm_min = 59; + tm.tm_sec = 59; } *t = tm2time (tm, 0);