1
0
mirror of synced 2026-05-01 22:26:08 +00:00

Use Data::Validate::{Domain,IP} for IP addresses and hostname checks

Add corresponding dependencies on libdata-validate-{domain,ip}-perl.
This commit is contained in:
Axel Beckert
2013-07-10 22:38:29 +02:00
parent 74f35d6550
commit 699025f33e
3 changed files with 9 additions and 3 deletions

View File

@@ -794,6 +794,8 @@ use Getopt::Long;
use Pod::Usage;
use Data::Dumper;
use Data::Validate::URI qw/ is_uri /;
use Data::Validate::IP qw/ is_ipv4 /;
use Data::Validate::Domain qw/ is_hostname /;
use Xen::Tools::Common;
@@ -1452,15 +1454,15 @@ sub checkOption
message => "must be a disk device (xvd[a-z]+, sd[a-z]+).\n",
},
ipv4 => {
check => qr/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
check => sub { is_ipv4($_[0]) },
message => "must be valid IPv4.\n",
},
ipv4_or_auto => {
check => qr/^(?:auto|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))$/,
check => sub { is_ipv4($_[0]) or $_[0] eq 'auto' },
message => "must be valid IPv4 or the keyword 'auto'.\n",
},
hostname => {
check => qr/^[a-z0-9][a-z0-9.-]{0,254}$/i,
check => sub { is_hostname($_[0]) },
message => "must be a valid hostname.\n",
},
supportedFs => {

2
debian/changelog vendored
View File

@@ -54,6 +54,8 @@ xen-tools (4.4~dev-1) UNRELEASED; urgency=low
- Better documents and checks requirements for the --apt_proxy
value. (See #623443 for the corresponding apt issue.) Add dependency
on libdata-validate-uri-perl.
- Use Data::Validate::{Domain,IP} for IP addresses and hostname checks.
Add corresponding dependencies on libdata-validate-{domain,ip}-perl.
* Add debian/gbp.conf to be able to to build xen-tools with
git-buildpackage.
* Clean up debian/rules:

2
debian/control vendored
View File

@@ -20,6 +20,8 @@ Package: xen-tools
Architecture: all
Depends: debootstrap | cdebootstrap,
libconfig-inifiles-perl,
libdata-validate-domain-perl,
libdata-validate-ip-perl,
libdata-validate-uri-perl,
libfile-slurp-perl,
libfile-which-perl,