View | Details | Raw Unified | Return to bug 903009
Collapse All | Expand All

(-)systemd-210/src/tmpfiles/tmpfiles.c (-6 / +39 lines)
Lines 263-268 Link Here
263
        struct timespec times[2];
263
        struct timespec times[2];
264
        bool deleted = false;
264
        bool deleted = false;
265
        int r = 0;
265
        int r = 0;
266
        Item *found = NULL;
266
267
267
        while ((dent = readdir(d))) {
268
        while ((dent = readdir(d))) {
268
                struct stat s;
269
                struct stat s;
Lines 306-317 Link Here
306
                }
307
                }
307
308
308
                /* Is there an item configured for this path? */
309
                /* Is there an item configured for this path? */
309
                if (hashmap_get(items, sub_path))
310
                found = hashmap_get(items, sub_path);
310
                        continue;
311
         
311
312
                if (!found)
312
                if (find_glob(globs, sub_path))
313
                        found = find_glob(globs, sub_path);
313
                        continue;
314
314
315
                if (found) {
316
                        /* evaluate username arguments in exclude stadements */
317
                        if (found->type == IGNORE_PATH || found->type == IGNORE_DIRECTORY_PATH) {
318
                                if (!found->argument)
319
                                        continue; 
320
                                else {
321
                                        struct passwd *pw;
322
                                        char *userfound = NULL, *args = strdup(found->argument);
323
                                        bool match = false;
324
                                        int uid = -1;
325
326
                                        while ((userfound = strsep(&args, ","))) {
327
                                                pw = getpwnam(userfound);
328
329
                                                if (!pw)
330
                                                        log_error("Unknown user '%s' in exclude statement.", userfound);
331
                                                else {
332
                                                        uid = pw->pw_uid;
333
                                                        if (s.st_uid == uid) { 
334
                                                                match = true;
335
                                                                break;
336
                                                        }
337
                                                }
338
                                        }
339
                                        if (match) {
340
                                                found = NULL;
341
                                                continue;  
342
                                        }
343
                                }
344
                        } else 
345
                                 continue; 
346
                }
347
                        
315
                if (S_ISDIR(s.st_mode)) {
348
                if (S_ISDIR(s.st_mode)) {
316
349
317
                        if (mountpoint &&
350
                        if (mountpoint &&

Return to bug 903009