From 5c54c539114bec39a74ff95bda51a893a62a4d4c Mon Sep 17 00:00:00 2001 From: Jorj Bauer Date: Mon, 22 Feb 2016 09:22:56 -0500 Subject: [PATCH] fixed hostname regex --- DDNS.pm | 2 +- bin/add-vhost | 2 +- bin/del-vhost | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DDNS.pm b/DDNS.pm index 70e042e..280d62d 100644 --- a/DDNS.pm +++ b/DDNS.pm @@ -29,7 +29,7 @@ sub _validateOrDie { die "No domain provided" unless $dom; die "Invalid domain name (must end in a dot)" - unless ($dom =~ /^[a-zA-Z0-9\.]+\.$/); + unless ($dom =~ /^[a-zA-Z0-9\.\-\_]+\.$/); } sub _lookupOrDie { diff --git a/bin/add-vhost b/bin/add-vhost index e0016dd..51c9b4d 100755 --- a/bin/add-vhost +++ b/bin/add-vhost @@ -9,7 +9,7 @@ my $host = shift || die "No vhost provided"; my $master = shift || die "No master DNS IP provided"; die "Hostname must end in a dot" - unless ($host =~ /^[a-zA-Z0-9\.]+\.$/); + unless ($host =~ /^[a-zA-Z0-9\.\-\_]+\.$/); my $regex = $RE{net}{IPv4} . '|' . $RE{net}{IPv6}; die "Master must be an IPv4 or IPv6 address" diff --git a/bin/del-vhost b/bin/del-vhost index ee804ef..185a310 100755 --- a/bin/del-vhost +++ b/bin/del-vhost @@ -8,7 +8,7 @@ use Regexp::Common qw/net/; my $host = shift || die "No vhost provided"; die "Hostname must end in a dot" - unless ($host =~ /^[a-zA-Z0-9\.]+\.$/); + unless ($host =~ /^[a-zA-Z0-9\-\_\.]+\.$/); my $ddns = Martnet::DDNS->new(); $ddns->delvhost($host);