Commit 4f5277e7 authored by Guido Trotter's avatar Guido Trotter
Browse files

Hypervisors: make absolute path checking strict



Use the new utils.IsAbsNormPath function, rather than just os.path.isabs
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent da961187
......@@ -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
......
......@@ -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,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment