Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Domain/Selector/KeyFile no longer mandatory in verifying mode #159

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions openarc/openarc-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ struct configdef arcf_config[] =
{ "BaseDirectory", CONFIG_TYPE_STRING, FALSE },
{ "Canonicalization", CONFIG_TYPE_STRING, FALSE },
{ "ChangeRootDirectory", CONFIG_TYPE_STRING, FALSE },
{ "Domain", CONFIG_TYPE_STRING, TRUE },
{ "Domain", CONFIG_TYPE_STRING, FALSE },
{ "EnableCoredumps", CONFIG_TYPE_BOOLEAN, FALSE },
{ "FinalReceiver", CONFIG_TYPE_BOOLEAN, FALSE },
{ "FixedTimestamp", CONFIG_TYPE_STRING, FALSE },
{ "Include", CONFIG_TYPE_INCLUDE, FALSE },
{ "InternalHosts", CONFIG_TYPE_STRING, FALSE },
{ "KeepTemporaryFiles", CONFIG_TYPE_BOOLEAN, FALSE },
{ "KeyFile", CONFIG_TYPE_STRING, TRUE },
{ "KeyFile", CONFIG_TYPE_STRING, FALSE },
{ "MaximumHeaders", CONFIG_TYPE_INTEGER, FALSE },
{ "MilterDebug", CONFIG_TYPE_INTEGER, FALSE },
{ "Mode", CONFIG_TYPE_STRING, FALSE },
{ "PeerList", CONFIG_TYPE_STRING, FALSE },
{ "PidFile", CONFIG_TYPE_STRING, FALSE },
{ "Selector", CONFIG_TYPE_STRING, TRUE },
{ "Selector", CONFIG_TYPE_STRING, FALSE },
{ "SignatureAlgorithm", CONFIG_TYPE_STRING, FALSE },
{ "SignHeaders", CONFIG_TYPE_STRING, FALSE },
{ "OverSignHeaders", CONFIG_TYPE_STRING, FALSE },
Expand Down
40 changes: 24 additions & 16 deletions openarc/openarc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1469,17 +1469,32 @@ arcf_config_load(struct config *data, struct arcf_config *conf,
conf->conf_signalg = ARC_SIGN_RSASHA256;
}

(void) config_get(data, "Domain",
&conf->conf_domain,
sizeof conf->conf_domain);
if ((conf->conf_mode & ARC_MODE_SIGN))
{
if (config_get(data, "Domain",
&conf->conf_domain,
sizeof conf->conf_domain) < 1)
{
strlcpy(err, "parameter \"Domain\" required when signing", errlen);
return -1;
}

(void) config_get(data, "Selector",
&conf->conf_selector,
sizeof conf->conf_selector);
if (config_get(data, "Selector",
&conf->conf_selector,
sizeof conf->conf_selector) < 1)
{
strlcpy(err, "parameter \"Selector\" required when signing", errlen);
return -1;
}

(void) config_get(data, "KeyFile",
&conf->conf_keyfile,
sizeof conf->conf_keyfile);
if (config_get(data, "KeyFile",
&conf->conf_keyfile,
sizeof conf->conf_keyfile) < 1)
{
strlcpy(err, "parameter \"KeyFile\" required when signing", errlen);
return -1;
}
}

(void) config_get(data, "EnableCoredumps",
&conf->conf_enablecores,
Expand Down Expand Up @@ -4432,13 +4447,6 @@ main(int argc, char **argv)
return EX_CONFIG;
}

if (curconf->conf_selector == NULL || curconf->conf_domain == FALSE)
{
fprintf(stderr, "%s: selector and domain must be specified\n",
progname);
return EX_CONFIG;
}

/* suppress a bunch of things if we're in test mode */
if (testmode)
{
Expand Down