summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2002-11-25 17:07:33 +0000
committerFrancois Pons <fpons@mandriva.com>2002-11-25 17:07:33 +0000
commite6679c0eb25148c5261dbf03acacd6ded48cecac (patch)
tree5f714e86263c814a62e532f520c4460210edd8de
parent052cc148ef719c9a8824475128c3bdbfcabbce0a (diff)
downloaddrakx-e6679c0eb25148c5261dbf03acacd6ded48cecac.tar
drakx-e6679c0eb25148c5261dbf03acacd6ded48cecac.tar.gz
drakx-e6679c0eb25148c5261dbf03acacd6ded48cecac.tar.bz2
drakx-e6679c0eb25148c5261dbf03acacd6ded48cecac.tar.xz
drakx-e6679c0eb25148c5261dbf03acacd6ded48cecac.zip
added is_domain_name that checks validity of a domain name.
-rw-r--r--perl-install/network/network.pm5
1 files changed, 5 insertions, 0 deletions
diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm
index 1594aba32..55d5c324b 100644
--- a/perl-install/network/network.pm
+++ b/perl-install/network/network.pm
@@ -221,6 +221,11 @@ sub is_ip {
return if grep { $_ < 0 || $_ > 255 } @fields;
@fields;
}
+sub is_domain_name {
+ my ($name) = @_;
+ my @fields = split /\./, $name;
+ $name !~ /\.$/ && @fields > 0 && @fields == grep { /^[[:alnum:]](?:[\-[:alnum:]]{0,61}[[:alnum:]])?$/ } @fields;
+}
sub netmask {
my ($ip) = @_;