<listitem><para>If this option is passed all
files and directories marked with f,
F, d, D in the configuration files are
- created. Files and directories marked with Z
- have their ownership, access mode and security
+ created. Files and directories marked with z,
+ Z have their ownership, access mode and security
labels set.</para></listitem>
</varlistentry>
names.</para></listitem>
</varlistentry>
+ <varlistentry>
+ <term><varname>z</varname></term>
+ <listitem><para>Set ownership, access
+ mode and relabel security context of
+ a file or directory if it exists.
+ Lines of this type accept shell-style
+ globs in place of normal path names.
+ </para></listitem>
+ </varlistentry>
+
<varlistentry>
<term><varname>Z</varname></term>
<listitem><para>Recursively set
<para>The file access mode to use when
creating this file or directory. If omitted or
when set to - the default is used: 0755 for
- directories, 0644 for files. For Z lines
+ directories, 0644 for files. For z, Z lines
if omitted or when set to - the file access mode will
not be modified. This parameter is ignored for x, r, R
lines.</para>
or directory. This may either be a numeric
user/group ID or a user or group name. If
omitted or when set to - the default 0 (root)
- is used. For Z lines when omitted or when set to -
+ is used. For z, Z lines when omitted or when set to -
the file ownership will not be modified.
These parameters are ignored for x, r, R lines.</para>
</refsect2>
IGNORE_PATH = 'x',
REMOVE_PATH = 'r',
RECURSIVE_REMOVE_PATH = 'R',
+ RELABEL_PATH = 'z',
RECURSIVE_RELABEL_PATH = 'Z'
} ItemType;
#define MAX_DEPTH 256
static bool needs_glob(ItemType t) {
- return t == IGNORE_PATH || t == REMOVE_PATH || t == RECURSIVE_REMOVE_PATH || t == RECURSIVE_RELABEL_PATH;
+ return t == IGNORE_PATH || t == REMOVE_PATH || t == RECURSIVE_REMOVE_PATH || t == RELABEL_PATH || t == RECURSIVE_RELABEL_PATH;
}
static struct Item* find_glob(Hashmap *h, const char *match) {
break;
+ case RELABEL_PATH:
+
+ r = glob_item(i, item_set_perms);
+ if (r < 0)
+ return 0;
+ break;
+
case RECURSIVE_RELABEL_PATH:
r = glob_item(i, recursive_relabel);
case CREATE_DIRECTORY:
case CREATE_FIFO:
case IGNORE_PATH:
+ case RELABEL_PATH:
case RECURSIVE_RELABEL_PATH:
break;
case CREATE_DIRECTORY:
case CREATE_FIFO:
case IGNORE_PATH:
+ case RELABEL_PATH:
case RECURSIVE_RELABEL_PATH:
break;
goto finish;
}
- if (type != CREATE_FILE &&
- type != TRUNCATE_FILE &&
- type != CREATE_DIRECTORY &&
- type != TRUNCATE_DIRECTORY &&
- type != CREATE_FIFO &&
- type != IGNORE_PATH &&
- type != REMOVE_PATH &&
- type != RECURSIVE_REMOVE_PATH &&
- type != RECURSIVE_RELABEL_PATH) {
+ switch(type) {
+ case CREATE_FILE:
+ case TRUNCATE_FILE:
+ case CREATE_DIRECTORY:
+ case TRUNCATE_DIRECTORY:
+ case CREATE_FIFO:
+ case IGNORE_PATH:
+ case REMOVE_PATH:
+ case RECURSIVE_REMOVE_PATH:
+ case RELABEL_PATH:
+ case RECURSIVE_RELABEL_PATH:
+ break;
+ default:
log_error("[%s:%u] Unknown file type '%c'.", fname, line, type);
r = -EBADMSG;
goto finish;