]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
ask-password: skip kernel keyring logic if we see EPERM 14085/head
authorLennart Poettering <lennart@poettering.net>
Tue, 19 Nov 2019 17:47:31 +0000 (18:47 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 19 Nov 2019 18:12:09 +0000 (19:12 +0100)
Let's improve compat with container managers that block the keyring
logic and return EPERM for them.

src/shared/ask-password-api.c

index 04ef6b58932816607102698f508a9b8385f4023a..9ffbe1bc4e0dd49e2428c998326df04075d31695 100644 (file)
@@ -168,7 +168,12 @@ static int ask_password_keyring(const char *keyname, AskPasswordFlags flags, cha
                 return -EUNATCH;
 
         r = lookup_key(keyname, &serial);
-        if (r == -ENOSYS) /* when retrieving the distinction doesn't matter */
+        if (ERRNO_IS_NOT_SUPPORTED(r) || r == -EPERM) /* when retrieving the distinction between "kernel or
+                                                       * container manager don't support or allow this" and
+                                                       * "no matching key known" doesn't matter. Note that we
+                                                       * propagate EACCESS here (even if EPERM not) since
+                                                       * that is used if the keyring is available but we lack
+                                                       * access to the key. */
                 return -ENOKEY;
         if (r < 0)
                 return r;