Revision cf00dba0
b/lib/backend.py | ||
---|---|---|
668 | 668 |
blockdevs = {} |
669 | 669 |
|
670 | 670 |
for devpath in devices: |
671 |
if os.path.commonprefix([DEV_PREFIX, devpath]) != DEV_PREFIX:
|
|
671 |
if not utils.IsBelowDir(DEV_PREFIX, devpath):
|
|
672 | 672 |
continue |
673 | 673 |
|
674 | 674 |
try: |
... | ... | |
2507 | 2507 |
fs_dir = os.path.normpath(fs_dir) |
2508 | 2508 |
base_fstore = cfg.GetFileStorageDir() |
2509 | 2509 |
base_shared = cfg.GetSharedFileStorageDir() |
2510 |
if ((os.path.commonprefix([fs_dir, base_fstore]) != base_fstore) and
|
|
2511 |
(os.path.commonprefix([fs_dir, base_shared]) != base_shared)):
|
|
2510 |
if not (utils.IsBelowDir(base_fstore, fs_dir) or
|
|
2511 |
utils.IsBelowDir(base_shared, fs_dir)):
|
|
2512 | 2512 |
_Fail("File storage directory '%s' is not under base file" |
2513 | 2513 |
" storage directory '%s' or shared storage directory '%s'", |
2514 | 2514 |
fs_dir, base_fstore, base_shared) |
b/lib/utils/io.py | ||
---|---|---|
502 | 502 |
if not IsNormAbsPath(result): |
503 | 503 |
raise ValueError("Invalid parameters to PathJoin: '%s'" % str(args)) |
504 | 504 |
# check that we're still under the original prefix |
505 |
prefix = os.path.commonprefix([root, result]) |
|
506 |
if prefix != root: |
|
505 |
if not IsBelowDir(root, result): |
|
507 | 506 |
raise ValueError("Error: path joining resulted in different prefix" |
508 |
" (%s != %s)" % (prefix, root))
|
|
507 |
" (%s != %s)" % (result, root))
|
|
509 | 508 |
return result |
510 | 509 |
|
511 | 510 |
|
Also available in: Unified diff