.offset = offsetof(struct rpki_config, tal),
.doc = "Path to the TAL file or TALs directory",
.arg_doc = "<file>|<directory>",
+ .json_null_allowed = false,
}, {
.id = 'r',
.name = "local-repository",
.offset = offsetof(struct rpki_config, local_repository),
.doc = "Directory where the repository local cache will be stored/read",
.arg_doc = "<directory>",
+ .json_null_allowed = false,
}, {
.id = 2001,
.name = "shuffle-uris",
.type = >_string,
.offset = offsetof(struct rpki_config, slurm),
.doc = "Path to the SLURM file or SLURMs directory (files must have the extension .slurm)",
- .arg_doc = "<file>|<directory>"
+ .arg_doc = "<file>|<directory>",
+ .json_null_allowed = true,
}, {
.id = 1004,
.name = "mode",
.type = >_string,
.offset = offsetof(struct rpki_config, server.port),
.doc = "Default port to which RTR server addresses will bind itself to. Can be a string, in which case a number will be resolved. If all of the addresses have a port, this value isn't utilized.",
+ .json_null_allowed = false,
}, {
.id = 5002,
.name = "server.backlog",
.type = >_string,
.offset = offsetof(struct rpki_config, rsync.strategy),
.doc = "Deprecated; does nothing.",
+ .json_null_allowed = true,
.deprecated = true,
}, {
.id = 3003,
.doc = "Name of the program needed to execute an RSYNC",
.arg_doc = "<path to program>",
.availability = AVAILABILITY_JSON,
+ .json_null_allowed = false,
}, {
.id = 3006,
.name = "rsync.arguments-recursive",
.type = >_string,
.offset = offsetof(struct rpki_config, http.user_agent),
.doc = "User-Agent to use at HTTP requests, eg. Fort Validator Local/1.0",
+ .json_null_allowed = false,
}, {
.id = 9012,
.name = "http.max-redirs",
.offset = offsetof(struct rpki_config, http.ca_path),
.doc = "Directory where CA certificates are found, used to verify the peer",
.arg_doc = "<directory>",
+ .json_null_allowed = false,
},
/* Logging fields */
.offset = offsetof(struct rpki_config, log.tag),
.doc = "Text tag to identify operation logs",
.arg_doc = "<string>",
+ .json_null_allowed = true,
}, {
.id = 4004,
.name = "log.facility",
.offset = offsetof(struct rpki_config, validation_log.tag),
.doc = "Text tag to identify validation logs",
.arg_doc = "<string>",
+ .json_null_allowed = true,
}, {
.id = 4014,
.name = "validation-log.facility",
.offset = offsetof(struct rpki_config, output.roa),
.doc = "File where ROAs will be stored, use '-' to print at console",
.arg_doc = "<file>",
+ .json_null_allowed = true,
}, {
.id = 6001,
.name = "output.bgpsec",
.offset = offsetof(struct rpki_config, output.bgpsec),
.doc = "File where BGPsec Router Keys will be stored, use '-' to print at console",
.arg_doc = "<file>",
+ .json_null_allowed = true,
}, {
.id = 6002,
.name = "output.format",
string = NULL;
error = parse_json_string(json, opt->name, &string);
- return error ? error : string_parse_argv(opt, string, result);
+ if (error)
+ return error;
+
+ if (string == NULL) {
+ if (opt->json_null_allowed) {
+ DEREFERENCE(result) = NULL;
+ return 0;
+ } else {
+ if (string == NULL) {
+ return pr_op_err(
+ "The '%s' field is not allowed to be null.",
+ opt->name);
+ }
+ }
+ }
+
+ return string_parse_argv(opt, string, result);
}
static void
int
parse_json_string(json_t *json, char const *name, char const **result)
{
+ if (json_is_null(json)) {
+ *result = NULL;
+ return 0;
+ }
+
if (!json_is_string(json))
return pr_op_err("The '%s' element is not a JSON string.", name);