mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
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 <wk@gnupg.org>
This commit is contained in:
parent
5400a5bb77
commit
05c55ee260
4 changed files with 84 additions and 0 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue