mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
security_selinux: Drop @optional from _virSecuritySELinuxContextItem
Now, that we don't need to remember if setting context is 'optional' (the argument only made virSecuritySELinuxSetFileconImpl() return a different success code), we can drop it from the _virSecuritySELinuxContextItem structure as we don't need to remember it in transactions. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
079c1d6a29
commit
b71d54f447
@ -81,7 +81,6 @@ typedef virSecuritySELinuxContextItem *virSecuritySELinuxContextItemPtr;
|
|||||||
struct _virSecuritySELinuxContextItem {
|
struct _virSecuritySELinuxContextItem {
|
||||||
char *path;
|
char *path;
|
||||||
char *tcon;
|
char *tcon;
|
||||||
bool optional;
|
|
||||||
bool remember; /* Whether owner remembering should be done for @path/@src */
|
bool remember; /* Whether owner remembering should be done for @path/@src */
|
||||||
bool restore; /* Whether current operation is 'set' or 'restore' */
|
bool restore; /* Whether current operation is 'set' or 'restore' */
|
||||||
};
|
};
|
||||||
@ -122,7 +121,6 @@ static int
|
|||||||
virSecuritySELinuxContextListAppend(virSecuritySELinuxContextListPtr list,
|
virSecuritySELinuxContextListAppend(virSecuritySELinuxContextListPtr list,
|
||||||
const char *path,
|
const char *path,
|
||||||
const char *tcon,
|
const char *tcon,
|
||||||
bool optional,
|
|
||||||
bool remember,
|
bool remember,
|
||||||
bool restore)
|
bool restore)
|
||||||
{
|
{
|
||||||
@ -135,7 +133,6 @@ virSecuritySELinuxContextListAppend(virSecuritySELinuxContextListPtr list,
|
|||||||
if (VIR_STRDUP(item->path, path) < 0 || VIR_STRDUP(item->tcon, tcon) < 0)
|
if (VIR_STRDUP(item->path, path) < 0 || VIR_STRDUP(item->tcon, tcon) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
item->optional = optional;
|
|
||||||
item->remember = remember;
|
item->remember = remember;
|
||||||
item->restore = restore;
|
item->restore = restore;
|
||||||
|
|
||||||
@ -170,7 +167,6 @@ virSecuritySELinuxContextListFree(void *opaque)
|
|||||||
* virSecuritySELinuxTransactionAppend:
|
* virSecuritySELinuxTransactionAppend:
|
||||||
* @path: Path to chown
|
* @path: Path to chown
|
||||||
* @tcon: target context
|
* @tcon: target context
|
||||||
* @optional: true if setting @tcon is optional
|
|
||||||
* @remember: if the original owner should be recorded/recalled
|
* @remember: if the original owner should be recorded/recalled
|
||||||
* @restore: if current operation is set or restore
|
* @restore: if current operation is set or restore
|
||||||
*
|
*
|
||||||
@ -187,7 +183,6 @@ virSecuritySELinuxContextListFree(void *opaque)
|
|||||||
static int
|
static int
|
||||||
virSecuritySELinuxTransactionAppend(const char *path,
|
virSecuritySELinuxTransactionAppend(const char *path,
|
||||||
const char *tcon,
|
const char *tcon,
|
||||||
bool optional,
|
|
||||||
bool remember,
|
bool remember,
|
||||||
bool restore)
|
bool restore)
|
||||||
{
|
{
|
||||||
@ -198,7 +193,7 @@ virSecuritySELinuxTransactionAppend(const char *path,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (virSecuritySELinuxContextListAppend(list, path, tcon,
|
if (virSecuritySELinuxContextListAppend(list, path, tcon,
|
||||||
optional, remember, restore) < 0)
|
remember, restore) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -234,7 +229,6 @@ virSecuritySELinuxRecallLabel(const char *path,
|
|||||||
static int virSecuritySELinuxSetFileconHelper(virSecurityManagerPtr mgr,
|
static int virSecuritySELinuxSetFileconHelper(virSecurityManagerPtr mgr,
|
||||||
const char *path,
|
const char *path,
|
||||||
const char *tcon,
|
const char *tcon,
|
||||||
bool optional,
|
|
||||||
bool remember);
|
bool remember);
|
||||||
|
|
||||||
|
|
||||||
@ -290,7 +284,6 @@ virSecuritySELinuxTransactionRun(pid_t pid ATTRIBUTE_UNUSED,
|
|||||||
rv = virSecuritySELinuxSetFileconHelper(list->manager,
|
rv = virSecuritySELinuxSetFileconHelper(list->manager,
|
||||||
item->path,
|
item->path,
|
||||||
item->tcon,
|
item->tcon,
|
||||||
item->optional,
|
|
||||||
remember);
|
remember);
|
||||||
} else {
|
} else {
|
||||||
rv = virSecuritySELinuxRestoreFileLabel(list->manager,
|
rv = virSecuritySELinuxRestoreFileLabel(list->manager,
|
||||||
@ -1342,7 +1335,6 @@ static int
|
|||||||
virSecuritySELinuxSetFileconHelper(virSecurityManagerPtr mgr,
|
virSecuritySELinuxSetFileconHelper(virSecurityManagerPtr mgr,
|
||||||
const char *path,
|
const char *path,
|
||||||
const char *tcon,
|
const char *tcon,
|
||||||
bool optional,
|
|
||||||
bool remember)
|
bool remember)
|
||||||
{
|
{
|
||||||
bool privileged = virSecurityManagerGetPrivileged(mgr);
|
bool privileged = virSecurityManagerGetPrivileged(mgr);
|
||||||
@ -1353,7 +1345,7 @@ virSecuritySELinuxSetFileconHelper(virSecurityManagerPtr mgr,
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
if ((rc = virSecuritySELinuxTransactionAppend(path, tcon,
|
if ((rc = virSecuritySELinuxTransactionAppend(path, tcon,
|
||||||
optional, remember, false)) < 0)
|
remember, false)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
else if (rc > 0)
|
else if (rc > 0)
|
||||||
return 0;
|
return 0;
|
||||||
@ -1425,7 +1417,7 @@ virSecuritySELinuxSetFilecon(virSecurityManagerPtr mgr,
|
|||||||
const char *tcon,
|
const char *tcon,
|
||||||
bool remember)
|
bool remember)
|
||||||
{
|
{
|
||||||
return virSecuritySELinuxSetFileconHelper(mgr, path, tcon, false, remember);
|
return virSecuritySELinuxSetFileconHelper(mgr, path, tcon, remember);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1512,7 +1504,7 @@ virSecuritySELinuxRestoreFileLabel(virSecurityManagerPtr mgr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((rc = virSecuritySELinuxTransactionAppend(path, NULL,
|
if ((rc = virSecuritySELinuxTransactionAppend(path, NULL,
|
||||||
false, recall, true)) < 0) {
|
recall, true)) < 0) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
} else if (rc > 0) {
|
} else if (rc > 0) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user