Commit afee8008 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Allow job queue files to be uploaded through ganeti-noded

This is needed for job queue replication.

Reviewed-by: iustinp
parent a87b4824
......@@ -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
......
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