[pve-devel] r5304 - pve-common/trunk

svn-commits at proxmox.com svn-commits at proxmox.com
Tue Nov 9 11:50:24 CET 2010


Author: dietmar
Date: 2010-11-09 10:50:24 +0000 (Tue, 09 Nov 2010)
New Revision: 5304

Modified:
   pve-common/trunk/ChangeLog
   pve-common/trunk/JSONSchema.pm
Log:


Modified: pve-common/trunk/ChangeLog
===================================================================
--- pve-common/trunk/ChangeLog	2010-11-09 07:20:55 UTC (rev 5303)
+++ pve-common/trunk/ChangeLog	2010-11-09 10:50:24 UTC (rev 5304)
@@ -1,5 +1,9 @@
 2010-11-09  Proxmox Support Team  <support at proxmox.com>
 
+	* JSONSchema.pm (check_type): only allow '0' and '1' for boolean
+	values, because we often use perl directly to test (if
+	($param->{force}) ...)
+
 	* INotify.pm (read_vmlist): add parser for vmlist file.
 
 2010-11-08  Proxmox Support Team  <support at proxmox.com>

Modified: pve-common/trunk/JSONSchema.pm
===================================================================
--- pve-common/trunk/JSONSchema.pm	2010-11-09 07:20:55 UTC (rev 5303)
+++ pve-common/trunk/JSONSchema.pm	2010-11-09 10:50:24 UTC (rev 5304)
@@ -99,7 +99,7 @@
     my ($node, $noerr) = @_;
 
     # fixme: use better regex ?
-    if ($node !~ m/^[[:alnum:]\-]+$/) {
+    if ($node !~ m/^[A-Za-z][[:alnum:]\-]*[[:alnum:]]+$/) {
 	return undef if $noerr;
 	die "value does not look like a valid node name\n";
     }
@@ -226,9 +226,11 @@
 		if ($type eq 'string') {
 		    return 1; # nothing to check ?
 		} elsif ($type eq 'boolean') {
-		    if ($value =~ m/^(1|true|yes|on)$/i) {
+		    #if ($value =~ m/^(1|true|yes|on)$/i) {
+		    if ($value eq '1') {
 			return 1;
-		    } elsif ($value =~ m/^(0|false|no|off)$/i) {
+		    #} elsif ($value =~ m/^(0|false|no|off)$/i) {
+		    } elsif ($value eq '0') {
 			return 0;
 		    } else {
 			add_error($errors, $path, "type check ('$type') failed - got '$value'");




More information about the pve-devel mailing list