]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Time added in password management.
authorOndrej Filip <feela@network.cz>
Sat, 12 Feb 2005 22:27:55 +0000 (22:27 +0000)
committerOndrej Filip <feela@network.cz>
Sat, 12 Feb 2005 22:27:55 +0000 (22:27 +0000)
conf/confbase.Y
doc/bird.conf.example
sysdep/unix/io.c

index 5da84b1e6a949ffd72cff5920e8d66591b84f8a8..fa178d876247a55a64be34b1066c49e5a314a612 100644 (file)
@@ -145,9 +145,9 @@ pxlen:
 
 datetime:
    TEXT {
-     $$ = tm_parse_date($1);
+     $$ = tm_parse_datetime($1);
      if (!$$)
-       cf_error("Invalid date");
+       cf_error("Invalid date and time");
    }
  ;
 
index dfa84a2cce9660e93e77cefa0cc6b249eb88284b..704abef055039c8a6b07b0c954e50e325f17f8a5 100644 (file)
@@ -128,6 +128,20 @@ protocol static {
 #                      };
 #                      strict nonbroadcast yes;
 #              };
+#              interface "xxx0" {
+#                       passwords {
+#                              password "abc" {
+#                                      id 1;
+#                                      generate to "22-04-2003 11:00:06";
+#                                      accept to "17-01-2004 12:01:05";
+#                              };
+#                              password "def" {
+#                                      id 2;
+#                                      generate from "22-04-2003 11:00:07";
+#                                      accept from "17-01-2003 12:01:05";
+#                              };
+#                       authentication cryptographic;
+#              };
 #      };
 #      area 20 {
 #              stub 1;
index f68763cc895d4b977c527cfb57a0b685217454c0..5ecc8ae122f547ae681a9fcb6dcdf46db6e6088c 100644 (file)
@@ -299,6 +299,30 @@ tm_shot(void)
     }
 }
 
+/**
+ * tm_parse_datetime - parse a date and time
+ * @x: datetime string
+ *
+ * tm_parse_datetime() takes a textual representation of
+ * a date and time (dd-mm-yyyy hh:mm:ss)
+ * and converts it to the corresponding value of type &bird_clock_t.
+ */
+bird_clock_t
+tm_parse_datetime(char *x)
+{
+  struct tm tm;
+  int n;
+  time_t t;
+
+  if (sscanf(x, "%d-%d-%d %d:%d:%d%n", &tm.tm_mday, &tm.tm_mon, &tm.tm_year, &tm.tm_hour, &tm.tm_min, &tm.tm_sec, &n) != 6 || x[n])
+    return tm_parse_date(x);
+  tm.tm_mon--;
+  tm.tm_year -= 1900;
+  t = mktime(&tm);
+  if (t == (time_t) -1)
+    return 0;
+  return t;
+}
 /**
  * tm_parse_date - parse a date
  * @x: date string