summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorFabrice MARIE <fabrice@celestix.com>2001-10-02 15:44:02 +0000
committerHarald Welte <laforge@gnumonks.org>2001-10-02 15:44:02 +0000
commit358a33ec17b3104f85d38cd745e06c8d55eded20 (patch)
tree2e2a4afd520c4f62be0df2bd483207112fd204b2 /extensions
parent3a87738aa6229b2be1ceb21af6ec28d3c84a1398 (diff)
Fabrice MARIE's patch, fixes bug in time parsing of list of days
Diffstat (limited to 'extensions')
-rw-r--r--extensions/libipt_time.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/extensions/libipt_time.c b/extensions/libipt_time.c
index d8dd5513..8fde010b 100644
--- a/extensions/libipt_time.c
+++ b/extensions/libipt_time.c
@@ -9,6 +9,8 @@
#include <linux/netfilter_ipv4/ipt_time.h>
#include <time.h>
+static int globaldays;
+
/* Function which prints out usage message. */
static void
help(void)
@@ -35,9 +37,9 @@ init(struct ipt_entry_match *m, unsigned int *nfcache)
{
/* caching not yet implemented */
*nfcache |= NFC_UNKNOWN;
+ globaldays = 0;
}
-
/**
* param: part1, a pointer on a string 2 chars maximum long string, that will contain the hours.
* param: part2, a pointer on a string 2 chars maximum long string, that will contain the minutes.
@@ -90,9 +92,9 @@ parse_time_string(unsigned int *hour, unsigned int *minute, const char *time)
{
/* if the number starts with 0, replace it with a space else
this string_to_number will interpret it as octal !! */
- if (hours[0] == '0')
+ if ((hours[0] == '0') && (hours[1] != '\0'))
hours[0] = ' ';
- if (minutes[0] == '0')
+ if ((minutes[0] == '0') && (minutes[1] != '\0'))
minutes[0] = ' ';
if((string_to_number(hours, 0, 23, hour) == -1) ||
@@ -172,7 +174,7 @@ parse(int c, char **argv, int invert, unsigned int *flags,
struct ipt_entry_match **match)
{
struct ipt_time_info *timeinfo = (struct ipt_time_info *)(*match)->data;
- int hours, minutes, days;
+ int hours, minutes;
switch (c)
{
@@ -209,8 +211,8 @@ parse(int c, char **argv, int invert, unsigned int *flags,
if (*flags & IPT_TIME_DAYS)
exit_error(PARAMETER_PROBLEM,
"Can't specify --days twice");
- parse_days_string(&days, optarg);
- timeinfo->days_match = days;
+ parse_days_string(&globaldays, optarg);
+ timeinfo->days_match = globaldays;
*flags |= IPT_TIME_DAYS;
break;
default: