From 9457e33636bbce2a6207aa39dcf56bda2747b0c3 Mon Sep 17 00:00:00 2001 From: Margaret Wasserman Date: Fri, 20 Dec 2013 11:43:36 -0500 Subject: [PATCH] Fix bugs found in testing new filtering code. --- common/tr_filter.c | 5 ++++- tid/tids.c | 2 +- tr/tr_main.c | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/common/tr_filter.c b/common/tr_filter.c index ae26c38..a05b0d9 100644 --- a/common/tr_filter.c +++ b/common/tr_filter.c @@ -83,7 +83,10 @@ int tr_filter_process_rp_permitted (TR_NAME *rp_realm, TR_FILTER *rpp_filter, TR /* Check if there is a match for this filter. */ for (i = 0; i < TR_MAX_FILTER_LINES; i++) { for (j = 0; j < TR_MAX_FILTER_SPECS; j++) { - if (tr_prefix_wildcard_match(rp_realm->buf, rpp_filter->lines[i]->specs[j]->match->buf)) { + + if ((rpp_filter->lines[i]) && + (rpp_filter->lines[i]->specs[j]) && + (tr_prefix_wildcard_match(rp_realm->buf, rpp_filter->lines[i]->specs[j]->match->buf))) { *out_action = rpp_filter->lines[i]->action; *out_constraints = rpp_filter->lines[i]->constraints; return TR_FILTER_MATCH; diff --git a/tid/tids.c b/tid/tids.c index b3767bf..b8cd576 100644 --- a/tid/tids.c +++ b/tid/tids.c @@ -373,7 +373,7 @@ int tids_start (TIDS_INSTANCE *tids, close(listen); tids_handle_connection(tids, conn); close(conn); - exit(0); + return 0; } else { close(conn); } diff --git a/tr/tr_main.c b/tr/tr_main.c index 7dc7cab..cba8042 100644 --- a/tr/tr_main.c +++ b/tr/tr_main.c @@ -118,6 +118,7 @@ static int tr_tids_req_handler (TIDS_INSTANCE *tids, (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); tids_send_err_response(tids, orig_req, "RP Realm filter error"); + return -1; } /* TBD -- add constraints to request for further forwarding. */ -- 2.1.4