1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

wks: Use dedicated type to convey user ids.

* tools/gpg-wks.h (uidinfo_list_s, uidinfo_list_t): New.
* tools/wks-util.c (append_to_uidinfo_list): New.
(free_uidinfo_list): New.
(wks_list_key): Change arg r_mboxes to uidinfo_list_t.  Use
append_to_uidinfo_list.
* tools/gpg-wks-server.c (sserver_ctx_s): Replace strlist_t by
uidinfo_list_t.
(process_new_key): Ditto.
(check_and_publish): Ditto.
(command_receive_cb): Replace free_strlist by free_uidinfo_list.
* tools/gpg-wks-client.c (command_check): Replace strlist_t by
uidinfo_list_t.  Also print user id in verbose mode.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2017-09-18 11:16:07 +02:00
parent 006ca124ed
commit 4e0696de89
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
4 changed files with 91 additions and 32 deletions

View file

@ -119,7 +119,7 @@ const char *fake_submission_addr;
static void wrong_args (const char *text) GPGRT_ATTR_NORETURN;
static gpg_error_t command_supported (char *userid);
static gpg_error_t command_check (char *userid);
static gpg_error_t command_send (const char *fingerprint, char *userid);
static gpg_error_t command_send (const char *fingerprint, const char *userid);
static gpg_error_t encrypt_response (estream_t *r_output, estream_t input,
const char *addrspec,
const char *fingerprint);
@ -597,8 +597,8 @@ command_check (char *userid)
char *addrspec = NULL;
estream_t key = NULL;
char *fpr = NULL;
strlist_t mboxes = NULL;
strlist_t sl;
uidinfo_list_t mboxes = NULL;
uidinfo_list_t sl;
int found = 0;
addrspec = mailbox_from_userid (userid);
@ -657,10 +657,14 @@ command_check (char *userid)
for (sl = mboxes; sl; sl = sl->next)
{
if (!strcmp (sl->d, addrspec))
if (sl->mbox && !strcmp (sl->mbox, addrspec))
found = 1;
if (opt.verbose)
log_info (" addr-spec: %s\n", sl->d);
{
log_info (" user-id: %s\n", sl->uid);
if (sl->mbox)
log_info (" addr-spec: %s\n", sl->mbox);
}
}
if (!found)
{
@ -671,7 +675,7 @@ command_check (char *userid)
leave:
xfree (fpr);
free_strlist (mboxes);
free_uidinfo_list (mboxes);
es_fclose (key);
xfree (addrspec);
return err;
@ -682,7 +686,7 @@ command_check (char *userid)
/* Locate the key by fingerprint and userid and send a publication
* request. */
static gpg_error_t
command_send (const char *fingerprint, char *userid)
command_send (const char *fingerprint, const char *userid)
{
gpg_error_t err;
KEYDB_SEARCH_DESC desc;
@ -706,6 +710,7 @@ command_send (const char *fingerprint, char *userid)
err = gpg_error (GPG_ERR_INV_NAME);
goto leave;
}
addrspec = mailbox_from_userid (userid);
if (!addrspec)
{