]> git.proxmox.com Git - pve-common.git/commitdiff
limit vmid with JSON format
authorDominik Csapak <d.csapak@proxmox.com>
Fri, 12 Feb 2016 10:43:23 +0000 (11:43 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 15 Feb 2016 11:52:54 +0000 (12:52 +0100)
if we do not do this, vmids < 100 (not really bad) and
vmids > 999999999 are possible, which can lead to vms which you can
only get rid of, if you delete the config files manually

also this makes the api consistent with the webgui for vmids

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/PVE/JSONSchema.pm

index 95529258f19c24535e09dae21dc54471da8b1d37..15e2c3c5bda6d9c34e6288684dad421628b2e59a 100644 (file)
@@ -137,7 +137,7 @@ register_format('pve-vmid', \&pve_verify_vmid);
 sub pve_verify_vmid {
     my ($vmid, $noerr) = @_;
 
-    if ($vmid !~ m/^[1-9][0-9]+$/) {
+    if ($vmid !~ m/^[1-9][0-9]{2,8}$/) {
        return undef if $noerr;
        die "value does not look like a valid VM ID\n";
     }