[pve-devel] [PATCH common 1/2] use better regex for remote ip check

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Nov 3 14:22:55 CET 2016


while the input should be correctly generated by the other site its
still better to be on the safe side, so check if the IP is really an
valid one.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 src/PVE/AbstractMigrate.pm | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/PVE/AbstractMigrate.pm b/src/PVE/AbstractMigrate.pm
index b58d459..140b479 100644
--- a/src/PVE/AbstractMigrate.pm
+++ b/src/PVE/AbstractMigrate.pm
@@ -95,8 +95,7 @@ sub get_remote_migration_ip {
     PVE::Tools::run_command($cmd, outfunc => sub {
 	my $line = shift;
 
-	# use non-restrictive regex for ip, its already checked by the remote side
-	if ($line =~ m/^ip: '(\S+)'$/) {
+	if ($line =~ m/^ip: '($PVE::Tools::IPRE)'$/) {
 	   $ip = $1;
 	}
     });
-- 
2.1.4





More information about the pve-devel mailing list