From: Patrick McHardy <kaber@trash.net>
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH 2/2] datatype: less strict time parsing
Date: Sat, 11 Apr 2015 15:00:30 +0100 [thread overview]
Message-ID: <1428760830-6135-3-git-send-email-kaber@trash.net> (raw)
In-Reply-To: <1428760830-6135-1-git-send-email-kaber@trash.net>
Don't require hours to be in range 0-23 and minutes/seconds in range 0-59.
The time_type is used for relative times where it is entirely reasonable
to specify 180s instead of 3m.
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
src/datatype.c | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/src/datatype.c b/src/datatype.c
index 0772b50..1c83715 100644
--- a/src/datatype.c
+++ b/src/datatype.c
@@ -831,10 +831,6 @@ static struct error_record *time_type_parse(const struct expr *sym,
}
h = str2int(tmp, c, k);
k = 0;
- if (h > 23) {
- return error(&sym->location,
- "Hour needs to be 0-23");
- }
mask |= HOUR;
break;
case 'm':
@@ -844,10 +840,6 @@ static struct error_record *time_type_parse(const struct expr *sym,
}
m = str2int(tmp, c, k);
k = 0;
- if (m > 59) {
- return error(&sym->location,
- "Minute needs to be 0-59");
- }
mask |= MIN;
break;
case 's':
@@ -857,10 +849,6 @@ static struct error_record *time_type_parse(const struct expr *sym,
}
s = str2int(tmp, c, k);
k = 0;
- if (s > 59) {
- return error(&sym->location,
- "second needs to be 0-59");
- }
mask |= SECS;
break;
default:
--
2.1.0
next prev parent reply other threads:[~2015-04-11 14:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-11 14:00 [PATCH RFC 0/2] nftables: fix time parsing Patrick McHardy
2015-04-11 14:00 ` [PATCH 1/2] datatype: fix parsing of time type Patrick McHardy
2015-04-11 14:00 ` Patrick McHardy [this message]
2015-04-11 16:52 ` [PATCH RFC 0/2] nftables: fix time parsing Pablo Neira Ayuso
2015-04-11 17:25 ` Patrick McHardy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1428760830-6135-3-git-send-email-kaber@trash.net \
--to=kaber@trash.net \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).