realm_json = json_object();
OBJECT_SET_OR_FAIL(realm_json, "realm",
tr_name_to_json_string(tr_realm_get_id(realm)));
- memb = tr_comm_table_find_idp_memb(ctable,
- tr_realm_get_id(realm),
- comm_name);
+ memb = tr_comm_table_find_memb(ctable,
+ tr_realm_get_id(realm),
+ comm_name);
+ if (memb == NULL) {
+ /* This should not happen - there must be a matching membership if we
+ * believed the realm was in the community in the first place! */
+ goto cleanup;
+ }
OBJECT_SET_OR_FAIL(realm_json, "sources",
tr_comm_memb_sources_to_json(memb));
json_array_append_new(jarray, realm_json);
*
* (options are optional)
*
- * Caller must free the return value with MON_REQ_free().
+ * Caller must free the return value with mon_req_free().
*
* @param mem_ctx talloc context for the returned struct
* @param req_json reference to JSON request object
cleanup:
talloc_free(tmp_ctx);
- if (req_json)
- json_decref(req_json);
return req;
}
/* If we have a payload, add it */
if (resp->payload) {
object_set_or_free_and_return(resp_json, jval, "payload", resp->payload);
+ json_incref(resp->payload); /* we just created a second reference to the payload */
}
return resp_json;
* { long-name, short-name, variable name, options, help description } */
static const struct argp_option cmdline_options[] = {
{ "config-dir", 'c', "DIR", 0, "Specify configuration file location (default is current directory)"},
- { "version", 'v', NULL, 0, "Print version information and exit"},
+ { "config-validate", 'C', NULL, 0, "Validate configuration files and exit"},
+ { "version", 1, NULL, 0, "Print version information and exit"},
{ NULL }
};
/* structure for communicating with option parser */
struct cmdline_args {
int version_requested;
+ int validate_config_and_exit;
char *config_dir;
};
arguments->config_dir=arg;
break;
- case 'v':
+ case 1:
arguments->version_requested=1;
break;
+ case 'C':
+ arguments->validate_config_and_exit=1;
+ break;
+
default:
return ARGP_ERR_UNKNOWN;
}
/***** parse command-line arguments *****/
/* set defaults */
opts.version_requested=0;
+ opts.validate_config_and_exit=0;
opts.config_dir=".";
/* parse the command line*/
return 1;
}
+ /***** Exit here if we are just validating our configuration *****/
+ if (opts.validate_config_and_exit) {
+ printf("Valid configuration found in %s.\n", opts.config_dir);
+ return 0;
+ }
/***** Set up the event loop *****/
ev_base=tr_event_loop_init(); /* Set up the event loop */
if (ev_base==NULL) {
/* We get here whether or not a filter matched. If tr_filter_apply() doesn't match, it returns
* a default action of reject, so we don't have to check why we exited the loop. */
if (oaction != TR_FILTER_ACTION_ACCEPT) {
- tr_notice("tr_tids_req_handler: Incoming TID request rejected by filter for GSS name", orig_req->rp_realm->buf);
+ tr_notice("tr_tids_req_handler: Incoming TID request rejected by RP client filter for GSS name %.*s",
+ tids->gss_name->len, tids->gss_name->buf);
tid_resp_set_err_msg(resp, tr_new_name("Incoming TID request filter error"));
retval = -1;
goto cleanup;