int r;
assert(c);
+ assert(glob);
rename = empty_to_null(rename);
_CREDENTIAL_SEARCH_PATH_INVALID = -EINVAL,
} CredentialSearchPath;
-static char **credential_search_path(const ExecParameters *params, CredentialSearchPath path) {
+static char** credential_search_path(const ExecParameters *params, CredentialSearchPath path) {
_cleanup_strv_free_ char **l = NULL;
assert(params);
if (DEBUG_LOGGING) {
_cleanup_free_ char *t = strv_join(l, ":");
-
log_debug("Credential search path is: %s", strempty(t));
}
return -ENOMEM;
if (!credential_name_valid(sub_id))
- return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Credential would get ID %s, which is not valid, refusing", sub_id);
+ return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Credential would get ID '%s', which is not valid, refusing.", sub_id);
if (faccessat(args->dfd, sub_id, F_OK, AT_SYMLINK_NOFOLLOW) >= 0) {
log_debug("Skipping credential with duplicated ID %s at %s", sub_id, path);
uint64_t left = CREDENTIALS_TOTAL_SIZE_MAX;
_cleanup_close_ int dfd = -EBADF;
- ExecImportCredential *ic;
- ExecLoadCredential *lc;
- ExecSetCredential *sc;
int r;
assert(context);
return r;
/* First, load credentials off disk (or acquire via AF_UNIX socket) */
+ ExecLoadCredential *lc;
HASHMAP_FOREACH(lc, context->load_credentials) {
_cleanup_close_ int sub_fd = -EBADF;
* propagate a credential passed to us from further up. */
if (path_is_absolute(lc->path)) {
- sub_fd = open(lc->path, O_DIRECTORY|O_CLOEXEC|O_RDONLY);
+ sub_fd = open(lc->path, O_DIRECTORY|O_CLOEXEC);
if (sub_fd < 0 && !IN_SET(errno,
ENOTDIR, /* Not a directory */
ENOENT)) /* Doesn't exist? */
- return log_debug_errno(errno, "Failed to open '%s': %m", lc->path);
+ return log_debug_errno(errno, "Failed to open credential source '%s': %m", lc->path);
}
if (sub_fd < 0)
/* Next, look for system credentials and credentials in the credentials store. Note that these do not
* override any credentials found earlier. */
+ ExecImportCredential *ic;
ORDERED_SET_FOREACH(ic, context->import_credentials) {
_cleanup_free_ char **search_path = NULL;
/* Finally, we add in literally specified credentials. If the credentials already exist, we'll not
* add them, so that they can act as a "default" if the same credential is specified multiple times. */
+ ExecSetCredential *sc;
HASHMAP_FOREACH(sc, context->set_credentials) {
_cleanup_(iovec_done_erase) struct iovec plaintext = {};
const char *data;