forked from pool/systemd
Marcus Meissner
bc83988d29
- Update to new upstream release 218 I really want networkd with a functioning machinectl --network-veth (broken in 13.2). OBS-URL: https://build.opensuse.org/request/show/280821 OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=844
83 lines
3.9 KiB
Diff
83 lines
3.9 KiB
Diff
---
|
|
man/tmpfiles.d.xml | 5 +++++
|
|
src/tmpfiles/tmpfiles.c | 42 ++++++++++++++++++++++++++++++++++++++----
|
|
2 files changed, 43 insertions(+), 4 deletions(-)
|
|
|
|
Index: systemd-218/man/tmpfiles.d.xml
|
|
===================================================================
|
|
--- systemd-218.orig/man/tmpfiles.d.xml
|
|
+++ systemd-218/man/tmpfiles.d.xml
|
|
@@ -545,6 +545,11 @@ r! /tmp/.X[0-9]*-lock</programlisting>
|
|
and <varname>w</varname> may be used to
|
|
specify a short string that is written to the
|
|
file, suffixed by a newline. For
|
|
+ <varname>x</varname>, <varname>X</varname>,
|
|
+ a comma separated list of usernames. If given,
|
|
+ only paths belonging to these users will be
|
|
+ excluded during directory cleanup.
|
|
+ Ignored for all other lines. For
|
|
<varname>C</varname>, specifies the source file
|
|
or directory. For <varname>t</varname> determines
|
|
extended attributes to be set. Ignored for all other lines.</para>
|
|
Index: systemd-218/src/tmpfiles/tmpfiles.c
|
|
===================================================================
|
|
--- systemd-218.orig/src/tmpfiles/tmpfiles.c
|
|
+++ systemd-218/src/tmpfiles/tmpfiles.c
|
|
@@ -278,6 +278,7 @@ static int dir_cleanup(
|
|
struct timespec times[2];
|
|
bool deleted = false;
|
|
int r = 0;
|
|
+ Item *found = NULL;
|
|
|
|
while ((dent = readdir(d))) {
|
|
struct stat s;
|
|
@@ -322,11 +323,44 @@ static int dir_cleanup(
|
|
}
|
|
|
|
/* Is there an item configured for this path? */
|
|
- if (hashmap_get(items, sub_path))
|
|
- continue;
|
|
+ found = hashmap_get(items, sub_path);
|
|
|
|
- if (find_glob(globs, sub_path))
|
|
- continue;
|
|
+ if (!found)
|
|
+ found = find_glob(globs, sub_path);
|
|
+
|
|
+ if (found) {
|
|
+ /* evaluate username arguments in ignore statements */
|
|
+ if (found->type == IGNORE_PATH || found->type == IGNORE_DIRECTORY_PATH) {
|
|
+ if (!found->argument) {
|
|
+ continue;
|
|
+ } else {
|
|
+ struct passwd *pw;
|
|
+ char *userfound = NULL, *args = strdup(found->argument);
|
|
+ bool match = false;
|
|
+ uid_t uid = -1;
|
|
+
|
|
+ while ((userfound = strsep(&args, ","))) {
|
|
+ pw = getpwnam(userfound);
|
|
+
|
|
+ if (!pw)
|
|
+ log_error("Unknown user '%s' in ignore statement.", userfound);
|
|
+ else {
|
|
+ uid = pw->pw_uid;
|
|
+ if (s.st_uid == uid) {
|
|
+ match = true;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ if (match) {
|
|
+ found = NULL;
|
|
+ continue;
|
|
+ }
|
|
+ }
|
|
+ } else {
|
|
+ continue;
|
|
+ }
|
|
+ }
|
|
|
|
if (S_ISDIR(s.st_mode)) {
|
|
|