Hypervisors: make absolute path checking strict
authorGuido Trotter <ultrotter@google.com>
Fri, 22 May 2009 12:48:27 +0000 (13:48 +0100)
committerGuido Trotter <ultrotter@google.com>
Fri, 22 May 2009 12:58:50 +0000 (13:58 +0100)
Use the new utils.IsAbsNormPath function, rather than just os.path.isabs

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

lib/hypervisor/hv_base.py
lib/hypervisor/hv_kvm.py

index 442cd81..c055a72 100644 (file)
@@ -49,11 +49,11 @@ from ganeti import utils
 # _CHECK values
 
 # must be afile
-_FILE_CHECK = (os.path.isabs, "must be an absolute path",
+_FILE_CHECK = (utils.IsNormAbsPath, "must be an absolute normal path",
               os.path.isfile, "not found or not a file")
 
 # must be a directory
-_DIR_CHECK = (os.path.isabs, "must be an absolute path",
+_DIR_CHECK = (utils.IsNormAbsPath, "must be an absolute normal path",
              os.path.isdir, "not found or not a directory")
 
 # nice wrappers for users
index fdfc28a..507e23a 100644 (file)
@@ -56,7 +56,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
     constants.HV_ACPI: hv_base.NO_CHECK,
     constants.HV_SERIAL_CONSOLE: hv_base.NO_CHECK,
     constants.HV_VNC_BIND_ADDRESS: \
-    (False, lambda x: (utils.IsValidIP(x) or os.path.isabs(x)),
+    (False, lambda x: (utils.IsValidIP(x) or utils.IsAbsNormPath(x)),
      "the VNC bind address must be either a valid IP address or an absolute"
      " pathname", None, None),
     constants.HV_VNC_TLS: hv_base.NO_CHECK,