mirror of https://gitee.com/openkylin/libvirt.git
qemu: Clean up security driver initialisation and config file
Commit d0c0e79ac6
left behind some dead
code (hasDAC can't be efectively set to true, because
virSecurityManagerNew fails to load the "dac" driver).
This patch also enhances the condition for adding the default
auto-detected security manager if the manager array is allocated but
empty.
Also the configuration file for qemu driver still contains reference to
the DAC driver that can't be enabled manualy.
This commit is contained in:
parent
7444ccce4c
commit
46514ff752
|
@ -162,7 +162,9 @@
|
||||||
# driver at the same time, for this use a list of names separated by
|
# driver at the same time, for this use a list of names separated by
|
||||||
# comma and delimited by square brackets. For example:
|
# comma and delimited by square brackets. For example:
|
||||||
#
|
#
|
||||||
# security_driver = [ "selinux", "dac" ]
|
# security_driver = [ "selinux", "apparmor" ]
|
||||||
|
#
|
||||||
|
# Note: The DAC security driver is always enabled.
|
||||||
#
|
#
|
||||||
#security_driver = "selinux"
|
#security_driver = "selinux"
|
||||||
|
|
||||||
|
|
|
@ -251,14 +251,11 @@ qemuSecurityInit(struct qemud_driver *driver)
|
||||||
char **names;
|
char **names;
|
||||||
virSecurityManagerPtr mgr = NULL;
|
virSecurityManagerPtr mgr = NULL;
|
||||||
virSecurityManagerPtr stack = NULL;
|
virSecurityManagerPtr stack = NULL;
|
||||||
bool hasDAC = false;
|
|
||||||
|
|
||||||
if (driver->securityDriverNames) {
|
if (driver->securityDriverNames &&
|
||||||
|
driver->securityDriverNames[0]) {
|
||||||
names = driver->securityDriverNames;
|
names = driver->securityDriverNames;
|
||||||
while (names && *names) {
|
while (names && *names) {
|
||||||
if (STREQ("dac", *names))
|
|
||||||
hasDAC = true;
|
|
||||||
|
|
||||||
if (!(mgr = virSecurityManagerNew(*names,
|
if (!(mgr = virSecurityManagerNew(*names,
|
||||||
QEMU_DRIVER_NAME,
|
QEMU_DRIVER_NAME,
|
||||||
driver->allowDiskFormatProbing,
|
driver->allowDiskFormatProbing,
|
||||||
|
@ -287,7 +284,7 @@ qemuSecurityInit(struct qemud_driver *driver)
|
||||||
mgr = NULL;
|
mgr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasDAC && driver->privileged) {
|
if (driver->privileged) {
|
||||||
if (!(mgr = virSecurityManagerNewDAC(QEMU_DRIVER_NAME,
|
if (!(mgr = virSecurityManagerNewDAC(QEMU_DRIVER_NAME,
|
||||||
driver->user,
|
driver->user,
|
||||||
driver->group,
|
driver->group,
|
||||||
|
|
Loading…
Reference in New Issue