dnsmasq: run as dedicated UID/GID
[openwrt/.git] / package / network / services / dnsmasq / patches / 210-dnssec-improve-timestamp-heuristic.patch
index f4acd7c6e5155c5dcbb75ffb658f570dd61a0d88..81fbf185b109752bfe877d45879eac8001754a09 100644 (file)
@@ -8,39 +8,35 @@ Signed-off-by: Steven Barth <steven@midlink.org>
  src/dnssec.c | 15 +++++++++++----
  1 file changed, 11 insertions(+), 4 deletions(-)
 
-diff --git a/src/dnssec.c b/src/dnssec.c
-index 05e0983..9c02548 100644
 --- a/src/dnssec.c
 +++ b/src/dnssec.c
-@@ -408,17 +408,24 @@ static int back_to_the_future;
+@@ -429,17 +429,24 @@ static time_t timestamp_time;
  int setup_timestamp(void)
  {
    struct stat statbuf;
--  
 +  time_t now;
 +  time_t base = 1420070400; /* 1-1-2015 */
-+
-   back_to_the_future = 0;
+   
+   daemon->back_to_the_future = 0;
    
    if (!daemon->timestamp_file)
      return 0;
--  
 +
 +  now = time(NULL);
 +
 +  if (!stat("/proc/self/exe", &statbuf) && difftime(statbuf.st_mtime, base) > 0)
 +    base = statbuf.st_mtime;
-+
+   
    if (stat(daemon->timestamp_file, &statbuf) != -1)
      {
        timestamp_time = statbuf.st_mtime;
      check_and_exit:
 -      if (difftime(timestamp_time, time(0)) <=  0)
-+      if (difftime(now, base) >= 0 && difftime(timestamp_time, now) <=  0)
++      if (difftime(now, base) >= 0 && difftime(timestamp_time, now) <= 0)
        {
          /* time already OK, update timestamp, and do key checking from the start. */
          if (utime(daemon->timestamp_file, NULL) == -1)
-@@ -439,7 +446,7 @@ int setup_timestamp(void)
+@@ -460,7 +467,7 @@ int setup_timestamp(void)
  
          close(fd);
          
@@ -49,6 +45,3 @@ index 05e0983..9c02548 100644
          if (utime(daemon->timestamp_file, &timbuf) == 0)
            goto check_and_exit;
        }
--- 
-2.1.4
-