From: Lennart Poettering Date: Wed, 13 Apr 2022 21:03:22 +0000 (+0200) Subject: execute: sort directory entries when loading credentials recursively X-Git-Tag: v251-rc2~75^2~7 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9883cbb203b1648cc8c49038a03dd7fe30a24761;p=thirdparty%2Fsystemd.git execute: sort directory entries when loading credentials recursively Given that the recusive credential loading allows two ways to load the same credentials, it's important to define a clear order so that it is always the same one that wins. i.e. if you use LoadCredential=foobar:/tmp/xyz and there are two files /tmp/xyz/abc/cde and /tmp/xyz/abc_cde these would both result in a credential foobar_abc_cde being set, hence it is important to make clear which one shall win, and that it is always the same one. --- diff --git a/src/core/execute.c b/src/core/execute.c index a0c58ac255e..c85ca2a3564 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -2819,7 +2819,7 @@ static int acquire_credentials( /* path= */ lc->id, /* recurse_dir() will suffix the subdir paths from here to the top-level id */ /* statx_mask= */ 0, /* n_depth_max= */ UINT_MAX, - RECURSE_DIR_IGNORE_DOT|RECURSE_DIR_ENSURE_TYPE, + RECURSE_DIR_SORT|RECURSE_DIR_IGNORE_DOT|RECURSE_DIR_ENSURE_TYPE, load_cred_recurse_dir_cb, &(struct load_cred_args) { .context = context,