mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-08 12:44:23 +01:00
wks: Add option --fake-submission-addr to gpg-wks-client.
* tools/gpg-wks-client.c (oFakeSubmissionAddr): New. (opts): Add option --fake-submission-addr. (fake_submission_addr): New variable. (parse_arguments): Set it. (command_send): Use --fake-submission-addr. -- This option is useful for testing. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
1cedc32c95
commit
e514a5b725
@ -56,6 +56,7 @@ enum cmd_and_opt_values
|
|||||||
|
|
||||||
oGpgProgram,
|
oGpgProgram,
|
||||||
oSend,
|
oSend,
|
||||||
|
oFakeSubmissionAddr,
|
||||||
|
|
||||||
oDummy
|
oDummy
|
||||||
};
|
};
|
||||||
@ -83,6 +84,7 @@ static ARGPARSE_OPTS opts[] = {
|
|||||||
ARGPARSE_s_n (oSend, "send", "send the mail using sendmail"),
|
ARGPARSE_s_n (oSend, "send", "send the mail using sendmail"),
|
||||||
ARGPARSE_s_s (oOutput, "output", "|FILE|write the mail to FILE"),
|
ARGPARSE_s_s (oOutput, "output", "|FILE|write the mail to FILE"),
|
||||||
|
|
||||||
|
ARGPARSE_s_s (oFakeSubmissionAddr, "fake-submission-addr", "@"),
|
||||||
|
|
||||||
ARGPARSE_end ()
|
ARGPARSE_end ()
|
||||||
};
|
};
|
||||||
@ -102,6 +104,11 @@ static struct debug_flags_s debug_flags [] =
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Value of the option --fake-submission-addr. */
|
||||||
|
const char *fake_submission_addr;
|
||||||
|
|
||||||
|
|
||||||
static void wrong_args (const char *text) GPGRT_ATTR_NORETURN;
|
static void wrong_args (const char *text) GPGRT_ATTR_NORETURN;
|
||||||
static gpg_error_t command_supported (char *userid);
|
static gpg_error_t command_supported (char *userid);
|
||||||
static gpg_error_t command_send (const char *fingerprint, char *userid);
|
static gpg_error_t command_send (const char *fingerprint, char *userid);
|
||||||
@ -180,6 +187,9 @@ parse_arguments (ARGPARSE_ARGS *pargs, ARGPARSE_OPTS *popts)
|
|||||||
case oOutput:
|
case oOutput:
|
||||||
opt.output = pargs->r.ret_str;
|
opt.output = pargs->r.ret_str;
|
||||||
break;
|
break;
|
||||||
|
case oFakeSubmissionAddr:
|
||||||
|
fake_submission_addr = pargs->r.ret_str;
|
||||||
|
break;
|
||||||
|
|
||||||
case aSupported:
|
case aSupported:
|
||||||
case aCreate:
|
case aCreate:
|
||||||
@ -551,30 +561,37 @@ command_send (const char *fingerprint, char *userid)
|
|||||||
goto leave;
|
goto leave;
|
||||||
|
|
||||||
/* Get the submission address. */
|
/* Get the submission address. */
|
||||||
err = wkd_get_submission_address (addrspec, &submission_to);
|
if (fake_submission_addr)
|
||||||
|
{
|
||||||
|
submission_to = xstrdup (fake_submission_addr);
|
||||||
|
err = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
err = wkd_get_submission_address (addrspec, &submission_to);
|
||||||
if (err)
|
if (err)
|
||||||
goto leave;
|
goto leave;
|
||||||
log_info ("submitting request to '%s'\n", submission_to);
|
log_info ("submitting request to '%s'\n", submission_to);
|
||||||
|
|
||||||
/* Get the policy flags. */
|
/* Get the policy flags. */
|
||||||
{
|
if (!fake_submission_addr)
|
||||||
estream_t mbuf;
|
{
|
||||||
|
estream_t mbuf;
|
||||||
|
|
||||||
err = wkd_get_policy_flags (addrspec, &mbuf);
|
err = wkd_get_policy_flags (addrspec, &mbuf);
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
log_error ("error reading policy flags for '%s': %s\n",
|
log_error ("error reading policy flags for '%s': %s\n",
|
||||||
submission_to, gpg_strerror (err));
|
submission_to, gpg_strerror (err));
|
||||||
goto leave;
|
|
||||||
}
|
|
||||||
if (mbuf)
|
|
||||||
{
|
|
||||||
err = wks_parse_policy (&policy, mbuf, 1);
|
|
||||||
es_fclose (mbuf);
|
|
||||||
if (err)
|
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
}
|
if (mbuf)
|
||||||
|
{
|
||||||
|
err = wks_parse_policy (&policy, mbuf, 1);
|
||||||
|
es_fclose (mbuf);
|
||||||
|
if (err)
|
||||||
|
goto leave;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (policy.auth_submit)
|
if (policy.auth_submit)
|
||||||
log_info ("no confirmation required for '%s'\n", addrspec);
|
log_info ("no confirmation required for '%s'\n", addrspec);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user