[pve-devel] [PATCH 2/2] allow ipv6 addresses in Storage::verify_server
Wolfgang Bumiller
w.bumiller at proxmox.com
Wed May 20 15:19:42 CEST 2015
Replaced regex with existing PVE::JSONSchema::verify_... functions.
---
PVE/Storage/Plugin.pm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm
index eaae5b8..3c116c7 100644
--- a/PVE/Storage/Plugin.pm
+++ b/PVE/Storage/Plugin.pm
@@ -105,9 +105,9 @@ PVE::JSONSchema::register_format('pve-storage-server', \&verify_server);
sub verify_server {
my ($server, $noerr) = @_;
- # fixme: use better regex ?
- # IP or DNS name
- if ($server !~ m/^[[:alnum:]\-\.]+$/) {
+ if (!(PVE::JSONSchema::pve_verify_ip($server, 1) ||
+ PVE::JSONSchema::pve_verify_dns_name($server, 1))
+ {
return undef if $noerr;
die "value does not look like a valid server name or IP address\n";
}
--
2.1.4
More information about the pve-devel
mailing list