- /* Map the comm in the request from a COI to an APC, if needed */
- if (TR_COMM_COI == cfg_comm->type) {
- fprintf(stderr, "tr_tids_req_handler: Community was a COI, switching.\n");
- /* TBD -- In theory there can be more than one? How would that work? */
- if ((!cfg_comm->apcs) || (!cfg_comm->apcs->id)) {
- fprintf(stderr, "No valid APC for COI %s.\n", orig_req->comm->buf);
- tids_send_err_response(tids, orig_req, "No valid APC for community");
- 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))) {
- fprintf(stderr, "tr_tids_req_hander: Request for unknown comm: %s.\n", apc->buf);
- tids_send_err_response(tids, orig_req, "Unknown APC");
- return -1;
- }
-
- fwd_req->comm = apc;
- fwd_req->orig_coi = orig_req->comm;
-
- /* Check that rp_realm and target_realm are members 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;
- }