shishi-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

shishi/lib tkt.c


From: shishi-commit
Subject: shishi/lib tkt.c
Date: Wed, 26 Nov 2003 12:44:31 -0500

CVSROOT:        /cvsroot/shishi
Module name:    shishi
Branch:         
Changes by:     Simon Josefsson <address@hidden>        03/11/26 12:44:31

Modified files:
        lib            : tkt.c 

Log message:
        (shishi_tkt_expired_p): Add.
        (shishi_tkt_pretty_print): Separate EXPIRED into NOT YET VALID and
        EXPIRED.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/lib/tkt.c.diff?tr1=1.27&tr2=1.28&r1=text&r2=text

Patches:
Index: shishi/lib/tkt.c
diff -u shishi/lib/tkt.c:1.27 shishi/lib/tkt.c:1.28
--- shishi/lib/tkt.c:1.27       Sun Sep 28 19:38:03 2003
+++ shishi/lib/tkt.c    Wed Nov 26 12:44:31 2003
@@ -1221,6 +1221,23 @@
 }
 
 /**
+ * shishi_tkt_expired_p:
+ * @tkt: input variable with ticket info.
+ *
+ * Determine if ticket has expired (i.e., endtime is in the past).
+ *
+ * Return value: Returns 0 iff ticket has expired.
+ **/
+int
+shishi_tkt_expired_p (Shishi_tkt * tkt)
+{
+  time_t endtime = shishi_tkt_endctime (tkt);
+  time_t now = time (NULL);
+
+  return endtime < now;
+}
+
+/**
  * shishi_tkt_lastreq_pretty_print:
  * @tkt: input variable with ticket info.
  * @fh: file handle open for writing.
@@ -1273,6 +1290,7 @@
   int keytype, etype, flags;
   int res;
   time_t t;
+  time_t now = time (NULL);
 
   buflen = sizeof (buf);
   buf[0] = '\0';
@@ -1285,15 +1303,25 @@
 
   t = shishi_tkt_startctime (tkt);
   if (t != (time_t) - 1)
-    fprintf (fh, _("Starttime:\t%s"), ctime (&t));
+    {
+      p = ctime (&t);
+      p[strlen (p) - 1] = '\0';
+      fprintf (fh, _("Starttime:\t%s"), p);
+      if (t > now)
+       fprintf (fh, " NOT YET VALID");
+      fprintf (fh, "\n");
+    }
 
   t = shishi_tkt_endctime (tkt);
-  p = ctime (&t);
-  p[strlen (p) - 1] = '\0';
-  fprintf (fh, _("Endtime:\t%s"), p);
-  if (!shishi_tkt_valid_now_p (tkt))
-    fprintf (fh, " (EXPIRED)");
-  fprintf (fh, "\n");
+  if (t != (time_t) - 1)
+    {
+      p = ctime (&t);
+      p[strlen (p) - 1] = '\0';
+      fprintf (fh, _("Endtime:\t%s"), p);
+      if (t < now)
+       fprintf (fh, " EXPIRED");
+      fprintf (fh, "\n");
+    }
 
   t = shishi_tkt_renew_tillc (tkt);
   if (t != (time_t) - 1)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]