systemd/systemd-add-user-keep.patch
Dominique Leuenberger a4023d0c37 Accepting request 333777 from Base:System
- Fix patch tty-ask-password-agent-on-console.patch not to crash
  away but enable it to ask on all devices of /dev/console

- Avoid "file not found /etc/udev/rules.d/70-persistent-net.rules"
  waring occurring in %post

- Add patch let-vconsole-setup-get-properties-only-once-to-copy-them.patch
  to avoid broken virtual console mapping due stressed ioctl API
  for the virtual consoles (boo#904214)

- Fix last change that is use the new name for udev packages in %pretrans. 

- restore usage of LUA in %pretrans.

- Try to generate the systemd users and groups always in same order
  to avoid republish other packages (boo#944660) 

- cleanup specfile by removing commands that were dealing with systemd
  pre-generated files: we're now using systemd tarball generated directly
  from the git repo which doesn't contain any of these files.
- there's no point in using LUA in %pretrans

- Drop 0009-make-xsltproc-use-correct-ROFF-links.patch
This patch was initialy added to workaround bsc#842844. But it
appears that man(1) was fixed (included since 13.2 at least) to
handle manual pages that consist only of a .so directive such as
'.so <page>'.

- Change use-rndaddentropy-ioctl-to-load-random-seed.patch to
  make it work on big endian

OBS-URL: https://build.opensuse.org/request/show/333777
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=223
2015-09-27 12:32:31 +00:00

93 lines
4.0 KiB
Diff

---
man/tmpfiles.d.xml | 3 +++
src/tmpfiles/tmpfiles.c | 47 ++++++++++++++++++++++++++++++++++++++++-------
2 files changed, 43 insertions(+), 7 deletions(-)
Index: systemd-221/man/tmpfiles.d.xml
===================================================================
--- systemd-221.orig/man/tmpfiles.d.xml
+++ systemd-221/man/tmpfiles.d.xml
@@ -528,6 +528,9 @@
<varname>f</varname>, <varname>F</varname>, 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>, <varname>T</varname>
determines extended attributes to be set. For
Index: systemd-221/src/tmpfiles/tmpfiles.c
===================================================================
--- systemd-221.orig/src/tmpfiles/tmpfiles.c
+++ systemd-221/src/tmpfiles/tmpfiles.c
@@ -37,6 +37,7 @@
#include <sys/stat.h>
#include <sys/xattr.h>
#include <linux/fs.h>
+#include <pwd.h>
#include "log.h"
#include "util.h"
@@ -358,6 +359,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;
@@ -408,14 +410,45 @@ static int dir_cleanup(
}
/* Is there an item configured for this path? */
- if (ordered_hashmap_get(items, sub_path)) {
- log_debug("Ignoring \"%s\": a separate entry exists.", sub_path);
- continue;
+ bool found_glob = false;
+ found = ordered_hashmap_get(items, sub_path);
+ if (!found) {
+ found_glob = true;
+ found = find_glob(globs, sub_path);
}
-
- if (find_glob(globs, sub_path)) {
- log_debug("Ignoring \"%s\": a separate glob exists.", sub_path);
- continue;
+ if (found) {
+ struct passwd *pw;
+ char *userfound = NULL, *args;
+ bool match = false;
+ uid_t uid = -1;
+
+ /* evaluate username arguments in ignore statements */
+ if ((found->type != IGNORE_PATH && found->type != IGNORE_DIRECTORY_PATH) ||
+ !found->argument) {
+ if (found_glob)
+ log_debug("Ignoring \"%s\": a separate glob exists.", sub_path);
+ else
+ log_debug("Ignoring \"%s\": a separate entry exists.", sub_path);
+ continue;
+ }
+ args = strdup(found->argument);
+ assert_se(args != NULL);
+ while ((userfound = strsep(&args, ",")) != NULL) {
+ pw = getpwnam(userfound);
+ if (pw == NULL) {
+ log_error("Unknown user '%s' in ignore statement.", userfound);
+ continue;
+ }
+ uid = pw->pw_uid;
+ if (s.st_uid == uid) {
+ match = true;
+ break;
+ }
+ }
+ if (match) {
+ found = NULL;
+ continue;
+ }
}
if (S_ISDIR(s.st_mode)) {