mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
gpgsm: Add command option "offline".
* sm/server.c (option_handler): Add "offline". (cmd_getinfo): Ditto. * sm/certchain.c (is_cert_still_valid): (do_validate_chain): * sm/gpgsm.c (gpgsm_init_default_ctrl): Default "offline" to the value of --disable-dirmngr. * sm/call-dirmngr.c (start_dirmngr_ext): Better also check for ctrl->offline. -- Adding this option makes it easier to implement the corresponding feature in gpgme. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
d2fdf2e1b6
commit
2c9c46e2a2
6 changed files with 151 additions and 8 deletions
19
sm/server.c
19
sm/server.c
|
@ -309,6 +309,16 @@ option_handler (assuan_context_t ctx, const char *key, const char *value)
|
|||
{
|
||||
ctrl->server_local->no_encrypt_to = 1;
|
||||
}
|
||||
else if (!strcmp (key, "offline"))
|
||||
{
|
||||
/* We ignore this option if gpgsm has been started with
|
||||
--disable-dirmngr (which also sets offline). */
|
||||
if (!opt.disable_dirmngr)
|
||||
{
|
||||
int i = *value? !!atoi (value) : 1;
|
||||
ctrl->offline = i;
|
||||
}
|
||||
}
|
||||
else
|
||||
err = gpg_error (GPG_ERR_UNKNOWN_OPTION);
|
||||
|
||||
|
@ -1093,10 +1103,12 @@ static const char hlp_getinfo[] =
|
|||
" pid - Return the process id of the server.\n"
|
||||
" agent-check - Return success if the agent is running.\n"
|
||||
" cmd_has_option CMD OPT\n"
|
||||
" - Returns OK if the command CMD implements the option OPT.";
|
||||
" - Returns OK if the command CMD implements the option OPT.\n"
|
||||
" offline - Returns OK if the conenction is in offline mode.";
|
||||
static gpg_error_t
|
||||
cmd_getinfo (assuan_context_t ctx, char *line)
|
||||
{
|
||||
ctrl_t ctrl = assuan_get_pointer (ctx);
|
||||
int rc = 0;
|
||||
|
||||
if (!strcmp (line, "version"))
|
||||
|
@ -1113,7 +1125,6 @@ cmd_getinfo (assuan_context_t ctx, char *line)
|
|||
}
|
||||
else if (!strcmp (line, "agent-check"))
|
||||
{
|
||||
ctrl_t ctrl = assuan_get_pointer (ctx);
|
||||
rc = gpgsm_agent_send_nop (ctrl);
|
||||
}
|
||||
else if (!strncmp (line, "cmd_has_option", 14)
|
||||
|
@ -1148,6 +1159,10 @@ cmd_getinfo (assuan_context_t ctx, char *line)
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (!strcmp (line, "offline"))
|
||||
{
|
||||
rc = ctrl->offline? 0 : gpg_error (GPG_ERR_GENERAL);
|
||||
}
|
||||
else
|
||||
rc = set_error (GPG_ERR_ASS_PARAMETER, "unknown value for WHAT");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue