tr_req_handler: Handle non-defaulted case
authorSam Hartman <hartmans@debian.org>
Tue, 7 Oct 2014 09:57:51 +0000 (05:57 -0400)
committerSam Hartman <hartmans@debian.org>
Tue, 7 Oct 2014 10:58:37 +0000 (06:58 -0400)
In 1.4, we broke forwarding requests that were not defaulted.  We
looked up the community as a member of the community rather than the
realm.  Fix this logic error.

Also, update error messages to be more accurate and to fibx a spelling error.

tr/tr_main.c

index 659f899..8777354 100644 (file)
@@ -168,13 +168,13 @@ static int tr_tids_req_handler (TIDS_INSTANCE *tids,
       }
   } 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");
+    if (NULL == (tr_find_comm_idp(cfg_comm, fwd_req->realm))) {
+      fprintf(stderr, "tr_tids_req_handler: IDP Realm (%s) not member of community (%s).\n", orig_req->realm->buf, orig_req->comm->buf);
+      tids_send_err_response(tids, orig_req, "IDP community 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);
+    if ( cfg_apc && (NULL == (tr_find_comm_idp(cfg_apc, fwd_req->realm)))) {
+      fprintf(stderr, "tr_tids_req_handler: 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;
     }