X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fsysusers%2Fsysusers.c;h=e086c72682c39a847363fe41e185ed6753f95e83;hb=a334cbba7222d3d7d886c17c828fa4227c656535;hp=129493a1e7ad5779410064dc277db49c9824550d;hpb=38c74dad1c3d605018e61074e0b80f6b9523b1c8;p=elogind.git diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c index 129493a1e..e086c7268 100644 --- a/src/sysusers/sysusers.c +++ b/src/sysusers/sysusers.c @@ -62,6 +62,8 @@ typedef struct Item { static char *arg_root = NULL; static const char conf_file_dirs[] = + "/etc/sysusers.d\0" + "/run/sysusers.d\0" "/usr/local/lib/sysusers.d\0" "/usr/lib/sysusers.d\0" #ifdef HAVE_SPLIT_USR @@ -310,7 +312,11 @@ static int write_files(void) { _cleanup_fclose_ FILE *original = NULL; group_path = fix_root("/etc/group"); + r = label_context_set("/etc/group", S_IFREG); + if (r < 0) + goto finish; r = fopen_temporary(group_path, &group, &group_tmp); + label_context_clear(); if (r < 0) goto finish; @@ -386,9 +392,14 @@ static int write_files(void) { _cleanup_fclose_ FILE *original = NULL; passwd_path = fix_root("/etc/passwd"); - r = fopen_temporary(passwd_path, &passwd, &passwd_tmp); + r = label_context_set("/etc/passwd", S_IFREG); if (r < 0) goto finish; + r = fopen_temporary(passwd_path, &passwd, &passwd_tmp); + label_context_clear(); + if (r < 0) { + goto finish; + } if (fchmod(fileno(passwd), 0644) < 0) { r = -errno; @@ -1489,6 +1500,8 @@ int main(int argc, char *argv[]) { umask(0022); + label_init(NULL); + r = 0; if (optind < argc) {