static int tr_tids_req_handler (TIDS_INSTANCE *tids,
TID_REQ *orig_req,
- TID_RESP **resp,
+ TID_RESP *resp,
void *tr)
{
TIDC_INSTANCE *tidc = NULL;
int oaction = TR_FILTER_ACTION_REJECT;
int rc = 0;
- if ((!tids) || (!orig_req) || (!resp) || (!(*resp)) || (!tr)) {
+ if ((!tids) || (!orig_req) || (!resp) || (!tr)) {
fprintf(stderr, "tids_req_handler: Bad parameters\n");
return -1;
}
tids_send_err_response(tids, orig_req, "RP Realm filter error");
return -1;
}
- /* Check that the rp_realm and target_realm are members of the community in the request */
+ /* Check that the rp_realm is a member of the community in the request */
if (NULL == (tr_find_comm_rp(cfg_comm, orig_req->rp_realm))) {
- fprintf(stderr, "tr_tids_req_hander: RP Realm (%s) not member of community (%s).\n", orig_req->rp_realm->buf, orig_req->comm->buf);
+ fprintf(stderr, "tr_tids_req_handler: RP Realm (%s) not member of community (%s).\n", orig_req->rp_realm->buf, orig_req->comm->buf);
tids_send_err_response(tids, orig_req, "RP COI membership error");
return -1;
}
- if (NULL == (tr_find_comm_idp(cfg_comm, orig_req->realm))) {
- fprintf(stderr, "tr_tids_req_hander: IDP Realm (%s) not member of APC (%s).\n", orig_req->realm->buf, orig_req->comm->buf);
- tids_send_err_response(tids, orig_req, "IDP COI membership error");
- return -1;
- }
/* Map the comm in the request from a COI to an APC, if needed */
if (TR_COMM_COI == cfg_comm->type) {
fwd_req->comm = apc;
fwd_req->orig_coi = orig_req->comm;
- /* Check that rp_realm and target_realm are members of this APC */
+ /* Check that rp_realm is a member of this APC */
if (NULL == (tr_find_comm_rp(cfg_apc, orig_req->rp_realm))) {
fprintf(stderr, "tr_tids_req_hander: RP Realm (%s) not member of community (%s).\n", orig_req->rp_realm->buf, orig_req->comm->buf);
tids_send_err_response(tids, orig_req, "RP APC membership error");
return -1;
}
- if (NULL == (tr_find_comm_idp(cfg_apc, orig_req->realm))) {
- fprintf(stderr, "tr_tids_req_hander: IDP Realm (%s) not member of APC (%s).\n", orig_req->realm->buf, orig_req->comm->buf);
- tids_send_err_response(tids, orig_req, "IDP APC membership error");
- return -1;
- }
}
/* Find the AAA server(s) for this request */
if (NULL == (aaa_servers = tr_idp_aaa_server_lookup((TR_INSTANCE *)tids->cookie,
orig_req->realm,
orig_req->comm))) {
- fprintf(stderr, "tr_tids_req_handler: No AAA Servers for realm %s.\n", orig_req->realm->buf);
+ fprintf(stderr, "tr_tids_req_handler: No AAA Servers for realm %s, defaulting.\n", orig_req->realm->buf);
+ if (NULL == (aaa_servers = tr_default_server_lookup ((TR_INSTANCE *)tids->cookie,
+ orig_req->comm))) {
+ fprintf(stderr, "tr_tids_req_handler: No default AAA servers, discarded.\n");
tids_send_err_response(tids, orig_req, "No path to AAA Server(s) for realm");
return -1;
+ }
+ } else {
+ /* if we aren't defaulting, check idp coi and apc membership */
+ if (NULL == (tr_find_comm_idp(cfg_comm, fwd_req->orig_coi))) {
+ fprintf(stderr, "tr_tids_req_hander: IDP Realm (%s) not member of APC (%s).\n", orig_req->realm->buf, orig_req->comm->buf);
+ tids_send_err_response(tids, orig_req, "IDP COI membership error");
+ return -1;
}
+ if (NULL == (tr_find_comm_idp(cfg_apc, fwd_req->comm))) {
+ fprintf(stderr, "tr_tids_req_hander: IDP Realm (%s) not member of APC (%s).\n", orig_req->realm->buf, orig_req->comm->buf);
+ tids_send_err_response(tids, orig_req, "IDP APC membership error");
+ return -1;
+ }
+ }
+
/* send a TID request to the AAA server(s), and get the answer(s) */
/* TBD -- Handle multiple servers */
{
TR_INSTANCE *tr = NULL;
struct dirent **cfg_files = NULL;
- json_t *jcfg = NULL;
TR_CFG_RC rc = TR_CFG_SUCCESS; /* presume success */
int err = 0, n = 0;;
exit(1);
}
- /* read and parse initial configuration */
- if (NULL == (jcfg = tr_read_config (n, cfg_files))) {
- fprintf (stderr, "Error reading or parsing configuration files, exiting.\n");
- exit(1);
- }
- if (TR_CFG_SUCCESS != tr_parse_config(tr, jcfg)) {
+ if (TR_CFG_SUCCESS != tr_parse_config(tr, n, cfg_files)) {
fprintf (stderr, "Error decoding configuration information, exiting.\n");
exit(1);
}