return NULL;
}
- if (NULL == (comm = talloc(trc, TR_COMM))) {
- tr_debug("tr_cfg_parse_one_comm: Out of memory.");
+ if (NULL == (comm = talloc_zero(trc, TR_COMM))) {
- fprintf(stderr, "tr_cfg_parse_one_comm: Out of memory.\n");
++ tr_crit("tr_cfg_parse_one_comm: Out of memory.");
*rc = TR_CFG_NOMEM;
return NULL;
}
comm->rp_realms = tr_cfg_parse_comm_rps(trc, jrps, rc);
if (TR_CFG_SUCCESS != *rc) {
- fprintf(stderr, "tr_cfg_parse_comm: Can't parse RP realms for comm %s .\n", comm->id->buf);
+ tr_debug("tr_cfg_parse_comm: Can't parse RP realms for comm %s .", comm->id->buf);
tr_free_name(comm->id);
- /* TBD -- free idps? */;
return NULL;
}
{
json_t *jsrvr = NULL;
json_t *jstr = NULL;
+ gchar *time_str = g_time_val_to_iso8601(&srvr->key_expiration);
- fprintf(stderr, "Encoding one server.\n");
+ tr_debug("Encoding one server.");
jsrvr = json_object();
jstr = json_string(srvr->key_name->buf);
json_object_set_new(jsrvr, "key_name", jstr);
json_object_set_new(jsrvr, "server_dh", tr_msg_encode_dh(srvr->aaa_server_dh));
-
- // tr_debug("tr_msg_encode_one_server(): jsrvr contains:");
- // tr_debug("%s", json_dumps(jsrvr, 0));
+ if (srvr->path)
+ /* The path is owned by the srvr, so grab an extra ref*/
+ json_object_set(jsrvr, "path", srvr->path);
- // fprintf(stderr,"tr_msg_encode_one_server(): jsrvr contains:\n");
- // fprintf(stderr,"%s\n", json_dumps(jsrvr, 0));
return jsrvr;
}
return -1;
}
- if (NULL == (cfg_comm = tr_comm_lookup((TR_INSTANCE *)tids->cookie, orig_req->comm))) {
+ if (NULL == (cfg_comm = tr_comm_lookup(tids->cookie, orig_req->comm))) {
- fprintf(stderr, "tr_tids_req_hander: Request for unknown comm: %s.\n", orig_req->comm->buf);
+ tr_notice("tr_tids_req_hander: Request for unknown comm: %s.", orig_req->comm->buf);
tids_send_err_response(tids, orig_req, "Unknown community");
return -1;
}
/* Check that the rp_realm matches the filter for the GSS name that
* was received. */
- if ((!((TR_INSTANCE *)tr)->rp_gss) ||
- (!((TR_INSTANCE *)tr)->rp_gss->filter)) {
+ if ((!(tr)->rp_gss) ||
+ (!(tr)->rp_gss->filter)) {
- fprintf(stderr, "tr_tids_req_handler: No GSS name for incoming request.\n");
+ tr_notice("tr_tids_req_handler: No GSS name for incoming request.");
tids_send_err_response(tids, orig_req, "No GSS name for request");
return -1;
}
- if ((TR_FILTER_NO_MATCH == tr_filter_process_rp_permitted(orig_req->rp_realm, ((TR_INSTANCE *)tr)->rp_gss->filter, orig_req->cons, &fwd_req->cons, &oaction)) ||
+ if ((TR_FILTER_NO_MATCH == tr_filter_process_rp_permitted(orig_req->rp_realm, (tr)->rp_gss->filter, orig_req->cons, &fwd_req->cons, &oaction)) ||
(TR_FILTER_ACTION_REJECT == oaction)) {
- fprintf(stderr, "tr_tids_req_handler: RP realm (%s) does not match RP Realm filter for GSS name\n", orig_req->rp_realm->buf);
+ tr_notice("tr_tids_req_handler: RP realm (%s) does not match RP Realm filter for GSS name", orig_req->rp_realm->buf);
tids_send_err_response(tids, orig_req, "RP Realm filter error");
return -1;
}
apc = tr_dup_name(cfg_comm->apcs->id);
/* Check that the APC is configured */
- if (NULL == (cfg_apc = tr_comm_lookup((TR_INSTANCE *)tids->cookie, apc))) {
+ if (NULL == (cfg_apc = tr_comm_lookup(tids->cookie, apc))) {
- fprintf(stderr, "tr_tids_req_hander: Request for unknown comm: %s.\n", apc->buf);
+ tr_notice("tr_tids_req_hander: Request for unknown comm: %s.", apc->buf);
tids_send_err_response(tids, orig_req, "Unknown APC");
return -1;
}
/* send a TID request to the AAA server(s), and get the answer(s) */
/* TBD -- Handle multiple servers */
+ if (cfg_apc)
+ fwd_req->expiration_interval = cfg_apc->expiration_interval;
+ else fwd_req->expiration_interval = cfg_comm->expiration_interval;
/* Create a TID client instance */
if (NULL == (tidc = tidc_create())) {
- fprintf(stderr, "tr_tids_req_hander: Unable to allocate TIDC instance.\n");
+ tr_crit("tr_tids_req_hander: Unable to allocate TIDC instance.");
tids_send_err_response(tids, orig_req, "Memory allocation failure");
return -1;
}
}
static int tr_tids_gss_handler(gss_name_t client_name, TR_NAME *gss_name,
- void *tr)
+ void *tr_in)
{
TR_RP_CLIENT *rp;
+ TR_INSTANCE *tr = (TR_INSTANCE *) tr_in;
if ((!client_name) || (!gss_name) || (!tr)) {
- fprintf(stderr, "tr_tidc_gss_handler: Bad parameters.\n");
+ tr_debug("tr_tidc_gss_handler: Bad parameters.");
return -1;
}
/* Store the rp client in the TR_INSTANCE structure for now...
* TBD -- fix me for new tasking model. */
- ((TR_INSTANCE *)tr)->rp_gss = rp;
+ (tr)->rp_gss = rp;
- fprintf( stderr, "Client's GSS Name: %s\n", gss_name->buf);
+ tr_debug("Client's GSS Name: %s", gss_name->buf);
++
return 0;
}