]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journald: move uid_for_system_journal() to uid-alloc-range.h
authorLennart Poettering <lennart@poettering.net>
Wed, 7 Jun 2023 13:16:50 +0000 (15:16 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 8 Jun 2023 07:32:04 +0000 (09:32 +0200)
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.

src/basic/uid-alloc-range.c
src/basic/uid-alloc-range.h
src/journal/journald-server.c

index fe7f158c41e4d8cde42ff083679d17589389a19a..669cb6d56f7be263dc712ab8732b068e95881c17 100644 (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);
+}
index d3bf077045fa32f62e946570284d886a8e151378..5badde148a564daf3dee56d4f31bc3b16c84ce7e 100644 (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);
index 1763a2556ea9ef3788ee57fcd38bc48dcf8edc44..2932a190ff7e4bfc66a9f4a46753abaca4983c26 100644 (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);