mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
wks: Add framework for policy flags.
* tools/call-dirmngr.c (wkd_get_policy_flags): New. * tools/gpg-wks.h (struct policy_flags_s, policy_flags_t): New. * tools/wks-util.c (wks_parse_policy): New. * tools/gpg-wks-client.c (command_send): Get the policy flags to show a new info line. * tools/gpg-wks-server.c (get_policy_flags): New. (process_new_key): get policy flag and add a stub for "auth-submit". (command_list_domains): Check policy flags. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
505ee45106
commit
46362cbc0e
6 changed files with 310 additions and 11 deletions
|
@ -203,3 +203,58 @@ wkd_get_submission_address (const char *addrspec, char **r_addrspec)
|
|||
assuan_release (ctx);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
/* Ask the dirmngr for the policy flags and return them as an estream
|
||||
* memory stream. If no policy flags are set, NULL is stored at
|
||||
* R_BUFFER. */
|
||||
gpg_error_t
|
||||
wkd_get_policy_flags (const char *addrspec, estream_t *r_buffer)
|
||||
{
|
||||
gpg_error_t err;
|
||||
assuan_context_t ctx;
|
||||
struct wkd_get_parm_s parm;
|
||||
char *line = NULL;
|
||||
char *buffer = NULL;
|
||||
|
||||
memset (&parm, 0, sizeof parm);
|
||||
*r_buffer = NULL;
|
||||
|
||||
err = connect_dirmngr (&ctx);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
line = es_bsprintf ("WKD_GET --policy-flags -- %s", addrspec);
|
||||
if (!line)
|
||||
{
|
||||
err = gpg_error_from_syserror ();
|
||||
goto leave;
|
||||
}
|
||||
if (strlen (line) + 2 >= ASSUAN_LINELENGTH)
|
||||
{
|
||||
err = gpg_error (GPG_ERR_TOO_LARGE);
|
||||
goto leave;
|
||||
}
|
||||
|
||||
parm.memfp = es_fopenmem (0, "rwb");
|
||||
if (!parm.memfp)
|
||||
{
|
||||
err = gpg_error_from_syserror ();
|
||||
goto leave;
|
||||
}
|
||||
err = assuan_transact (ctx, line, wkd_get_data_cb, &parm,
|
||||
NULL, NULL, wkd_get_status_cb, &parm);
|
||||
if (err)
|
||||
goto leave;
|
||||
|
||||
es_rewind (parm.memfp);
|
||||
*r_buffer = parm.memfp;
|
||||
parm.memfp = 0;
|
||||
|
||||
leave:
|
||||
es_free (buffer);
|
||||
es_fclose (parm.memfp);
|
||||
xfree (line);
|
||||
assuan_release (ctx);
|
||||
return err;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue