diff options
author | Lennart Poettering <lennart@poettering.net> | 2021-11-02 23:03:17 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2021-11-13 00:22:16 +0100 |
commit | 6b945d7031f34a1652d2e6808bfffbd3761e642e (patch) | |
tree | 8ca620d74d6f27a6f016d1f53e4c513bc72aa6ff /src/home/homework-password-cache.h | |
parent | 0881991c3236a894378167ea9006dbf15a56ba58 (diff) | |
download | systemd-6b945d7031f34a1652d2e6808bfffbd3761e642e.tar.gz |
homework: split out password cache logic into its own .c/.h file
Preparation for extending it further down the line.
Diffstat (limited to 'src/home/homework-password-cache.h')
-rw-r--r-- | src/home/homework-password-cache.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/home/homework-password-cache.h b/src/home/homework-password-cache.h new file mode 100644 index 0000000000..6b4de15724 --- /dev/null +++ b/src/home/homework-password-cache.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +#pragma once + +#include "strv.h" +#include "user-record.h" + +typedef struct PasswordCache { + /* Decoding passwords from security tokens is expensive and typically requires user interaction, + * hence cache any we already figured out. */ + char **pkcs11_passwords; + char **fido2_passwords; +} PasswordCache; + +void password_cache_free(PasswordCache *cache); + +static inline bool password_cache_contains(const PasswordCache *cache, const char *p) { + if (!cache) + return false; + + return strv_contains(cache->pkcs11_passwords, p) || strv_contains(cache->fido2_passwords, p); +} |