From: "Daniel P. Berrange" <berrange(a)redhat.com>
Update the security drivers to use virReportError instead of
the virSecurityReportError custom macro
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
cfg.mk | 1 -
src/security/security_apparmor.c | 94 ++++++++++++++++-----------------
src/security/security_driver.c | 8 +--
src/security/security_manager.c | 50 +++++++++---------
src/security/security_manager.h | 5 --
src/security/security_selinux.c | 106 +++++++++++++++++++-------------------
6 files changed, 130 insertions(+), 134 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index d7691a3..434bbe1 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -532,7 +532,6 @@ msg_gen_function += virRaiseError
msg_gen_function += virReportError
msg_gen_function += virReportErrorHelper
msg_gen_function += virReportSystemError
-msg_gen_function += virSecurityReportError
msg_gen_function += xenapiSessionErrorHandler
# Uncomment the following and run "make syntax-check" to see diagnostics
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index 62af3c6..8c95f78 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -238,8 +238,8 @@ use_apparmor(void)
char *libvirt_daemon = NULL;
if (virFileResolveLink("/proc/self/exe", &libvirt_daemon) < 0) {
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("could not find libvirtd"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("could not find libvirtd"));
return rc;
}
@@ -275,10 +275,10 @@ reload_profile(virSecurityManagerPtr mgr,
/* Update the profile only if it is loaded */
if (profile_loaded(secdef->imagelabel) >= 0) {
if (load_profile(mgr, secdef->imagelabel, def, fn, append) < 0) {
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- _("cannot update AppArmor profile "
- "\'%s\'"),
- secdef->imagelabel);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot update AppArmor profile "
+ "\'%s\'"),
+ secdef->imagelabel);
goto clean;
}
}
@@ -299,10 +299,10 @@ AppArmorSetSecurityUSBLabel(usbDevice *dev ATTRIBUTE_UNUSED,
if (reload_profile(ptr->mgr, def, file, true) < 0) {
const virSecurityLabelDefPtr secdef = &def->seclabel;
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- _("cannot update AppArmor profile "
- "\'%s\'"),
- secdef->imagelabel);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot update AppArmor profile "
+ "\'%s\'"),
+ secdef->imagelabel);
return -1;
}
return 0;
@@ -317,10 +317,10 @@ AppArmorSetSecurityPCILabel(pciDevice *dev ATTRIBUTE_UNUSED,
if (reload_profile(ptr->mgr, def, file, true) < 0) {
const virSecurityLabelDefPtr secdef = &def->seclabel;
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- _("cannot update AppArmor profile "
- "\'%s\'"),
- secdef->imagelabel);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot update AppArmor profile "
+ "\'%s\'"),
+ secdef->imagelabel);
return -1;
}
return 0;
@@ -347,8 +347,8 @@ AppArmorSecurityManagerProbe(const char *virtDriver)
}
if (!virFileExists(template)) {
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- _("template \'%s\' does not exist"),
template);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("template \'%s\' does not exist"), template);
goto clean;
}
rc = SECURITY_DRIVER_ENABLE;
@@ -403,16 +403,16 @@ AppArmorGenSecurityLabel(virSecurityManagerPtr mgr
ATTRIBUTE_UNUSED,
return 0;
if (def->seclabel.baselabel) {
- virSecurityReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- "%s", _("Cannot set a base label with
AppArmour"));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ "%s", _("Cannot set a base label with
AppArmour"));
return rc;
}
if ((def->seclabel.label) ||
(def->seclabel.model) || (def->seclabel.imagelabel)) {
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- "%s",
- _("security label already defined for VM"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s",
+ _("security label already defined for VM"));
return rc;
}
@@ -441,9 +441,9 @@ AppArmorGenSecurityLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
/* Now that we have a label, load the profile into the kernel. */
if (load_profile(mgr, def->seclabel.label, def, NULL, false) < 0) {
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- _("cannot load AppArmor profile "
- "\'%s\'"), def->seclabel.label);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot load AppArmor profile "
+ "\'%s\'"), def->seclabel.label);
goto err;
}
@@ -493,14 +493,14 @@ AppArmorGetSecurityProcessLabel(virSecurityManagerPtr mgr
ATTRIBUTE_UNUSED,
if (virStrcpy(sec->label, profile_name,
VIR_SECURITY_LABEL_BUFLEN) == NULL) {
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("error copying profile
name"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("error copying profile name"));
goto clean;
}
if ((sec->enforcing = profile_status(profile_name, 1)) < 0) {
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("error calling
profile_status()"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("error calling profile_status()"));
goto clean;
}
rc = 0;
@@ -538,9 +538,9 @@ AppArmorRestoreSecurityAllLabel(virSecurityManagerPtr mgr
ATTRIBUTE_UNUSED,
if (secdef->type == VIR_DOMAIN_SECLABEL_DYNAMIC) {
if ((rc = remove_profile(secdef->label)) != 0) {
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- _("could not remove profile for
\'%s\'"),
- secdef->label);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("could not remove profile for \'%s\'"),
+ secdef->label);
}
}
return rc;
@@ -560,18 +560,18 @@ AppArmorSetSecurityProcessLabel(virSecurityManagerPtr mgr,
virDomainDefPtr def)
return rc;
if (STRNEQ(virSecurityManagerGetModel(mgr), secdef->model)) {
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- _("security label driver mismatch: "
- "\'%s\' model configured for domain, but
"
- "hypervisor driver is \'%s\'."),
- secdef->model, virSecurityManagerGetModel(mgr));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("security label driver mismatch: "
+ "\'%s\' model configured for domain, but "
+ "hypervisor driver is \'%s\'."),
+ secdef->model, virSecurityManagerGetModel(mgr));
if (use_apparmor() > 0)
goto clean;
}
if (aa_change_profile(profile_name) < 0) {
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("error calling aa_change_profile()"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("error calling aa_change_profile()"));
goto clean;
}
rc = 0;
@@ -634,8 +634,8 @@ AppArmorSetSecurityImageLabel(virSecurityManagerPtr mgr,
if (secdef->imagelabel) {
/* if the device doesn't exist, error out */
if (!virFileExists(disk->src)) {
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- _("\'%s\' does not exist"),
disk->src);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("\'%s\' does not exist"), disk->src);
return rc;
}
@@ -646,10 +646,10 @@ AppArmorSetSecurityImageLabel(virSecurityManagerPtr mgr,
if (profile_loaded(secdef->imagelabel) >= 0) {
if (load_profile(mgr, secdef->imagelabel, def, disk->src,
false) < 0) {
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- _("cannot update AppArmor profile "
- "\'%s\'"),
- secdef->imagelabel);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot update AppArmor profile "
+ "\'%s\'"),
+ secdef->imagelabel);
goto clean;
}
}
@@ -670,9 +670,9 @@ AppArmorSecurityVerify(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
if (secdef->type == VIR_DOMAIN_SECLABEL_STATIC) {
if (use_apparmor() < 0 || profile_status(secdef->label, 0) < 0) {
- virSecurityReportError(VIR_ERR_XML_ERROR,
- _("Invalid security label \'%s\'"),
- secdef->label);
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Invalid security label \'%s\'"),
+ secdef->label);
return -1;
}
}
diff --git a/src/security/security_driver.c b/src/security/security_driver.c
index 0f21d7a..5cc6178 100644
--- a/src/security/security_driver.c
+++ b/src/security/security_driver.c
@@ -28,6 +28,8 @@
#include "security_nop.h"
+#define VIR_FROM_THIS VIR_FROM_SECURITY
+
static virSecurityDriverPtr security_drivers[] = {
#ifdef WITH_SECDRIVER_SELINUX
&virSecurityDriverSELinux,
@@ -69,9 +71,9 @@ virSecurityDriverPtr virSecurityDriverLookup(const char *name,
}
if (!drv) {
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- _("Security driver %s not found"),
- NULLSTR(name));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Security driver %s not found"),
+ NULLSTR(name));
return NULL;
}
diff --git a/src/security/security_manager.c b/src/security/security_manager.c
index 8ec4d3e..e7d0360 100644
--- a/src/security/security_manager.c
+++ b/src/security/security_manager.c
@@ -125,8 +125,8 @@ virSecurityManagerPtr virSecurityManagerNew(const char *name,
/* driver "none" needs some special handling of *Confined bools */
if (STREQ(drv->name, "none")) {
if (requireConfined) {
- virSecurityReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("Security driver \"none\" cannot create confined
guests"));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Security driver \"none\" cannot create
confined guests"));
return NULL;
}
@@ -180,7 +180,7 @@ virSecurityManagerGetDOI(virSecurityManagerPtr mgr)
if (mgr->drv->getDOI)
return mgr->drv->getDOI(mgr);
- virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return NULL;
}
@@ -190,7 +190,7 @@ virSecurityManagerGetModel(virSecurityManagerPtr mgr)
if (mgr->drv->getModel)
return mgr->drv->getModel(mgr);
- virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return NULL;
}
@@ -216,7 +216,7 @@ int virSecurityManagerRestoreImageLabel(virSecurityManagerPtr mgr,
if (mgr->drv->domainRestoreSecurityImageLabel)
return mgr->drv->domainRestoreSecurityImageLabel(mgr, vm, disk);
- virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}
@@ -226,7 +226,7 @@ int virSecurityManagerSetDaemonSocketLabel(virSecurityManagerPtr mgr,
if (mgr->drv->domainSetSecurityDaemonSocketLabel)
return mgr->drv->domainSetSecurityDaemonSocketLabel(mgr, vm);
- virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}
@@ -236,7 +236,7 @@ int virSecurityManagerSetSocketLabel(virSecurityManagerPtr mgr,
if (mgr->drv->domainSetSecuritySocketLabel)
return mgr->drv->domainSetSecuritySocketLabel(mgr, vm);
- virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}
@@ -246,7 +246,7 @@ int virSecurityManagerClearSocketLabel(virSecurityManagerPtr mgr,
if (mgr->drv->domainClearSecuritySocketLabel)
return mgr->drv->domainClearSecuritySocketLabel(mgr, vm);
- virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}
@@ -257,7 +257,7 @@ int virSecurityManagerSetImageLabel(virSecurityManagerPtr mgr,
if (mgr->drv->domainSetSecurityImageLabel)
return mgr->drv->domainSetSecurityImageLabel(mgr, vm, disk);
- virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}
@@ -268,7 +268,7 @@ int virSecurityManagerRestoreHostdevLabel(virSecurityManagerPtr mgr,
if (mgr->drv->domainRestoreSecurityHostdevLabel)
return mgr->drv->domainRestoreSecurityHostdevLabel(mgr, vm, dev);
- virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}
@@ -279,7 +279,7 @@ int virSecurityManagerSetHostdevLabel(virSecurityManagerPtr mgr,
if (mgr->drv->domainSetSecurityHostdevLabel)
return mgr->drv->domainSetSecurityHostdevLabel(mgr, vm, dev);
- virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}
@@ -290,7 +290,7 @@ int virSecurityManagerSetSavedStateLabel(virSecurityManagerPtr mgr,
if (mgr->drv->domainSetSavedStateLabel)
return mgr->drv->domainSetSavedStateLabel(mgr, vm, savefile);
- virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}
@@ -301,7 +301,7 @@ int virSecurityManagerRestoreSavedStateLabel(virSecurityManagerPtr
mgr,
if (mgr->drv->domainRestoreSavedStateLabel)
return mgr->drv->domainRestoreSavedStateLabel(mgr, vm, savefile);
- virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}
@@ -317,15 +317,15 @@ int virSecurityManagerGenLabel(virSecurityManagerPtr mgr,
if ((vm->seclabel.type == VIR_DOMAIN_SECLABEL_NONE) &&
mgr->requireConfined) {
- virSecurityReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("Unconfined guests are not allowed on this
host"));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Unconfined guests are not allowed on this host"));
return -1;
}
if (mgr->drv->domainGenSecurityLabel)
return mgr->drv->domainGenSecurityLabel(mgr, vm);
- virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}
@@ -336,7 +336,7 @@ int virSecurityManagerReserveLabel(virSecurityManagerPtr mgr,
if (mgr->drv->domainReserveSecurityLabel)
return mgr->drv->domainReserveSecurityLabel(mgr, vm, pid);
- virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}
@@ -346,7 +346,7 @@ int virSecurityManagerReleaseLabel(virSecurityManagerPtr mgr,
if (mgr->drv->domainReleaseSecurityLabel)
return mgr->drv->domainReleaseSecurityLabel(mgr, vm);
- virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}
@@ -357,7 +357,7 @@ int virSecurityManagerSetAllLabel(virSecurityManagerPtr mgr,
if (mgr->drv->domainSetSecurityAllLabel)
return mgr->drv->domainSetSecurityAllLabel(mgr, vm, stdin_path);
- virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}
@@ -368,7 +368,7 @@ int virSecurityManagerRestoreAllLabel(virSecurityManagerPtr mgr,
if (mgr->drv->domainRestoreSecurityAllLabel)
return mgr->drv->domainRestoreSecurityAllLabel(mgr, vm, migrated);
- virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}
@@ -380,7 +380,7 @@ int virSecurityManagerGetProcessLabel(virSecurityManagerPtr mgr,
if (mgr->drv->domainGetSecurityProcessLabel)
return mgr->drv->domainGetSecurityProcessLabel(mgr, vm, pid, sec);
- virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}
@@ -390,7 +390,7 @@ int virSecurityManagerSetProcessLabel(virSecurityManagerPtr mgr,
if (mgr->drv->domainSetSecurityProcessLabel)
return mgr->drv->domainSetSecurityProcessLabel(mgr, vm);
- virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}
@@ -408,7 +408,7 @@ int virSecurityManagerVerify(virSecurityManagerPtr mgr,
if (mgr->drv->domainSecurityVerify)
return mgr->drv->domainSecurityVerify(mgr, def);
- virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}
@@ -419,7 +419,7 @@ int virSecurityManagerSetImageFDLabel(virSecurityManagerPtr mgr,
if (mgr->drv->domainSetSecurityImageFDLabel)
return mgr->drv->domainSetSecurityImageFDLabel(mgr, vm, fd);
- virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}
@@ -431,7 +431,7 @@ char *virSecurityManagerGetMountOptions(virSecurityManagerPtr mgr,
/*
I don't think this is an error, these should be optional
- virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
*/
return NULL;
}
diff --git a/src/security/security_manager.h b/src/security/security_manager.h
index f0bf60d..af16e75 100644
--- a/src/security/security_manager.h
+++ b/src/security/security_manager.h
@@ -23,11 +23,6 @@
#ifndef VIR_SECURITY_MANAGER_H__
# define VIR_SECURITY_MANAGER_H__
-# define virSecurityReportError(code, ...) \
- virReportErrorHelper(VIR_FROM_SECURITY, code, __FILE__, \
- __FUNCTION__, __LINE__, __VA_ARGS__)
-
-
typedef struct _virSecurityManager virSecurityManager;
typedef virSecurityManager *virSecurityManagerPtr;
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index ffa65fb..a9e704d 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -277,29 +277,29 @@ SELinuxGenSecurityLabel(virSecurityManagerPtr mgr,
if ((def->seclabel.type == VIR_DOMAIN_SECLABEL_DYNAMIC) &&
!def->seclabel.baselabel &&
def->seclabel.model) {
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("security model already defined for
VM"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("security model already defined for
VM"));
return rc;
}
if (def->seclabel.type == VIR_DOMAIN_SECLABEL_DYNAMIC &&
def->seclabel.label) {
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("security label already defined for
VM"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("security label already defined for
VM"));
return rc;
}
if (def->seclabel.imagelabel) {
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("security image label already
defined for VM"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("security image label already defined for
VM"));
return rc;
}
if (def->seclabel.model &&
STRNEQ(def->seclabel.model, SECURITY_SELINUX_NAME)) {
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- _("security label model %s is not supported with
selinux"),
- def->seclabel.model);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("security label model %s is not supported with
selinux"),
+ def->seclabel.model);
return rc;
}
@@ -350,8 +350,8 @@ SELinuxGenSecurityLabel(virSecurityManagerPtr mgr,
def->seclabel.baselabel :
data->domain_context, mcs);
if (! def->seclabel.label) {
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- _("cannot generate selinux context for %s"),
mcs);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot generate selinux context for %s"), mcs);
goto cleanup;
}
break;
@@ -361,17 +361,17 @@ SELinuxGenSecurityLabel(virSecurityManagerPtr mgr,
break;
default:
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- _("unexpected security label type
'%s'"),
- virDomainSeclabelTypeToString(def->seclabel.type));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unexpected security label type '%s'"),
+ virDomainSeclabelTypeToString(def->seclabel.type));
goto cleanup;
}
if (!def->seclabel.norelabel) {
def->seclabel.imagelabel = SELinuxGenNewContext(data->file_context, mcs);
if (!def->seclabel.imagelabel) {
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- _("cannot generate selinux context for %s"),
mcs);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot generate selinux context for %s"), mcs);
goto cleanup;
}
}
@@ -517,10 +517,10 @@ SELinuxGetSecurityProcessLabel(virSecurityManagerPtr mgr
ATTRIBUTE_UNUSED,
}
if (strlen((char *) ctx) >= VIR_SECURITY_LABEL_BUFLEN) {
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- _("security label exceeds "
- "maximum length: %d"),
- VIR_SECURITY_LABEL_BUFLEN - 1);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("security label exceeds "
+ "maximum length: %d"),
+ VIR_SECURITY_LABEL_BUFLEN - 1);
freecon(ctx);
return -1;
}
@@ -1106,9 +1106,9 @@ SELinuxRestoreSecuritySmartcardCallback(virDomainDefPtr def,
return SELinuxRestoreSecurityChardevLabel(def, &dev->data.passthru);
default:
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- _("unknown smartcard type %d"),
- dev->type);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unknown smartcard type %d"),
+ dev->type);
return -1;
}
@@ -1225,18 +1225,18 @@ SELinuxSecurityVerify(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
{
const virSecurityLabelDefPtr secdef = &def->seclabel;
if (!STREQ(virSecurityManagerGetModel(mgr), secdef->model)) {
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- _("security label driver mismatch: "
- "'%s' model configured for domain, but
"
- "hypervisor driver is '%s'."),
- secdef->model, virSecurityManagerGetModel(mgr));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("security label driver mismatch: "
+ "'%s' model configured for domain, but "
+ "hypervisor driver is '%s'."),
+ secdef->model, virSecurityManagerGetModel(mgr));
return -1;
}
if (secdef->type == VIR_DOMAIN_SECLABEL_STATIC) {
if (security_check_context(secdef->label) != 0) {
- virSecurityReportError(VIR_ERR_XML_ERROR,
- _("Invalid security label %s"),
secdef->label);
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Invalid security label %s"), secdef->label);
return -1;
}
}
@@ -1255,11 +1255,11 @@ SELinuxSetSecurityProcessLabel(virSecurityManagerPtr mgr,
return 0;
if (!STREQ(virSecurityManagerGetModel(mgr), secdef->model)) {
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- _("security label driver mismatch: "
- "'%s' model configured for domain, but
"
- "hypervisor driver is '%s'."),
- secdef->model, virSecurityManagerGetModel(mgr));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("security label driver mismatch: "
+ "'%s' model configured for domain, but "
+ "hypervisor driver is '%s'."),
+ secdef->model, virSecurityManagerGetModel(mgr));
if (security_getenforce() == 1)
return -1;
}
@@ -1290,11 +1290,11 @@ SELinuxSetSecurityDaemonSocketLabel(virSecurityManagerPtr mgr,
return 0;
if (!STREQ(virSecurityManagerGetModel(mgr), secdef->model)) {
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- _("security label driver mismatch: "
- "'%s' model configured for domain, but
"
- "hypervisor driver is '%s'."),
- secdef->model, virSecurityManagerGetModel(mgr));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("security label driver mismatch: "
+ "'%s' model configured for domain, but "
+ "hypervisor driver is '%s'."),
+ secdef->model, virSecurityManagerGetModel(mgr));
goto done;
}
@@ -1357,11 +1357,11 @@ SELinuxSetSecuritySocketLabel(virSecurityManagerPtr mgr,
return 0;
if (!STREQ(virSecurityManagerGetModel(mgr), secdef->model)) {
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- _("security label driver mismatch: "
- "'%s' model configured for domain, but
"
- "hypervisor driver is '%s'."),
- secdef->model, virSecurityManagerGetModel(mgr));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("security label driver mismatch: "
+ "'%s' model configured for domain, but "
+ "hypervisor driver is '%s'."),
+ secdef->model, virSecurityManagerGetModel(mgr));
goto done;
}
@@ -1394,11 +1394,11 @@ SELinuxClearSecuritySocketLabel(virSecurityManagerPtr mgr,
return 0;
if (!STREQ(virSecurityManagerGetModel(mgr), secdef->model)) {
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- _("security label driver mismatch: "
- "'%s' model configured for domain, but
"
- "hypervisor driver is '%s'."),
- secdef->model, virSecurityManagerGetModel(mgr));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("security label driver mismatch: "
+ "'%s' model configured for domain, but "
+ "hypervisor driver is '%s'."),
+ secdef->model, virSecurityManagerGetModel(mgr));
if (security_getenforce() == 1)
return -1;
}
@@ -1451,9 +1451,9 @@ SELinuxSetSecuritySmartcardCallback(virDomainDefPtr def,
return SELinuxSetSecurityChardevLabel(def, &dev->data.passthru);
default:
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- _("unknown smartcard type %d"),
- dev->type);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unknown smartcard type %d"),
+ dev->type);
return -1;
}
--
1.7.10.4