[pve-devel] r5999 - pve-common/trunk/data/PVE

svn-commits at proxmox.com svn-commits at proxmox.com
Thu May 19 10:06:38 CEST 2011


Author: dietmar
Date: 2011-05-19 10:06:38 +0200 (Thu, 19 May 2011)
New Revision: 5999

Modified:
   pve-common/trunk/data/PVE/JSONSchema.pm
Log:
impl. method to verify interface names


Modified: pve-common/trunk/data/PVE/JSONSchema.pm
===================================================================
--- pve-common/trunk/data/PVE/JSONSchema.pm	2011-05-18 12:08:39 UTC (rev 5998)
+++ pve-common/trunk/data/PVE/JSONSchema.pm	2011-05-19 08:06:38 UTC (rev 5999)
@@ -132,6 +132,18 @@
     return $email;
 }
 
+# network interface name
+register_format('pve-iface', \&pve_verify_iface);
+sub pve_verify_iface {
+    my ($id, $noerr) = @_;
+ 
+    if ($id !~ m/^[a-z][a-z0-9_]{1,20}$/i) {
+	return undef if $noerr;
+	die "invalid network interface name '$id'\n"; 
+    }
+    return $id;
+}
+
 sub check_format {
     my ($format, $value) = @_;
 




More information about the pve-devel mailing list