diff options
author | David Härdeman <david@hardeman.nu> | 2014-03-25 11:05:23 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-04-24 09:23:54 +0200 |
commit | 9fa1de965a0954dcb6d855ebe0513077515a0daa (patch) | |
tree | 7c6c8133d726a7d379361c4541fe15cb20bd7342 /src/shared/ask-password-api.c | |
parent | 0d522a7a0547982eae9ab1b5971e4bed9c2fbc7c (diff) |
Add more password agent information
Add an (optional) "Id" key in the password agent .ask files. The Id is
supposed to be a simple string in "<subsystem>:<target>" form which
is used to provide more information on what the requested passphrase
is to be used for (which e.g. allows an agent to only react to cryptsetup
requests).
(v2: rebased, fixed indentation, escape name, use strappenda)
Diffstat (limited to 'src/shared/ask-password-api.c')
-rw-r--r-- | src/shared/ask-password-api.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/shared/ask-password-api.c b/src/shared/ask-password-api.c index eb40995010..c3c78b69fb 100644 --- a/src/shared/ask-password-api.c +++ b/src/shared/ask-password-api.c @@ -298,6 +298,7 @@ fail: int ask_password_agent( const char *message, const char *icon, + const char *id, usec_t until, bool accept_cached, char ***_passphrases) { @@ -373,6 +374,9 @@ int ask_password_agent( if (icon) fprintf(f, "Icon=%s\n", icon); + if (id) + fprintf(f, "Id=%s\n", id); + fflush(f); if (ferror(f)) { @@ -537,7 +541,8 @@ finish: return r; } -int ask_password_auto(const char *message, const char *icon, usec_t until, bool accept_cached, char ***_passphrases) { +int ask_password_auto(const char *message, const char *icon, const char *id, + usec_t until, bool accept_cached, char ***_passphrases) { assert(message); assert(_passphrases); @@ -556,5 +561,5 @@ int ask_password_auto(const char *message, const char *icon, usec_t until, bool *_passphrases = l; return r; } else - return ask_password_agent(message, icon, until, accept_cached, _passphrases); + return ask_password_agent(message, icon, id, until, accept_cached, _passphrases); } |