From 83bbfd900aa88e30e3bfa220cc7b13328debb72f Mon Sep 17 00:00:00 2001 From: Margaret Wasserman Date: Thu, 13 Mar 2014 09:13:32 -0400 Subject: [PATCH] Allow caller to set port number for tidc_open_connection(). Install include/trust_router/tr_constraints.h, so that freeradius will build with updated TID code. --- Makefile.am | 6 +++--- common/tr_config.c | 2 +- common/tr_constraint.c | 2 +- include/tr_filter.h | 2 +- include/trust_router/tid.h | 4 ++-- include/{ => trust_router}/tr_constraint.h | 0 tid/example/tidc_main.c | 2 +- tid/tidc.c | 3 ++- tr/manual.cfg | 1 - tr/tr_main.c | 1 + 10 files changed, 12 insertions(+), 11 deletions(-) rename include/{ => trust_router}/tr_constraint.h (100%) diff --git a/Makefile.am b/Makefile.am index e8233aa..927c218 100644 --- a/Makefile.am +++ b/Makefile.am @@ -40,14 +40,14 @@ libtr_tid_la_LDFLAGS = $(AM_LDFLAGS) -version-info 0 -no-undefined pkginclude_HEADERS = include/trust_router/tid.h include/trust_router/tr_name.h \ include/trust_router/tr_dh.h \ - include/trust_router/tr_versioning.h + include/trust_router/tr_constraint.h \ + include/trust_router/tr_versioning.h noinst_HEADERS = include/gsscon.h include/tr_config.h \ include/tr_msg.h include/tr.h \ include/tr_idp.h include/tr_rp.h \ include/tr_comm.h include/tr_apc.h \ - include/tr_filter.h \ - include/tr_constraint.h + include/tr_filter.h EXTRA_DIST = trust_router.spec diff --git a/common/tr_config.c b/common/tr_config.c index 64ba9ae..be851dc 100644 --- a/common/tr_config.c +++ b/common/tr_config.c @@ -40,7 +40,7 @@ #include #include #include -#include +#include void tr_print_config (FILE *stream, TR_CFG *cfg) { fprintf(stream, "tr_print_config: Not yet implemented.\n"); return; diff --git a/common/tr_constraint.c b/common/tr_constraint.c index c6360ce..aa3d4fc 100644 --- a/common/tr_constraint.c +++ b/common/tr_constraint.c @@ -34,7 +34,7 @@ #include #include -#include +#include TR_CONSTRAINT_SET *tr_constraint_set_from_fline (TR_FLINE *fline) { diff --git a/include/tr_filter.h b/include/tr_filter.h index 2e4b10b..b744c9b 100644 --- a/include/tr_filter.h +++ b/include/tr_filter.h @@ -36,7 +36,7 @@ #define TR_FILTER_H #include -#include +#include #include #define TR_MAX_FILTERS 5 diff --git a/include/trust_router/tid.h b/include/trust_router/tid.h index 76e2cdd..74281ca 100644 --- a/include/trust_router/tid.h +++ b/include/trust_router/tid.h @@ -40,7 +40,7 @@ #include #include -#include +#include #include @@ -158,7 +158,7 @@ void tid_resp_set_servers(TID_RESP *resp, TID_SRVR_BLK *servers); /* TID Client functions, in tid/tidc.c */ TR_EXPORT TIDC_INSTANCE *tidc_create (void); -TR_EXPORT int tidc_open_connection (TIDC_INSTANCE *tidc, char *server, gss_ctx_id_t *gssctx); +TR_EXPORT int tidc_open_connection (TIDC_INSTANCE *tidc, char *server, unsigned int port, gss_ctx_id_t *gssctx); TR_EXPORT int tidc_send_request (TIDC_INSTANCE *tidc, int conn, gss_ctx_id_t gssctx, char *rp_realm, char *realm, char *coi, TIDC_RESP_FUNC *resp_handler, void *cookie); TR_EXPORT int tidc_fwd_request (TIDC_INSTANCE *tidc, TID_REQ *req, TIDC_RESP_FUNC *resp_handler, void *cookie); TR_EXPORT void tidc_destroy (TIDC_INSTANCE *tidc); diff --git a/include/tr_constraint.h b/include/trust_router/tr_constraint.h similarity index 100% rename from include/tr_constraint.h rename to include/trust_router/tr_constraint.h diff --git a/tid/example/tidc_main.c b/tid/example/tidc_main.c index 480dde5..751a504 100644 --- a/tid/example/tidc_main.c +++ b/tid/example/tidc_main.c @@ -118,7 +118,7 @@ int main (int argc, } /* Set-up TID connection */ - if (-1 == (conn = tidc_open_connection(tidc, server, &gssctx))) { + if (-1 == (conn = tidc_open_connection(tidc, server, TID_PORT, &gssctx))) { /* Handle error */ printf("Error in tidc_open_connection.\n"); return 1; diff --git a/tid/tidc.c b/tid/tidc.c index 2e3f06c..f35854e 100644 --- a/tid/tidc.c +++ b/tid/tidc.c @@ -63,12 +63,13 @@ void tidc_destroy (TIDC_INSTANCE *tidc) int tidc_open_connection (TIDC_INSTANCE *tidc, char *server, + unsigned int port, gss_ctx_id_t *gssctx) { int err = 0; int conn = -1; - err = gsscon_connect(server, TID_PORT, "trustidentity", &conn, gssctx); + err = gsscon_connect(server, port, "trustidentity", &conn, gssctx); if (!err) return conn; diff --git a/tr/manual.cfg b/tr/manual.cfg index a1259ab..399878c 100644 --- a/tr/manual.cfg +++ b/tr/manual.cfg @@ -1,3 +1,2 @@ {"tr_internal":{"max_tree_depth": 4, - "tids_port": 12309, "hostname":"moonshot-proxy.local"}} \ No newline at end of file diff --git a/tr/tr_main.c b/tr/tr_main.c index d229e33..6830f6d 100644 --- a/tr/tr_main.c +++ b/tr/tr_main.c @@ -194,6 +194,7 @@ static int tr_tids_req_handler (TIDS_INSTANCE *tids, /* Set-up TID connection */ if (-1 == (fwd_req->conn = tidc_open_connection(tidc, aaa_servers->hostname->buf, + TID_PORT, &(fwd_req->gssctx)))) { fprintf(stderr, "tr_tids_req_handler: Error in tidc_open_connection.\n"); tids_send_err_response(tids, orig_req, "Can't open connection to next hop TIDS"); -- 2.1.4