X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=tr%2Ftr_main.c;h=9de6ad0c64633c9711e90c932b01eb61bba15dc8;hb=9159c30c092c747c957b69a6b69a348501bb6b2a;hp=c39b7dc7f1fda83ebe16f0f53d15ee7c574c5011;hpb=1a04603d88385536e5de4034819dd04bb7f673e9;p=trust_router.git diff --git a/tr/tr_main.c b/tr/tr_main.c index c39b7dc..9de6ad0 100644 --- a/tr/tr_main.c +++ b/tr/tr_main.c @@ -68,7 +68,7 @@ static void tr_tidc_resp_handler (TIDC_INSTANCE *tidc, 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; @@ -81,7 +81,7 @@ static int tr_tids_req_handler (TIDS_INSTANCE *tids, 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; } @@ -169,10 +169,15 @@ static int tr_tids_req_handler (TIDS_INSTANCE *tids, 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; - } + } + } + /* send a TID request to the AAA server(s), and get the answer(s) */ /* TBD -- Handle multiple servers */ @@ -257,12 +262,7 @@ int main (int argc, const char *argv[]) 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, cfg_files)) { fprintf (stderr, "Error decoding configuration information, exiting.\n"); exit(1); }