Updates to trust router handlers, added ipaddr cmd line option to tids.
authorMargaret Wasserman <margaret@moonshot-proxy.(none)>
Sun, 7 Apr 2013 23:23:03 +0000 (19:23 -0400)
committerMargaret Wasserman <margaret@moonshot-proxy.(none)>
Sun, 7 Apr 2013 23:23:03 +0000 (19:23 -0400)
README
include/tr_msg.h
include/trust_router/tid.h
tid/example/tids_main.c
tr/tr_main.c

diff --git a/README b/README
index 8a084e4..4e92fb5 100644 (file)
--- a/README
+++ b/README
@@ -19,7 +19,7 @@ IN PROGRESS - TR TID request & response handlers
 - Check idp_realm APC membership in TR 
 - Map a COI to an APC in TR (incl config & lookup code)
 IN PROGRESS - TIDS integration with freeradius server (Sam)
-IN PROGRESS - TIDC integration with freeradius proxy (incl default comm config)
+IN PROGRESS - TIDC integration with freeradius proxy (w/default comm config)
 - Handle per-request community configuration in AAA proxy
 - Resolve TBDs for error handling and memory deallocation
 
@@ -30,6 +30,7 @@ TO-DO FOR FULL PILOT VERSION (~2 months after beta release)
 - Keep single connection open between AAA proxy & TR for TID requests
 - Normalize/configure logging for info msgs, warnings and errors (log4c)
 - Clean-up gsscon API and messages
+- Figure out what to do about commented-out checks in gsscon_passive.c
 - Handle IPv6 addresses in TID req/resp (use getaddrinfo())
 - Implement rp_permitted filters (incl. general filtering mechanism)
 - Add constraints to TID req in TR, store and use them in AAA Server
index bfd0da7..dd99201 100644 (file)
@@ -36,7 +36,6 @@
 #define TR_MSG_H
 
 #include <jansson.h>
-#include <trust_router/tr_versioning.h>
 #include <trust_router/tid.h>
 
 enum msg_type {
index caf02e7..b76a469 100644 (file)
@@ -77,7 +77,7 @@ typedef void (TIDC_RESP_FUNC)(TIDC_INSTANCE *, TID_REQ *, TID_RESP *, void *);
 struct tid_req {
   struct tid_req *next_req;
   int conn;
-  gss_ctx_id_t *gssctx;
+  gss_ctx_id_t gssctx;
   int resp_rcvd;
   TR_NAME *rp_realm;
   TR_NAME *realm;
@@ -100,6 +100,7 @@ typedef int (TIDS_REQ_FUNC)(TIDS_INSTANCE *, TID_REQ *, TID_RESP **, void *);
 struct tids_instance {
   int req_count;
   char *priv_key;
+  char *ipaddr;
   TIDS_REQ_FUNC *req_handler;
   void *cookie;
 };
index 729189d..9a78ef3 100644 (file)
@@ -111,10 +111,7 @@ static int tids_req_handler (TIDS_INSTANCE * tids,
     return -1;
   }
 
-  /* Hard-code the IP Address in the response.  If this were a AAA server, we'd expect
-   * this to be set by the Trust Router before calling us. 
-   */
-  if (0 == inet_aton("127.0.0.1", &((*resp)->servers->aaa_server_addr))) {
+  if (0 == inet_aton(tids->ipaddr, &((*resp)->servers->aaa_server_addr))) {
     printf("tids_req_handler(): inet_aton() failed.\n");
     return -1;
   }
@@ -162,15 +159,24 @@ int main (int argc,
 {
   TIDS_INSTANCE *tids;
   int rc = 0;
+  char *ipaddr = NULL;
 
   /* Parse command-line arguments */ 
-  if (argc > 2)
-    printf("Unexpected arguments, ignored.\n");
+  if (argc > 3)
+    printf("Usage: %s [<ip-address> [<database-name>]]\n", argv[0]);
 
-  /*If we have a database, open and prepare*/
   if (argc >= 2) {
-    if (SQLITE_OK != sqlite3_open(argv[1], &db)) {
-      printf("Error opening database\n");
+    ipaddr = (char *)argv[1];
+  } else {
+    ipaddr = "127.0.0.1";
+  }
+
+  /* TBD -- check that input is a valid IP address? */
+
+  /*If we have a database, open and prepare*/
+  if (argc == 3) {
+    if (SQLITE_OK != sqlite3_open(argv[2], &db)) {
+      printf("Error opening database %s\n", argv[2]);
       exit(1);
     }
     sqlite3_prepare_v2(db, "insert into psk_keys (keyid, key) values(?, ?)",
@@ -183,6 +189,8 @@ int main (int argc,
     return 1;
   }
 
+  tids->ipaddr = ipaddr;
+
   /* Start-up the server, won't return unless there is an error. */
   rc = tids_start(tids, &tids_req_handler , NULL);
   
index 36f5a89..8d49f90 100644 (file)
@@ -55,7 +55,7 @@ static void tr_tidc_resp_handler (TIDC_INSTANCE *tidc,
   req->resp_rcvd = 1;
 
   /* TBD -- handle concatentation of multiple responses to single req */
-  tids_send_response(((TR_RESP_COOKIE *)resp_cookie)->tr->tids, ((TR_RESP_COOKIE *)resp_cookie)->orig_req->conn, ((TR_RESP_COOKIE *)resp_cookie)->orig_req->gssctx, resp);
+  tids_send_response(((TR_RESP_COOKIE *)resp_cookie)->tr->tids, ((TR_RESP_COOKIE *)resp_cookie)->orig_req->conn, &((TR_RESP_COOKIE *)resp_cookie)->orig_req->gssctx, resp);
   
   return;
 }