From: Bob Brewer <ipfire-devel@grantura.co.uk>
To: development@lists.ipfire.org
Subject: validfqdn
Date: Wed, 12 Dec 2018 22:48:00 +0000 [thread overview]
Message-ID: <pus370$nkt$1@tuscan3.grantura.co.uk> (raw)
[-- Attachment #1: Type: text/plain, Size: 1489 bytes --]
I am porting the old ipcop addon 'Banish' to IPFire and during testing have
found a problem in general-functions.pl which causes validfqdn to return 1
when testing valid and invalid ip addresses when it should return 0.
As this is not a problem with IPCop 2 a comparison of the validfqdn section
in IPFire's general-functions.pl shows a missing segment that checks the TLD
can only be a-z or A-Z.
Applying the patch below to general-functions.pl corrects the problem with
my Banish port and I haven't found any problems affecting IPFire's
operation.
Regards
Rob
--- /tmp/general-functions.pl 2018-09-19 10:32:37.000000000 +0100
+++ /tmp/general-functions.pl.new 2018-12-12 22:13:37.394653609 +0000
@@ -666,9 +666,13 @@
}
sub validfqdn
+# modified to add addition test to confirm TL is only a-z or A-Z
+# as per ipcop rwb 12/12/18
+
{
my $part;
-
+ my $tld;
+
# Checks a fully qualified domain name against RFC1035
my $fqdn = $_[0];
my @parts = split (/\./, $fqdn); # Split hostname at the '.'
@@ -689,7 +693,14 @@
# Last character can only be a letter or a digit
if (substr ($part, -1, 1) !~ /^[a-zA-Z0-9]*$/) {
return 0;}
- }
+ # Store for additional check on TLD
+ $tld = $part;
+ }
+
+ # TLD valid characters are a-z, A-Z
+ if ($tld !~ /^[a-zA-Z]*$/) {
+ return 0;
+ }
return 1;
}
next reply other threads:[~2018-12-12 22:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-12 22:48 Bob Brewer [this message]
2018-12-13 16:36 ` validfqdn Michael Tremer
2018-12-13 21:06 ` validfqdn Bob Brewer
2018-12-14 8:25 ` validfqdn Tapani Tarvainen
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='pus370$nkt$1@tuscan3.grantura.co.uk' \
--to=ipfire-devel@grantura.co.uk \
--cc=development@lists.ipfire.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