diff --git a/lib/backend.py b/lib/backend.py index 16b7bb9b47d63a0bf36ad6c2d7c31d360cedb346..7e9f2d2c85209926b76c71eb28c96eb573239330 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -1019,6 +1019,9 @@ def FindBlockDevice(disk): return rbd return (rbd.dev_path, rbd.major, rbd.minor) + rbd.GetSyncStatus() +def _IsJobQueueFile(file_name): + queue_dir = os.path.normpath(constants.QUEUE_DIR) + return os.path.commonprefix([queue_dir, file_name]) == queue_dir def UploadFile(file_name, data, mode, uid, gid, atime, mtime): """Write a file to the filesystem. @@ -1037,10 +1040,10 @@ def UploadFile(file_name, data, mode, uid, gid, atime, mtime): constants.ETC_HOSTS, constants.SSH_KNOWN_HOSTS_FILE, constants.VNC_PASSWORD_FILE, - constants.JOB_QUEUE_SERIAL_FILE, ] allowed_files.extend(ssconf.SimpleStore().GetFileList()) - if file_name not in allowed_files: + + if not (file_name in allowed_files or _IsJobQueueFile(file_name)): logging.error("Filename passed to UploadFile not in allowed" " upload targets: '%s'", file_name) return False