提交 8677a476 编写于 作者: M Michal Privoznik

qemu: Remove unused bypassSecurityDriver from qemuOpenFileAs

This argument is not used anymore. The only function that is
passing non-NULL (qemuDomainSaveMemory) does not actually care
for the value (after 23087cfd) and every other caller just
passes NULL anyway.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 e66f87ad
...@@ -152,7 +152,7 @@ static int qemuDomainManagedSaveLoad(virDomainObjPtr vm, ...@@ -152,7 +152,7 @@ static int qemuDomainManagedSaveLoad(virDomainObjPtr vm,
static int qemuOpenFileAs(uid_t fallback_uid, gid_t fallback_gid, static int qemuOpenFileAs(uid_t fallback_uid, gid_t fallback_gid,
bool dynamicOwnership, bool dynamicOwnership,
const char *path, int oflags, const char *path, int oflags,
bool *needUnlink, bool *bypassSecurityDriver); bool *needUnlink);
static int qemuGetDHCPInterfaces(virDomainPtr dom, static int qemuGetDHCPInterfaces(virDomainPtr dom,
virDomainObjPtr vm, virDomainObjPtr vm,
...@@ -2984,9 +2984,6 @@ qemuCompressGetCommand(virQEMUSaveFormat compression) ...@@ -2984,9 +2984,6 @@ qemuCompressGetCommand(virQEMUSaveFormat compression)
* @path: path to file to open * @path: path to file to open
* @oflags: flags for opening/creation of the file * @oflags: flags for opening/creation of the file
* @needUnlink: set to true if file was created by this function * @needUnlink: set to true if file was created by this function
* @bypassSecurityDriver: optional pointer to a boolean that will be set to true
* if security driver operations are pointless (due to
* NFS mount)
* *
* Internal function to properly create or open existing files, with * Internal function to properly create or open existing files, with
* ownership affected by qemu driver setup and domain DAC label. * ownership affected by qemu driver setup and domain DAC label.
...@@ -3001,8 +2998,7 @@ qemuOpenFile(virQEMUDriverPtr driver, ...@@ -3001,8 +2998,7 @@ qemuOpenFile(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
const char *path, const char *path,
int oflags, int oflags,
bool *needUnlink, bool *needUnlink)
bool *bypassSecurityDriver)
{ {
int ret = -1; int ret = -1;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
...@@ -3021,7 +3017,7 @@ qemuOpenFile(virQEMUDriverPtr driver, ...@@ -3021,7 +3017,7 @@ qemuOpenFile(virQEMUDriverPtr driver,
goto cleanup; goto cleanup;
ret = qemuOpenFileAs(user, group, dynamicOwnership, ret = qemuOpenFileAs(user, group, dynamicOwnership,
path, oflags, needUnlink, bypassSecurityDriver); path, oflags, needUnlink);
cleanup: cleanup:
return ret; return ret;
...@@ -3031,12 +3027,11 @@ static int ...@@ -3031,12 +3027,11 @@ static int
qemuOpenFileAs(uid_t fallback_uid, gid_t fallback_gid, qemuOpenFileAs(uid_t fallback_uid, gid_t fallback_gid,
bool dynamicOwnership, bool dynamicOwnership,
const char *path, int oflags, const char *path, int oflags,
bool *needUnlink, bool *bypassSecurityDriver) bool *needUnlink)
{ {
struct stat sb; struct stat sb;
bool is_reg = true; bool is_reg = true;
bool need_unlink = false; bool need_unlink = false;
bool bypass_security = false;
unsigned int vfoflags = 0; unsigned int vfoflags = 0;
int fd = -1; int fd = -1;
int path_shared = virFileIsSharedFS(path); int path_shared = virFileIsSharedFS(path);
...@@ -3134,19 +3129,11 @@ qemuOpenFileAs(uid_t fallback_uid, gid_t fallback_gid, ...@@ -3134,19 +3129,11 @@ qemuOpenFileAs(uid_t fallback_uid, gid_t fallback_gid,
path); path);
goto cleanup; goto cleanup;
} }
/* Since we had to setuid to create the file, and the fstype
is NFS, we assume it's a root-squashing NFS share, and that
the security driver stuff would have failed anyway */
bypass_security = true;
} }
} }
cleanup: cleanup:
if (needUnlink) if (needUnlink)
*needUnlink = need_unlink; *needUnlink = need_unlink;
if (bypassSecurityDriver)
*bypassSecurityDriver = bypass_security;
return fd; return fd;
error: error:
...@@ -3198,7 +3185,6 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver, ...@@ -3198,7 +3185,6 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver,
unsigned int flags, unsigned int flags,
qemuDomainAsyncJob asyncJob) qemuDomainAsyncJob asyncJob)
{ {
bool bypassSecurityDriver = false;
bool needUnlink = false; bool needUnlink = false;
int ret = -1; int ret = -1;
int fd = -1; int fd = -1;
...@@ -3218,7 +3204,7 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver, ...@@ -3218,7 +3204,7 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver,
} }
fd = qemuOpenFile(driver, vm, path, fd = qemuOpenFile(driver, vm, path,
O_WRONLY | O_TRUNC | O_CREAT | directFlag, O_WRONLY | O_TRUNC | O_CREAT | directFlag,
&needUnlink, &bypassSecurityDriver); &needUnlink);
if (fd < 0) if (fd < 0)
goto cleanup; goto cleanup;
...@@ -3249,7 +3235,7 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver, ...@@ -3249,7 +3235,7 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver,
if (qemuFileWrapperFDClose(vm, wrapperFd) < 0) if (qemuFileWrapperFDClose(vm, wrapperFd) < 0)
goto cleanup; goto cleanup;
if ((fd = qemuOpenFile(driver, vm, path, O_WRONLY, NULL, NULL)) < 0 || if ((fd = qemuOpenFile(driver, vm, path, O_WRONLY, NULL)) < 0 ||
virQEMUSaveDataFinish(data, &fd, path) < 0) virQEMUSaveDataFinish(data, &fd, path) < 0)
goto cleanup; goto cleanup;
...@@ -3809,7 +3795,7 @@ doCoreDump(virQEMUDriverPtr driver, ...@@ -3809,7 +3795,7 @@ doCoreDump(virQEMUDriverPtr driver,
* created. */ * created. */
if ((fd = qemuOpenFile(driver, vm, path, if ((fd = qemuOpenFile(driver, vm, path,
O_CREAT | O_TRUNC | O_WRONLY | directFlag, O_CREAT | O_TRUNC | O_WRONLY | directFlag,
NULL, NULL)) < 0) NULL)) < 0)
goto cleanup; goto cleanup;
if (!(wrapperFd = virFileWrapperFdNew(&fd, path, flags))) if (!(wrapperFd = virFileWrapperFdNew(&fd, path, flags)))
...@@ -6419,7 +6405,7 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver, ...@@ -6419,7 +6405,7 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
if (!(caps = virQEMUDriverGetCapabilities(driver, false))) if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
goto error; goto error;
if ((fd = qemuOpenFile(driver, NULL, path, oflags, NULL, NULL)) < 0) if ((fd = qemuOpenFile(driver, NULL, path, oflags, NULL)) < 0)
goto error; goto error;
if (bypass_cache && if (bypass_cache &&
!(*wrapperFd = virFileWrapperFdNew(&fd, path, !(*wrapperFd = virFileWrapperFdNew(&fd, path,
...@@ -11863,7 +11849,7 @@ qemuDomainStorageOpenStat(virQEMUDriverPtr driver, ...@@ -11863,7 +11849,7 @@ qemuDomainStorageOpenStat(virQEMUDriverPtr driver,
{ {
if (virStorageSourceIsLocalStorage(src)) { if (virStorageSourceIsLocalStorage(src)) {
if ((*ret_fd = qemuOpenFile(driver, vm, src->path, O_RDONLY, if ((*ret_fd = qemuOpenFile(driver, vm, src->path, O_RDONLY,
NULL, NULL)) < 0) NULL)) < 0)
return -1; return -1;
if (fstat(*ret_fd, ret_sb) < 0) { if (fstat(*ret_fd, ret_sb) < 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册