From 9117783bc0a00b8e9935f5ab16bff22a36593fd7 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Thu, 23 Apr 2015 11:49:23 +0100 Subject: [PATCH] rng: fix port number range validation The PortNumber data type is declared to derive from 'short'. Unfortunately this is an signed type, so validates the range [-32,768, 32,767] which excludes valid port numbers between 32767 and 65535. We can't use 'unsignedShort', since we need -1 to be a valid port number too. This change is to use 'int' and set an explicit max boundary instead of relying on the data types' built-in max. One of the existing tests is changed to use a high port number to validate the schema. https://bugzilla.redhat.com/show_bug.cgi?id=1214664 Signed-off-by: Daniel P. Berrange (cherry picked from commit 615bdfda07b7a59125c16ac780762a07d97ef4fe) --- docs/schemas/basictypes.rng | 3 ++- tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.args | 2 +- tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.xml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng index 51771eb6e1..da1c0fdcfc 100644 --- a/docs/schemas/basictypes.rng +++ b/docs/schemas/basictypes.rng @@ -349,8 +349,9 @@ - + -1 + 65535 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.args index 1b61fcfa1c..34dc767e60 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.args @@ -1,4 +1,4 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ /usr/bin/qemu -S -M pc -m 214 -smp 1 -monitor unix:/tmp/test-monitor,server,nowait \ -no-acpi -boot c -usb -hda /dev/HostVG/QEMUGuest1 \ --net none -serial none -parallel none -vnc 127.0.0.1:0,share=allow-exclusive +-net none -serial none -parallel none -vnc 127.0.0.1:59630,share=allow-exclusive diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.xml index f78ff48554..4b88e492b4 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.xml @@ -25,7 +25,7 @@ - +