diff options
author | Werner Koch <[email protected]> | 2018-03-23 07:14:58 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2018-03-23 07:37:14 +0000 |
commit | 05c55ee260edc07cd19da56dfd00347bfe3f529c (patch) | |
tree | 058fda975959ac7bd01f1707d0be6c0ce1af6af0 /agent/command.c | |
parent | build: Fix the manual source field. (diff) | |
download | gnupg-05c55ee260edc07cd19da56dfd00347bfe3f529c.tar.gz gnupg-05c55ee260edc07cd19da56dfd00347bfe3f529c.zip |
agent: New OPTION pretend-request-origin
* common/shareddefs.h (request_origin_t): New.
* common/agent-opt.c (parse_request_origin): New.
(str_request_origin): New.
* agent/command.c (option_handler): Implement new option.
--
This allows to pretend that a request originated from the extra or
browser socket.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'agent/command.c')
-rw-r--r-- | agent/command.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/agent/command.c b/agent/command.c index f9bc6ca96..8bb9b6a70 100644 --- a/agent/command.c +++ b/agent/command.c @@ -3101,6 +3101,21 @@ option_handler (assuan_context_t ctx, const char *key, const char *value) ctrl->s2k_count = 0; } } + else if (!strcmp (key, "pretend-request-origin")) + { + log_assert (!ctrl->restricted); + switch (parse_request_origin (value)) + { + case REQUEST_ORIGIN_LOCAL: ctrl->restricted = 0; break; + case REQUEST_ORIGIN_REMOTE: ctrl->restricted = 1; break; + case REQUEST_ORIGIN_BROWSER: ctrl->restricted = 2; break; + default: + err = gpg_error (GPG_ERR_INV_VALUE); + /* Better pretend to be remote in case of a bad value. */ + ctrl->restricted = 1; + break; + } + } else err = gpg_error (GPG_ERR_UNKNOWN_OPTION); |