struct _virSecuritySELinuxContextItem {
char *path;
char *tcon;
- bool optional;
bool remember; /* Whether owner remembering should be done for @path/@src */
bool restore; /* Whether current operation is 'set' or 'restore' */
};
virSecuritySELinuxContextListAppend(virSecuritySELinuxContextListPtr list,
const char *path,
const char *tcon,
- bool optional,
bool remember,
bool restore)
{
if (VIR_STRDUP(item->path, path) < 0 || VIR_STRDUP(item->tcon, tcon) < 0)
goto cleanup;
- item->optional = optional;
item->remember = remember;
item->restore = restore;
* virSecuritySELinuxTransactionAppend:
* @path: Path to chown
* @tcon: target context
- * @optional: true if setting @tcon is optional
* @remember: if the original owner should be recorded/recalled
* @restore: if current operation is set or restore
*
static int
virSecuritySELinuxTransactionAppend(const char *path,
const char *tcon,
- bool optional,
bool remember,
bool restore)
{
return 0;
if (virSecuritySELinuxContextListAppend(list, path, tcon,
- optional, remember, restore) < 0)
+ remember, restore) < 0)
return -1;
return 1;
static int virSecuritySELinuxSetFileconHelper(virSecurityManagerPtr mgr,
const char *path,
const char *tcon,
- bool optional,
bool remember);
rv = virSecuritySELinuxSetFileconHelper(list->manager,
item->path,
item->tcon,
- item->optional,
remember);
} else {
rv = virSecuritySELinuxRestoreFileLabel(list->manager,
virSecuritySELinuxSetFileconHelper(virSecurityManagerPtr mgr,
const char *path,
const char *tcon,
- bool optional,
bool remember)
{
bool privileged = virSecurityManagerGetPrivileged(mgr);
int ret = -1;
if ((rc = virSecuritySELinuxTransactionAppend(path, tcon,
- optional, remember, false)) < 0)
+ remember, false)) < 0)
return -1;
else if (rc > 0)
return 0;
const char *tcon,
bool remember)
{
- return virSecuritySELinuxSetFileconHelper(mgr, path, tcon, false, remember);
+ return virSecuritySELinuxSetFileconHelper(mgr, path, tcon, remember);
}
static int
}
if ((rc = virSecuritySELinuxTransactionAppend(path, NULL,
- false, recall, true)) < 0) {
+ recall, true)) < 0) {
goto cleanup;
} else if (rc > 0) {
ret = 0;