Revision: 5838
          http://ipcop.svn.sourceforge.net/ipcop/?rev=5838&view=rev
Author:   dotzball
Date:     2011-09-07 19:41:44 +0000 (Wed, 07 Sep 2011)
Log Message:
-----------
Fix check(s) for timeframe rules.

Fixes SF bug #3403666

Modified Paths:
--------------
    ipcop/trunk/src/scripts/puzzleFwRules.pl
    ipcop/trunk/updates/1.9.21/ROOTFILES.i486-1.9.21
    ipcop/trunk/updates/1.9.21/information.xml

Modified: ipcop/trunk/src/scripts/puzzleFwRules.pl
===================================================================
--- ipcop/trunk/src/scripts/puzzleFwRules.pl    2011-09-07 06:45:08 UTC (rev 
5837)
+++ ipcop/trunk/src/scripts/puzzleFwRules.pl    2011-09-07 19:41:44 UTC (rev 
5838)
@@ -1253,43 +1253,60 @@
         #              print "hour >< \n";
         # check if we are in start hour:
         if ($hour == $startHour) {
+
+            # ok we are in start hour
+            # check if current minute is before start minute
             return 0 if ($minute < $startMinute);
 
             #                  print "minute < \n";
         }
         elsif ($hour == $endHour) {    # check if we are in end hour
-            return 0 if ($endMinute < $minute);
 
+            # ok we are in end hour
+            # check if current minute is end minute or later
+            return 0 if ($endMinute <= $minute);
+
             #                  print "minute > \n";
         }
     }
     elsif ($startHour > $endHour) {
 
         # e.g. start: 22:00, end: 9:55
-        return 0 unless ($hour <= $endHour || $startHour <= $hour);
+        # check if current hour is after endhour and before start
+        return 0 if ($endHour < $hour && $hour < $startHour);
 
         #              print "hour >= \n";
         # check if we are in start hour:
         if ($hour == $startHour) {
+
+            # ok we are in start hour
+            # check if current minute is before start minute
             return 0 if ($minute < $startMinute);
 
             #                  print "minute < \n";
         }
         elsif ($hour == $endHour) {    # check if we are in end hour
-            return 0 if ($endMinute < $minute);
 
+            # ok we are in end hour
+            # check if current minute is end minute or later
+            return 0 if ($endMinute <= $minute);
+
             #                  print "minute > \n";
         }
     }
-    else {                             # $startHour == $endHour
+    else {
+        # $startHour == $endHour
+
         if ($startMinute < $endMinute) {
 
             # e.g. start: 22:05, end: 22:30 - active: 0 hours, 25 minutes
+
+            # check if current hour is the time within the rule is active
             return 0 unless ($hour == $startHour);
-
             #                  print "hour == \n";
-            return 0 unless ($startMinute <= $minute && $minute < $endMinute);
 
+            # check if current minute is before start or current minute is 
equal to end minute or later
+            return 0 if ($minute < $startMinute || $endMinute <= $minute);
             #                  print "minute >< \n";
         }
         elsif ($startMinute > $endMinute) {
@@ -1297,8 +1314,10 @@
             # e.g. start: 22:45, end: 22:20 - active: 23 hours, 35 minutes
             # when we are not in starthour(==endhour), we are always in 
timeframe
             if ($hour == $startHour) {
-                return 0 unless ($minute < $endMinute || $startMinute <= 
$minute);
 
+                # check if current minute is  after or equal end minute and 
before start
+                return 0 if ($endMinute <= $minute && $minute < $startMinute );
+
                 #                              print "minute <> \n";
             }
         }

Modified: ipcop/trunk/updates/1.9.21/ROOTFILES.i486-1.9.21
===================================================================
--- ipcop/trunk/updates/1.9.21/ROOTFILES.i486-1.9.21    2011-09-07 06:45:08 UTC 
(rev 5837)
+++ ipcop/trunk/updates/1.9.21/ROOTFILES.i486-1.9.21    2011-09-07 19:41:44 UTC 
(rev 5838)
@@ -6,6 +6,7 @@
 /home/httpd/cgi-bin/proxy.cgi
 /usr/local/bin/emailhelper
 /usr/local/bin/monitorTraffic.pl
+/usr/local/bin/puzzleFwRules.pl
 /usr/share/locale/tr_TR/LC_MESSAGES/install.mo
 /usr/share/locale/tr_TR/LC_MESSAGES/ipcop.mo
 /var/ipcop/email/templates/test.de.tpl

Modified: ipcop/trunk/updates/1.9.21/information.xml
===================================================================
--- ipcop/trunk/updates/1.9.21/information.xml  2011-09-07 06:45:08 UTC (rev 
5837)
+++ ipcop/trunk/updates/1.9.21/information.xml  2011-09-07 19:41:44 UTC (rev 
5838)
@@ -5,6 +5,7 @@
         <size>0</size>
         <description>Language updates.&lt;br /&gt;
         Use utf-8 when sending system email (traffic warning etc.).&lt;br /&gt;
+        Fix SF bug #3403666, firewall timeframe rules.&lt;br /&gt;
         Upgrade apache httpd to 2.2.20</description>
         <previousversion>1.9.20</previousversion>
         <installdate>INSTALLDATE</installdate>

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Using storage to extend the benefits of virtualization and iSCSI
Virtualization increases hardware utilization and delivers a new level of
agility. Learn what those decisions are and how to modernize your storage 
and backup environments for virtualization.
http://www.accelacomm.com/jaw/sfnl/114/51434361/
_______________________________________________
Ipcop-svn mailing list
Ipcop-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-svn

Reply via email to