1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-26 14:04:03 +03:00

journald: move uid_for_system_journal() to uid-alloc-range.h

Let's move this helper call from journald specific code to src/basic/,
so that we can use it from sd-journal.

While we are at it, slightly extend it to also cover container uids,
which are also routed to the system journal now.

This places the call in uid-alloc-range.[ch] which contains similar
functions that match UID ranges for specific purposes.
This commit is contained in:
Lennart Poettering 2023-06-07 15:16:50 +02:00
parent 8a8b4a8784
commit 115d5145a2
3 changed files with 9 additions and 7 deletions

View File

@ -122,3 +122,10 @@ bool gid_is_system(gid_t gid) {
return gid <= defs->system_gid_max;
}
bool uid_for_system_journal(uid_t uid) {
/* Returns true if the specified UID shall get its data stored in the system journal. */
return uid_is_system(uid) || uid_is_dynamic(uid) || uid == UID_NOBODY || uid_is_container(uid);
}

View File

@ -32,3 +32,5 @@ typedef struct UGIDAllocationRange {
int read_login_defs(UGIDAllocationRange *ret_defs, const char *path, const char *root);
const UGIDAllocationRange *acquire_ugid_allocation_range(void);
bool uid_for_system_journal(uid_t uid);

View File

@ -238,13 +238,6 @@ void server_space_usage_message(Server *s, JournalStorage *storage) {
NULL);
}
static bool uid_for_system_journal(uid_t uid) {
/* Returns true if the specified UID shall get its data stored in the system journal. */
return uid_is_system(uid) || uid_is_dynamic(uid) || uid == UID_NOBODY;
}
static void server_add_acls(ManagedJournalFile *f, uid_t uid) {
assert(f);