summaryrefslogtreecommitdiff
path: root/src/core/dynamic-user.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-09-28 20:28:09 +0200
committerLennart Poettering <lennart@poettering.net>2017-10-02 17:41:44 +0200
commitda50b85af7299c19cb345bd0fa2aa2f19f176ff3 (patch)
treeaa0d93ad4e3b83e2232701f8623abd0da492727a /src/core/dynamic-user.h
parent4a6283603324afb3da50c14a3283c5df2cc01960 (diff)
downloadsystemd-da50b85af7299c19cb345bd0fa2aa2f19f176ff3.tar.gz
core: when looking for a UID to use for a dynamic UID start with the current owner of the StateDirectory= and friends
Let's optimize dynamic UID allocation a bit: if a StateDirectory= (or suchlike) is configured, we start our allocation loop from that UID and use it if it currently isn't used otherwise. This is beneficial as it saves us from having to expensively recursively chown() these directories in the typical case (which StateDirectory= does when it notices that the owner of the directory doesn't match the UID picked). With this in place we now have the a three-phase logic for allocating a dynamic UID: a) first, we try to use the owning UID of StateDirectory=, CacheDirectory=, LogDirectory= if that exists and is currently otherwise unused. b) if that didn't work out, we hash the UID from the service name c) if that didn't yield an unused UID either, randomly pick new ones until we find a free one.
Diffstat (limited to 'src/core/dynamic-user.h')
-rw-r--r--src/core/dynamic-user.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/dynamic-user.h b/src/core/dynamic-user.h
index 0b8bce1a72..e7de4f46ae 100644
--- a/src/core/dynamic-user.h
+++ b/src/core/dynamic-user.h
@@ -45,7 +45,7 @@ struct DynamicUser {
int dynamic_user_acquire(Manager *m, const char *name, DynamicUser **ret);
-int dynamic_user_realize(DynamicUser *d, uid_t *ret);
+int dynamic_user_realize(DynamicUser *d, char **suggested_paths, uid_t *ret);
int dynamic_user_current(DynamicUser *d, uid_t *ret);
DynamicUser* dynamic_user_ref(DynamicUser *d);
@@ -60,7 +60,7 @@ int dynamic_user_lookup_uid(Manager *m, uid_t uid, char **ret);
int dynamic_user_lookup_name(Manager *m, const char *name, uid_t *ret);
int dynamic_creds_acquire(DynamicCreds *creds, Manager *m, const char *user, const char *group);
-int dynamic_creds_realize(DynamicCreds *creds, uid_t *uid, gid_t *gid);
+int dynamic_creds_realize(DynamicCreds *creds, char **suggested_paths, uid_t *uid, gid_t *gid);
void dynamic_creds_unref(DynamicCreds *creds);
void dynamic_creds_destroy(DynamicCreds *creds);