Merge pull request #86 from painless-security/jennifer/aaa_server_port
[trust_router.git] / common / tests / commtest.c
index 9c9c008..d2becc0 100644 (file)
@@ -5,7 +5,7 @@
 #include <tr_apc.h>
 #include <tr_comm.h>
 #include <tr_rp.h>
-#include <trust_router/tr_name.h>
+#include <tr_name_internal.h>
 
 /**********************************************************************/
 /* APC test stuff */
@@ -70,7 +70,7 @@ static int add_comm_set(TR_COMM_TABLE *ctab, struct comm_entry *entries)
   for (this=entries,ii=0; this->id!=NULL; this++, ii++) {
     new=comm_entry_to_comm(tmp_ctx, this);
     if (new==NULL) {
-      printf("Error creating community %d.\n", ii+1);
+      printf("Error creating community %u.\n", (unsigned int)ii+1);
       rc=1;
       goto cleanup;
     }
@@ -239,11 +239,9 @@ struct aaa_entry {
 static TR_AAA_SERVER *aaa_entry_to_aaa_server(TALLOC_CTX *mem_ctx, struct aaa_entry *ae)
 {
   TALLOC_CTX *tmp_ctx=talloc_new(NULL);
-  TR_AAA_SERVER *aaa=tr_aaa_server_new(tmp_ctx, tr_new_name(ae->hostname));
+  TR_AAA_SERVER *aaa=tr_aaa_server_from_string(tmp_ctx, ae->hostname);
 
-  if ((aaa==NULL) || (aaa->hostname==NULL))
-    aaa=NULL;
-  else
+  if (aaa)
     talloc_steal(mem_ctx, aaa);
 
   talloc_free(tmp_ctx); 
@@ -273,7 +271,7 @@ static TR_IDP_REALM *idp_realm_entry_to_idp_realm(TALLOC_CTX *mem_ctx, struct id
       realm=NULL; /* still in tmp_ctx so will be freed */
     else {
       tr_idp_realm_set_apcs(realm, apc_entry_to_apc(tmp_ctx, re->apcs));
-      if (tr_idp_realm_get_apcs==NULL)
+      if (tr_idp_realm_get_apcs(realm)==NULL)
         realm=NULL;
     }
   }
@@ -818,6 +816,7 @@ static int membership_test(void)
   assert(0==tr_comm_table_size(ctab));
 
   talloc_free(mem_ctx);
+  return 0;
 }