Use json_is_true() in place of json_boolean_value() for compatibility
[trust_router.git] / tr / tr_tid.c
index d9acd78..9d32edc 100644 (file)
@@ -179,8 +179,8 @@ static void *tr_tids_req_fwd_thread(void *arg)
 
   if (-1==(args->fwd_req->conn = tidc_open_connection(tidc, 
                                                       aaa_hostname,
-                                                      (unsigned int) aaa_port, /* we checked, it's > 0 */
-                                                     &(args->fwd_req->gssctx)))) {
+                                                      aaa_port,
+                                                      &(args->fwd_req->gssctx)))) {
     tr_notice("tr_tids_req_fwd_thread: Error in tidc_open_connection.");
     /* tids_send_err_response(tids, orig_req, "Can't open connection to next hop TIDS"); */
     /* TODO: encode reason for failure */
@@ -526,12 +526,19 @@ static int tr_tids_req_handler(TIDS_INSTANCE *tids,
                                              &idp_shared);
     } else {
       tr_debug("tr_tids_req_handler: route not local.");
-      aaa_servers = tr_aaa_server_from_name(tmp_ctx, trp_route_get_next_hop(route)); /* cleaned up via talloc */
+      aaa_servers = tr_aaa_server_new(tmp_ctx); /* cleaned up via talloc */
       if (aaa_servers == NULL) {
         tr_err("tr_tids_req_handler: error allocating next hop");
         retval=-1;
         goto cleanup;
       }
+      tr_aaa_server_set_hostname(aaa_servers, trp_route_dup_next_hop(route));
+      if (tr_aaa_server_get_hostname(aaa_servers) == NULL) {
+        tr_err("tr_tids_req_handler: error allocating next hop");
+        retval=-1;
+        goto cleanup;
+      }
+      tr_aaa_server_set_port(aaa_servers, trp_route_get_next_hop_port(route));
       idp_shared = 0;
     }