Many of the functions follow the pattern: virSecurity.*Security.*Label Remove the second 'Security' from the names, it should be obvious that the virSecurity* functions deal with security labels even without it. --- src/security/security_dac.c | 240 ++++++++++++++++++++-------------------- src/security/security_selinux.c | 188 +++++++++++++++---------------- 2 files changed, 214 insertions(+), 214 deletions(-) diff --git a/src/security/security_dac.c b/src/security/security_dac.c index 8b9c473..6c897bc 100644 --- a/src/security/security_dac.c +++ b/src/security/security_dac.c @@ -376,9 +376,9 @@ virSecurityDACSetOwnership(virSecurityDACDataPtr priv, static int -virSecurityDACRestoreSecurityFileLabelInternal(virSecurityDACDataPtr priv, - virStorageSourcePtr src, - const char *path) +virSecurityDACRestoreFileLabelInternal(virSecurityDACDataPtr priv, + virStorageSourcePtr src, + const char *path) { int rv; uid_t uid = 0; /* By default return to root:root */ @@ -404,17 +404,17 @@ virSecurityDACRestoreSecurityFileLabelInternal(virSecurityDACDataPtr priv, static int -virSecurityDACRestoreSecurityFileLabel(virSecurityDACDataPtr priv, - const char *path) +virSecurityDACRestoreFileLabel(virSecurityDACDataPtr priv, + const char *path) { - return virSecurityDACRestoreSecurityFileLabelInternal(priv, NULL, path); + return virSecurityDACRestoreFileLabelInternal(priv, NULL, path); } static int -virSecurityDACSetSecurityImageLabel(virSecurityManagerPtr mgr, - virDomainDefPtr def, - virStorageSourcePtr src) +virSecurityDACSetImageLabel(virSecurityManagerPtr mgr, + virDomainDefPtr def, + virStorageSourcePtr src) { virSecurityLabelDefPtr secdef; virSecurityDeviceLabelDefPtr disk_seclabel; @@ -447,15 +447,15 @@ virSecurityDACSetSecurityImageLabel(virSecurityManagerPtr mgr, static int -virSecurityDACSetSecurityDiskLabel(virSecurityManagerPtr mgr, - virDomainDefPtr def, - virDomainDiskDefPtr disk) +virSecurityDACSetDiskLabel(virSecurityManagerPtr mgr, + virDomainDefPtr def, + virDomainDiskDefPtr disk) { virStorageSourcePtr next; for (next = disk->src; next; next = next->backingStore) { - if (virSecurityDACSetSecurityImageLabel(mgr, def, next) < 0) + if (virSecurityDACSetImageLabel(mgr, def, next) < 0) return -1; } @@ -464,10 +464,10 @@ virSecurityDACSetSecurityDiskLabel(virSecurityManagerPtr mgr, static int -virSecurityDACRestoreSecurityImageLabelInt(virSecurityManagerPtr mgr, - virDomainDefPtr def, - virStorageSourcePtr src, - bool migrated) +virSecurityDACRestoreImageLabelInt(virSecurityManagerPtr mgr, + virDomainDefPtr def, + virStorageSourcePtr src, + bool migrated) { virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr); virSecurityLabelDefPtr secdef; @@ -514,31 +514,31 @@ virSecurityDACRestoreSecurityImageLabelInt(virSecurityManagerPtr mgr, } } - return virSecurityDACRestoreSecurityFileLabelInternal(priv, src, NULL); + return virSecurityDACRestoreFileLabelInternal(priv, src, NULL); } static int -virSecurityDACRestoreSecurityImageLabel(virSecurityManagerPtr mgr, - virDomainDefPtr def, - virStorageSourcePtr src) +virSecurityDACRestoreImageLabel(virSecurityManagerPtr mgr, + virDomainDefPtr def, + virStorageSourcePtr src) { - return virSecurityDACRestoreSecurityImageLabelInt(mgr, def, src, false); + return virSecurityDACRestoreImageLabelInt(mgr, def, src, false); } static int -virSecurityDACRestoreSecurityDiskLabel(virSecurityManagerPtr mgr, - virDomainDefPtr def, - virDomainDiskDefPtr disk) +virSecurityDACRestoreDiskLabel(virSecurityManagerPtr mgr, + virDomainDefPtr def, + virDomainDiskDefPtr disk) { - return virSecurityDACRestoreSecurityImageLabelInt(mgr, def, disk->src, false); + return virSecurityDACRestoreImageLabelInt(mgr, def, disk->src, false); } static int -virSecurityDACSetSecurityHostdevLabelHelper(const char *file, - void *opaque) +virSecurityDACSetHostdevLabelHelper(const char *file, + void *opaque) { virSecurityDACCallbackDataPtr cbdata = opaque; virSecurityManagerPtr mgr = cbdata->manager; @@ -555,37 +555,37 @@ virSecurityDACSetSecurityHostdevLabelHelper(const char *file, static int -virSecurityDACSetSecurityPCILabel(virPCIDevicePtr dev ATTRIBUTE_UNUSED, - const char *file, - void *opaque) +virSecurityDACSetPCILabel(virPCIDevicePtr dev ATTRIBUTE_UNUSED, + const char *file, + void *opaque) { - return virSecurityDACSetSecurityHostdevLabelHelper(file, opaque); + return virSecurityDACSetHostdevLabelHelper(file, opaque); } static int -virSecurityDACSetSecurityUSBLabel(virUSBDevicePtr dev ATTRIBUTE_UNUSED, - const char *file, - void *opaque) +virSecurityDACSetUSBLabel(virUSBDevicePtr dev ATTRIBUTE_UNUSED, + const char *file, + void *opaque) { - return virSecurityDACSetSecurityHostdevLabelHelper(file, opaque); + return virSecurityDACSetHostdevLabelHelper(file, opaque); } static int -virSecurityDACSetSecuritySCSILabel(virSCSIDevicePtr dev ATTRIBUTE_UNUSED, - const char *file, - void *opaque) +virSecurityDACSetSCSILabel(virSCSIDevicePtr dev ATTRIBUTE_UNUSED, + const char *file, + void *opaque) { - return virSecurityDACSetSecurityHostdevLabelHelper(file, opaque); + return virSecurityDACSetHostdevLabelHelper(file, opaque); } static int -virSecurityDACSetSecurityHostdevLabel(virSecurityManagerPtr mgr, - virDomainDefPtr def, - virDomainHostdevDefPtr dev, - const char *vroot) +virSecurityDACSetHostdevLabel(virSecurityManagerPtr mgr, + virDomainDefPtr def, + virDomainHostdevDefPtr dev, + const char *vroot) { virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr); virSecurityDACCallbackData cbdata; @@ -600,7 +600,7 @@ virSecurityDACSetSecurityHostdevLabel(virSecurityManagerPtr mgr, if (dev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) return 0; - /* Like virSecurityDACSetSecurityImageLabel() for a networked disk, + /* Like virSecurityDACSetImageLabel() for a networked disk, * do nothing for an iSCSI hostdev */ if (dev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI && @@ -624,7 +624,7 @@ virSecurityDACSetSecurityHostdevLabel(virSecurityManagerPtr mgr, goto done; ret = virUSBDeviceFileIterate(usb, - virSecurityDACSetSecurityUSBLabel, + virSecurityDACSetUSBLabel, &cbdata); virUSBDeviceFree(usb); break; @@ -645,11 +645,11 @@ virSecurityDACSetSecurityHostdevLabel(virSecurityManagerPtr mgr, virPCIDeviceFree(pci); goto done; } - ret = virSecurityDACSetSecurityPCILabel(pci, vfioGroupDev, &cbdata); + ret = virSecurityDACSetPCILabel(pci, vfioGroupDev, &cbdata); VIR_FREE(vfioGroupDev); } else { ret = virPCIDeviceFileIterate(pci, - virSecurityDACSetSecurityPCILabel, + virSecurityDACSetPCILabel, &cbdata); } @@ -669,7 +669,7 @@ virSecurityDACSetSecurityHostdevLabel(virSecurityManagerPtr mgr, goto done; ret = virSCSIDeviceFileIterate(scsi, - virSecurityDACSetSecuritySCSILabel, + virSecurityDACSetSCSILabel, &cbdata); virSCSIDeviceFree(scsi); @@ -687,43 +687,43 @@ virSecurityDACSetSecurityHostdevLabel(virSecurityManagerPtr mgr, static int -virSecurityDACRestoreSecurityPCILabel(virPCIDevicePtr dev ATTRIBUTE_UNUSED, - const char *file, - void *opaque) +virSecurityDACRestorePCILabel(virPCIDevicePtr dev ATTRIBUTE_UNUSED, + const char *file, + void *opaque) { virSecurityManagerPtr mgr = opaque; virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr); - return virSecurityDACRestoreSecurityFileLabel(priv, file); + return virSecurityDACRestoreFileLabel(priv, file); } static int -virSecurityDACRestoreSecurityUSBLabel(virUSBDevicePtr dev ATTRIBUTE_UNUSED, - const char *file, - void *opaque) +virSecurityDACRestoreUSBLabel(virUSBDevicePtr dev ATTRIBUTE_UNUSED, + const char *file, + void *opaque) { virSecurityManagerPtr mgr = opaque; virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr); - return virSecurityDACRestoreSecurityFileLabel(priv, file); + return virSecurityDACRestoreFileLabel(priv, file); } static int -virSecurityDACRestoreSecuritySCSILabel(virSCSIDevicePtr dev ATTRIBUTE_UNUSED, - const char *file, - void *opaque) +virSecurityDACRestoreSCSILabel(virSCSIDevicePtr dev ATTRIBUTE_UNUSED, + const char *file, + void *opaque) { virSecurityManagerPtr mgr = opaque; virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr); - return virSecurityDACRestoreSecurityFileLabel(priv, file); + return virSecurityDACRestoreFileLabel(priv, file); } static int -virSecurityDACRestoreSecurityHostdevLabel(virSecurityManagerPtr mgr, - virDomainDefPtr def, - virDomainHostdevDefPtr dev, - const char *vroot) +virSecurityDACRestoreHostdevLabel(virSecurityManagerPtr mgr, + virDomainDefPtr def, + virDomainHostdevDefPtr dev, + const char *vroot) { virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr); @@ -741,7 +741,7 @@ virSecurityDACRestoreSecurityHostdevLabel(virSecurityManagerPtr mgr, if (dev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) return 0; - /* Like virSecurityDACRestoreSecurityImageLabelInt() for a networked disk, + /* Like virSecurityDACRestoreImageLabelInt() for a networked disk, * do nothing for an iSCSI hostdev */ if (dev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI && @@ -758,7 +758,7 @@ virSecurityDACRestoreSecurityHostdevLabel(virSecurityManagerPtr mgr, if (!(usb = virUSBDeviceNew(usbsrc->bus, usbsrc->device, vroot))) goto done; - ret = virUSBDeviceFileIterate(usb, virSecurityDACRestoreSecurityUSBLabel, mgr); + ret = virUSBDeviceFileIterate(usb, virSecurityDACRestoreUSBLabel, mgr); virUSBDeviceFree(usb); break; @@ -779,10 +779,10 @@ virSecurityDACRestoreSecurityHostdevLabel(virSecurityManagerPtr mgr, virPCIDeviceFree(pci); goto done; } - ret = virSecurityDACRestoreSecurityPCILabel(pci, vfioGroupDev, mgr); + ret = virSecurityDACRestorePCILabel(pci, vfioGroupDev, mgr); VIR_FREE(vfioGroupDev); } else { - ret = virPCIDeviceFileIterate(pci, virSecurityDACRestoreSecurityPCILabel, mgr); + ret = virPCIDeviceFileIterate(pci, virSecurityDACRestorePCILabel, mgr); } virPCIDeviceFree(pci); break; @@ -799,7 +799,7 @@ virSecurityDACRestoreSecurityHostdevLabel(virSecurityManagerPtr mgr, if (!scsi) goto done; - ret = virSCSIDeviceFileIterate(scsi, virSecurityDACRestoreSecuritySCSILabel, mgr); + ret = virSCSIDeviceFileIterate(scsi, virSecurityDACRestoreSCSILabel, mgr); virSCSIDeviceFree(scsi); break; @@ -922,7 +922,7 @@ virSecurityDACRestoreChardevLabel(virSecurityManagerPtr mgr, switch ((virDomainChrType) dev_source->type) { case VIR_DOMAIN_CHR_TYPE_DEV: case VIR_DOMAIN_CHR_TYPE_FILE: - ret = virSecurityDACRestoreSecurityFileLabel(priv, dev_source->data.file.path); + ret = virSecurityDACRestoreFileLabel(priv, dev_source->data.file.path); break; case VIR_DOMAIN_CHR_TYPE_PIPE: @@ -930,10 +930,10 @@ virSecurityDACRestoreChardevLabel(virSecurityManagerPtr mgr, virAsprintf(&in, "%s.in", dev_source->data.file.path) < 0) goto done; if (virFileExists(in) && virFileExists(out)) { - if (virSecurityDACRestoreSecurityFileLabel(priv, out) < 0 || - virSecurityDACRestoreSecurityFileLabel(priv, in) < 0) + if (virSecurityDACRestoreFileLabel(priv, out) < 0 || + virSecurityDACRestoreFileLabel(priv, in) < 0) goto done; - } else if (virSecurityDACRestoreSecurityFileLabel(priv, dev_source->data.file.path) < 0) { + } else if (virSecurityDACRestoreFileLabel(priv, dev_source->data.file.path) < 0) { goto done; } ret = 0; @@ -973,9 +973,9 @@ virSecurityDACRestoreChardevCallback(virDomainDefPtr def, static int -virSecurityDACSetSecurityTPMFileLabel(virSecurityManagerPtr mgr, - virDomainDefPtr def, - virDomainTPMDefPtr tpm) +virSecurityDACSetTPMFileLabel(virSecurityManagerPtr mgr, + virDomainDefPtr def, + virDomainTPMDefPtr tpm) { int ret = 0; @@ -993,9 +993,9 @@ virSecurityDACSetSecurityTPMFileLabel(virSecurityManagerPtr mgr, static int -virSecurityDACRestoreSecurityTPMFileLabel(virSecurityManagerPtr mgr, - virDomainDefPtr def, - virDomainTPMDefPtr tpm) +virSecurityDACRestoreTPMFileLabel(virSecurityManagerPtr mgr, + virDomainDefPtr def, + virDomainTPMDefPtr tpm) { int ret = 0; @@ -1013,9 +1013,9 @@ virSecurityDACRestoreSecurityTPMFileLabel(virSecurityManagerPtr mgr, static int -virSecurityDACRestoreSecurityAllLabel(virSecurityManagerPtr mgr, - virDomainDefPtr def, - bool migrated) +virSecurityDACRestoreAllLabel(virSecurityManagerPtr mgr, + virDomainDefPtr def, + bool migrated) { virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr); virSecurityLabelDefPtr secdef; @@ -1031,17 +1031,17 @@ virSecurityDACRestoreSecurityAllLabel(virSecurityManagerPtr mgr, def->name, migrated); for (i = 0; i < def->nhostdevs; i++) { - if (virSecurityDACRestoreSecurityHostdevLabel(mgr, - def, - def->hostdevs[i], - NULL) < 0) + if (virSecurityDACRestoreHostdevLabel(mgr, + def, + def->hostdevs[i], + NULL) < 0) rc = -1; } for (i = 0; i < def->ndisks; i++) { - if (virSecurityDACRestoreSecurityImageLabelInt(mgr, - def, - def->disks[i]->src, - migrated) < 0) + if (virSecurityDACRestoreImageLabelInt(mgr, + def, + def->disks[i]->src, + migrated) < 0) rc = -1; } @@ -1052,26 +1052,26 @@ virSecurityDACRestoreSecurityAllLabel(virSecurityManagerPtr mgr, rc = -1; if (def->tpm) { - if (virSecurityDACRestoreSecurityTPMFileLabel(mgr, - def, - def->tpm) < 0) + if (virSecurityDACRestoreTPMFileLabel(mgr, + def, + def->tpm) < 0) rc = -1; } if (def->os.loader && def->os.loader->nvram && - virSecurityDACRestoreSecurityFileLabel(priv, def->os.loader->nvram) < 0) + virSecurityDACRestoreFileLabel(priv, def->os.loader->nvram) < 0) rc = -1; if (def->os.kernel && - virSecurityDACRestoreSecurityFileLabel(priv, def->os.kernel) < 0) + virSecurityDACRestoreFileLabel(priv, def->os.kernel) < 0) rc = -1; if (def->os.initrd && - virSecurityDACRestoreSecurityFileLabel(priv, def->os.initrd) < 0) + virSecurityDACRestoreFileLabel(priv, def->os.initrd) < 0) rc = -1; if (def->os.dtb && - virSecurityDACRestoreSecurityFileLabel(priv, def->os.dtb) < 0) + virSecurityDACRestoreFileLabel(priv, def->os.dtb) < 0) rc = -1; return rc; @@ -1090,9 +1090,9 @@ virSecurityDACSetChardevCallback(virDomainDefPtr def, static int -virSecurityDACSetSecurityAllLabel(virSecurityManagerPtr mgr, - virDomainDefPtr def, - const char *stdin_path ATTRIBUTE_UNUSED) +virSecurityDACSetAllLabel(virSecurityManagerPtr mgr, + virDomainDefPtr def, + const char *stdin_path ATTRIBUTE_UNUSED) { virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr); virSecurityLabelDefPtr secdef; @@ -1109,16 +1109,16 @@ virSecurityDACSetSecurityAllLabel(virSecurityManagerPtr mgr, /* XXX fixme - we need to recursively label the entire tree :-( */ if (virDomainDiskGetType(def->disks[i]) == VIR_STORAGE_TYPE_DIR) continue; - if (virSecurityDACSetSecurityDiskLabel(mgr, - def, - def->disks[i]) < 0) + if (virSecurityDACSetDiskLabel(mgr, + def, + def->disks[i]) < 0) return -1; } for (i = 0; i < def->nhostdevs; i++) { - if (virSecurityDACSetSecurityHostdevLabel(mgr, - def, - def->hostdevs[i], - NULL) < 0) + if (virSecurityDACSetHostdevLabel(mgr, + def, + def->hostdevs[i], + NULL) < 0) return -1; } @@ -1129,9 +1129,9 @@ virSecurityDACSetSecurityAllLabel(virSecurityManagerPtr mgr, return -1; if (def->tpm) { - if (virSecurityDACSetSecurityTPMFileLabel(mgr, - def, - def->tpm) < 0) + if (virSecurityDACSetTPMFileLabel(mgr, + def, + def->tpm) < 0) return -1; } @@ -1191,7 +1191,7 @@ virSecurityDACRestoreSavedStateLabel(virSecurityManagerPtr mgr, if (!priv->dynamicOwnership) return 0; - return virSecurityDACRestoreSecurityFileLabel(priv, savefile); + return virSecurityDACRestoreFileLabel(priv, savefile); } @@ -1513,11 +1513,11 @@ virSecurityDriver virSecurityDriverDAC = { .domainSecurityVerify = virSecurityDACVerify, - .domainSetSecurityDiskLabel = virSecurityDACSetSecurityDiskLabel, - .domainRestoreSecurityDiskLabel = virSecurityDACRestoreSecurityDiskLabel, + .domainSetSecurityDiskLabel = virSecurityDACSetDiskLabel, + .domainRestoreSecurityDiskLabel = virSecurityDACRestoreDiskLabel, - .domainSetSecurityImageLabel = virSecurityDACSetSecurityImageLabel, - .domainRestoreSecurityImageLabel = virSecurityDACRestoreSecurityImageLabel, + .domainSetSecurityImageLabel = virSecurityDACSetImageLabel, + .domainRestoreSecurityImageLabel = virSecurityDACRestoreImageLabel, .domainSetSecurityDaemonSocketLabel = virSecurityDACSetDaemonSocketLabel, .domainSetSecuritySocketLabel = virSecurityDACSetSocketLabel, @@ -1531,11 +1531,11 @@ virSecurityDriver virSecurityDriverDAC = { .domainSetSecurityProcessLabel = virSecurityDACSetProcessLabel, .domainSetSecurityChildProcessLabel = virSecurityDACSetChildProcessLabel, - .domainSetSecurityAllLabel = virSecurityDACSetSecurityAllLabel, - .domainRestoreSecurityAllLabel = virSecurityDACRestoreSecurityAllLabel, + .domainSetSecurityAllLabel = virSecurityDACSetAllLabel, + .domainRestoreSecurityAllLabel = virSecurityDACRestoreAllLabel, - .domainSetSecurityHostdevLabel = virSecurityDACSetSecurityHostdevLabel, - .domainRestoreSecurityHostdevLabel = virSecurityDACRestoreSecurityHostdevLabel, + .domainSetSecurityHostdevLabel = virSecurityDACSetHostdevLabel, + .domainRestoreSecurityHostdevLabel = virSecurityDACRestoreHostdevLabel, .domainSetSavedStateLabel = virSecurityDACSetSavedStateLabel, .domainRestoreSavedStateLabel = virSecurityDACRestoreSavedStateLabel, diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c index 80b0886..ae2af0c 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -570,8 +570,8 @@ virSecuritySELinuxInitialize(virSecurityManagerPtr mgr) static int -virSecuritySELinuxGenSecurityLabel(virSecurityManagerPtr mgr, - virDomainDefPtr def) +virSecuritySELinuxGenLabel(virSecurityManagerPtr mgr, + virDomainDefPtr def) { int rc = -1; char *mcs = NULL; @@ -729,9 +729,9 @@ virSecuritySELinuxGenSecurityLabel(virSecurityManagerPtr mgr, } static int -virSecuritySELinuxReserveSecurityLabel(virSecurityManagerPtr mgr, - virDomainDefPtr def, - pid_t pid) +virSecuritySELinuxReserveLabel(virSecurityManagerPtr mgr, + virDomainDefPtr def, + pid_t pid) { security_context_t pctx; context_t ctx = NULL; @@ -845,10 +845,10 @@ virSecuritySELinuxSecurityGetDOI(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED) } static int -virSecuritySELinuxGetSecurityProcessLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED, - virDomainDefPtr def ATTRIBUTE_UNUSED, - pid_t pid, - virSecurityLabelPtr sec) +virSecuritySELinuxGetProcessLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED, + virDomainDefPtr def ATTRIBUTE_UNUSED, + pid_t pid, + virSecurityLabelPtr sec) { security_context_t ctx; @@ -1133,10 +1133,10 @@ virSecuritySELinuxRestoreSecurityTPMFileLabelInt(virSecurityManagerPtr mgr, static int -virSecuritySELinuxRestoreSecurityImageLabelInt(virSecurityManagerPtr mgr, - virDomainDefPtr def, - virStorageSourcePtr src, - bool migrated) +virSecuritySELinuxRestoreImageLabelInt(virSecurityManagerPtr mgr, + virDomainDefPtr def, + virStorageSourcePtr src, + bool migrated) { virSecurityLabelDefPtr seclabel; virSecurityDeviceLabelDefPtr disk_seclabel; @@ -1189,29 +1189,29 @@ virSecuritySELinuxRestoreSecurityImageLabelInt(virSecurityManagerPtr mgr, static int -virSecuritySELinuxRestoreSecurityDiskLabel(virSecurityManagerPtr mgr, - virDomainDefPtr def, - virDomainDiskDefPtr disk) +virSecuritySELinuxRestoreDiskLabel(virSecurityManagerPtr mgr, + virDomainDefPtr def, + virDomainDiskDefPtr disk) { - return virSecuritySELinuxRestoreSecurityImageLabelInt(mgr, def, disk->src, - false); + return virSecuritySELinuxRestoreImageLabelInt(mgr, def, disk->src, + false); } static int -virSecuritySELinuxRestoreSecurityImageLabel(virSecurityManagerPtr mgr, - virDomainDefPtr def, - virStorageSourcePtr src) +virSecuritySELinuxRestoreImageLabel(virSecurityManagerPtr mgr, + virDomainDefPtr def, + virStorageSourcePtr src) { - return virSecuritySELinuxRestoreSecurityImageLabelInt(mgr, def, src, false); + return virSecuritySELinuxRestoreImageLabelInt(mgr, def, src, false); } static int -virSecuritySELinuxSetSecurityImageLabelInternal(virSecurityManagerPtr mgr, - virDomainDefPtr def, - virStorageSourcePtr src, - bool first) +virSecuritySELinuxSetImageLabelInternal(virSecurityManagerPtr mgr, + virDomainDefPtr def, + virStorageSourcePtr src, + bool first) { virSecuritySELinuxDataPtr data = virSecurityManagerGetPrivateData(mgr); virSecurityLabelDefPtr secdef; @@ -1275,25 +1275,25 @@ virSecuritySELinuxSetSecurityImageLabelInternal(virSecurityManagerPtr mgr, static int -virSecuritySELinuxSetSecurityImageLabel(virSecurityManagerPtr mgr, - virDomainDefPtr def, - virStorageSourcePtr src) +virSecuritySELinuxSetImageLabel(virSecurityManagerPtr mgr, + virDomainDefPtr def, + virStorageSourcePtr src) { - return virSecuritySELinuxSetSecurityImageLabelInternal(mgr, def, src, true); + return virSecuritySELinuxSetImageLabelInternal(mgr, def, src, true); } static int -virSecuritySELinuxSetSecurityDiskLabel(virSecurityManagerPtr mgr, - virDomainDefPtr def, - virDomainDiskDefPtr disk) +virSecuritySELinuxSetDiskLabel(virSecurityManagerPtr mgr, + virDomainDefPtr def, + virDomainDiskDefPtr disk) { bool first = true; virStorageSourcePtr next; for (next = disk->src; next; next = next->backingStore) { - if (virSecuritySELinuxSetSecurityImageLabelInternal(mgr, def, next, + if (virSecuritySELinuxSetImageLabelInternal(mgr, def, next, first) < 0) return -1; @@ -1304,7 +1304,7 @@ virSecuritySELinuxSetSecurityDiskLabel(virSecurityManagerPtr mgr, } static int -virSecuritySELinuxSetSecurityHostdevLabelHelper(const char *file, void *opaque) +virSecuritySELinuxSetHostdevLabelHelper(const char *file, void *opaque) { virSecurityLabelDefPtr secdef; virSecuritySELinuxCallbackDataPtr data = opaque; @@ -1321,14 +1321,14 @@ static int virSecuritySELinuxSetSecurityPCILabel(virPCIDevicePtr dev ATTRIBUTE_UNUSED, const char *file, void *opaque) { - return virSecuritySELinuxSetSecurityHostdevLabelHelper(file, opaque); + return virSecuritySELinuxSetHostdevLabelHelper(file, opaque); } static int virSecuritySELinuxSetSecurityUSBLabel(virUSBDevicePtr dev ATTRIBUTE_UNUSED, const char *file, void *opaque) { - return virSecuritySELinuxSetSecurityHostdevLabelHelper(file, opaque); + return virSecuritySELinuxSetHostdevLabelHelper(file, opaque); } static int @@ -1369,7 +1369,7 @@ virSecuritySELinuxSetSecurityHostdevSubsysLabel(virSecurityManagerPtr mgr, int ret = -1; - /* Like virSecuritySELinuxSetSecurityImageLabelInternal() for a networked + /* Like virSecuritySELinuxSetImageLabelInternal() for a networked * disk, do nothing for an iSCSI hostdev */ if (dev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI && @@ -1501,10 +1501,10 @@ virSecuritySELinuxSetSecurityHostdevCapsLabel(virSecurityManagerPtr mgr, static int -virSecuritySELinuxSetSecurityHostdevLabel(virSecurityManagerPtr mgr, - virDomainDefPtr def, - virDomainHostdevDefPtr dev, - const char *vroot) +virSecuritySELinuxSetHostdevLabel(virSecurityManagerPtr mgr, + virDomainDefPtr def, + virDomainHostdevDefPtr dev, + const char *vroot) { virSecurityLabelDefPtr secdef; @@ -1575,7 +1575,7 @@ virSecuritySELinuxRestoreSecurityHostdevSubsysLabel(virSecurityManagerPtr mgr, virDomainHostdevSubsysSCSIPtr scsisrc = &dev->source.subsys.u.scsi; int ret = -1; - /* Like virSecuritySELinuxRestoreSecurityImageLabelInt() for a networked + /* Like virSecuritySELinuxRestoreImageLabelInt() for a networked * disk, do nothing for an iSCSI hostdev */ if (dev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI && @@ -1699,10 +1699,10 @@ virSecuritySELinuxRestoreSecurityHostdevCapsLabel(virSecurityManagerPtr mgr, static int -virSecuritySELinuxRestoreSecurityHostdevLabel(virSecurityManagerPtr mgr, - virDomainDefPtr def, - virDomainHostdevDefPtr dev, - const char *vroot) +virSecuritySELinuxRestoreHostdevLabel(virSecurityManagerPtr mgr, + virDomainDefPtr def, + virDomainHostdevDefPtr dev, + const char *vroot) { virSecurityLabelDefPtr secdef; @@ -1925,9 +1925,9 @@ virSecuritySELinuxGetBaseLabel(virSecurityManagerPtr mgr, int virtType) static int -virSecuritySELinuxRestoreSecurityAllLabel(virSecurityManagerPtr mgr, - virDomainDefPtr def, - bool migrated) +virSecuritySELinuxRestoreAllLabel(virSecurityManagerPtr mgr, + virDomainDefPtr def, + bool migrated) { virSecurityLabelDefPtr secdef; virSecuritySELinuxDataPtr data = virSecurityManagerGetPrivateData(mgr); @@ -1948,16 +1948,16 @@ virSecuritySELinuxRestoreSecurityAllLabel(virSecurityManagerPtr mgr, } for (i = 0; i < def->nhostdevs; i++) { - if (virSecuritySELinuxRestoreSecurityHostdevLabel(mgr, - def, - def->hostdevs[i], - NULL) < 0) + if (virSecuritySELinuxRestoreHostdevLabel(mgr, + def, + def->hostdevs[i], + NULL) < 0) rc = -1; } for (i = 0; i < def->ndisks; i++) { virDomainDiskDefPtr disk = def->disks[i]; - if (virSecuritySELinuxRestoreSecurityImageLabelInt(mgr, def, disk->src, + if (virSecuritySELinuxRestoreImageLabelInt(mgr, def, disk->src, migrated) < 0) rc = -1; } @@ -1994,8 +1994,8 @@ virSecuritySELinuxRestoreSecurityAllLabel(virSecurityManagerPtr mgr, } static int -virSecuritySELinuxReleaseSecurityLabel(virSecurityManagerPtr mgr, - virDomainDefPtr def) +virSecuritySELinuxReleaseLabel(virSecurityManagerPtr mgr, + virDomainDefPtr def) { virSecurityLabelDefPtr secdef; @@ -2081,8 +2081,8 @@ virSecuritySELinuxSecurityVerify(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED, } static int -virSecuritySELinuxSetSecurityProcessLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED, - virDomainDefPtr def) +virSecuritySELinuxSetProcessLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED, + virDomainDefPtr def) { /* TODO: verify DOI */ virSecurityLabelDefPtr secdef; @@ -2114,9 +2114,9 @@ virSecuritySELinuxSetSecurityProcessLabel(virSecurityManagerPtr mgr ATTRIBUTE_UN } static int -virSecuritySELinuxSetSecurityChildProcessLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED, - virDomainDefPtr def, - virCommandPtr cmd) +virSecuritySELinuxSetChildProcessLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED, + virDomainDefPtr def, + virCommandPtr cmd) { /* TODO: verify DOI */ virSecurityLabelDefPtr secdef; @@ -2142,8 +2142,8 @@ virSecuritySELinuxSetSecurityChildProcessLabel(virSecurityManagerPtr mgr ATTRIBU } static int -virSecuritySELinuxSetSecurityDaemonSocketLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED, - virDomainDefPtr def) +virSecuritySELinuxSetDaemonSocketLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED, + virDomainDefPtr def) { /* TODO: verify DOI */ virSecurityLabelDefPtr secdef; @@ -2192,8 +2192,8 @@ virSecuritySELinuxSetSecurityDaemonSocketLabel(virSecurityManagerPtr mgr ATTRIBU } static int -virSecuritySELinuxSetSecuritySocketLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED, - virDomainDefPtr vm) +virSecuritySELinuxSetSocketLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED, + virDomainDefPtr vm) { virSecurityLabelDefPtr secdef; int rc = -1; @@ -2230,8 +2230,8 @@ virSecuritySELinuxSetSecuritySocketLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNU } static int -virSecuritySELinuxClearSecuritySocketLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED, - virDomainDefPtr def) +virSecuritySELinuxClearSocketLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED, + virDomainDefPtr def) { /* TODO: verify DOI */ virSecurityLabelDefPtr secdef; @@ -2312,9 +2312,9 @@ virSecuritySELinuxSetSecuritySmartcardCallback(virDomainDefPtr def, static int -virSecuritySELinuxSetSecurityAllLabel(virSecurityManagerPtr mgr, - virDomainDefPtr def, - const char *stdin_path) +virSecuritySELinuxSetAllLabel(virSecurityManagerPtr mgr, + virDomainDefPtr def, + const char *stdin_path) { size_t i; virSecuritySELinuxDataPtr data = virSecurityManagerGetPrivateData(mgr); @@ -2333,17 +2333,17 @@ virSecuritySELinuxSetSecurityAllLabel(virSecurityManagerPtr mgr, def->disks[i]->dst); continue; } - if (virSecuritySELinuxSetSecurityDiskLabel(mgr, - def, def->disks[i]) < 0) + if (virSecuritySELinuxSetDiskLabel(mgr, + def, def->disks[i]) < 0) return -1; } /* XXX fixme process def->fss if relabel == true */ for (i = 0; i < def->nhostdevs; i++) { - if (virSecuritySELinuxSetSecurityHostdevLabel(mgr, - def, - def->hostdevs[i], - NULL) < 0) + if (virSecuritySELinuxSetHostdevLabel(mgr, + def, + def->hostdevs[i], + NULL) < 0) return -1; } if (def->tpm) { @@ -2562,29 +2562,29 @@ virSecurityDriver virSecurityDriverSELinux = { .domainSecurityVerify = virSecuritySELinuxSecurityVerify, - .domainSetSecurityDiskLabel = virSecuritySELinuxSetSecurityDiskLabel, - .domainRestoreSecurityDiskLabel = virSecuritySELinuxRestoreSecurityDiskLabel, + .domainSetSecurityDiskLabel = virSecuritySELinuxSetDiskLabel, + .domainRestoreSecurityDiskLabel = virSecuritySELinuxRestoreDiskLabel, - .domainSetSecurityImageLabel = virSecuritySELinuxSetSecurityImageLabel, - .domainRestoreSecurityImageLabel = virSecuritySELinuxRestoreSecurityImageLabel, + .domainSetSecurityImageLabel = virSecuritySELinuxSetImageLabel, + .domainRestoreSecurityImageLabel = virSecuritySELinuxRestoreImageLabel, - .domainSetSecurityDaemonSocketLabel = virSecuritySELinuxSetSecurityDaemonSocketLabel, - .domainSetSecuritySocketLabel = virSecuritySELinuxSetSecuritySocketLabel, - .domainClearSecuritySocketLabel = virSecuritySELinuxClearSecuritySocketLabel, + .domainSetSecurityDaemonSocketLabel = virSecuritySELinuxSetDaemonSocketLabel, + .domainSetSecuritySocketLabel = virSecuritySELinuxSetSocketLabel, + .domainClearSecuritySocketLabel = virSecuritySELinuxClearSocketLabel, - .domainGenSecurityLabel = virSecuritySELinuxGenSecurityLabel, - .domainReserveSecurityLabel = virSecuritySELinuxReserveSecurityLabel, - .domainReleaseSecurityLabel = virSecuritySELinuxReleaseSecurityLabel, + .domainGenSecurityLabel = virSecuritySELinuxGenLabel, + .domainReserveSecurityLabel = virSecuritySELinuxReserveLabel, + .domainReleaseSecurityLabel = virSecuritySELinuxReleaseLabel, - .domainGetSecurityProcessLabel = virSecuritySELinuxGetSecurityProcessLabel, - .domainSetSecurityProcessLabel = virSecuritySELinuxSetSecurityProcessLabel, - .domainSetSecurityChildProcessLabel = virSecuritySELinuxSetSecurityChildProcessLabel, + .domainGetSecurityProcessLabel = virSecuritySELinuxGetProcessLabel, + .domainSetSecurityProcessLabel = virSecuritySELinuxSetProcessLabel, + .domainSetSecurityChildProcessLabel = virSecuritySELinuxSetChildProcessLabel, - .domainSetSecurityAllLabel = virSecuritySELinuxSetSecurityAllLabel, - .domainRestoreSecurityAllLabel = virSecuritySELinuxRestoreSecurityAllLabel, + .domainSetSecurityAllLabel = virSecuritySELinuxSetAllLabel, + .domainRestoreSecurityAllLabel = virSecuritySELinuxRestoreAllLabel, - .domainSetSecurityHostdevLabel = virSecuritySELinuxSetSecurityHostdevLabel, - .domainRestoreSecurityHostdevLabel = virSecuritySELinuxRestoreSecurityHostdevLabel, + .domainSetSecurityHostdevLabel = virSecuritySELinuxSetHostdevLabel, + .domainRestoreSecurityHostdevLabel = virSecuritySELinuxRestoreHostdevLabel, .domainSetSavedStateLabel = virSecuritySELinuxSetSavedStateLabel, .domainRestoreSavedStateLabel = virSecuritySELinuxRestoreSavedStateLabel, -- 2.4.6 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list