Remove Jansson dependence in tr_name.h
authorJennifer Richards <jennifer@painless-security.com>
Mon, 11 Sep 2017 21:45:35 +0000 (17:45 -0400)
committerJennifer Richards <jennifer@painless-security.com>
Mon, 11 Sep 2017 21:45:35 +0000 (17:45 -0400)
  * Move Jansson references out of tr_name.h into tr_name_internal.h
  * Move non-public API functions to tr_name_internal.h
  * Use tr_name_internal.h instead of tr_name.h except in public headers

20 files changed:
Makefile.am
common/tr_apc.c
common/tr_comm.c
common/tr_idp.c
common/tr_msg.c
common/tr_name.c
common/tr_rp.c
include/tr.h
include/tr_apc.h
include/tr_filter.h
include/tr_gss.h
include/tr_idp.h
include/tr_name_internal.h [new file with mode: 0644]
include/trp_ptable.h
include/trust_router/tr_name.h
trp/trp_ptable.c
trp/trp_req.c
trp/trp_rtable.c
trp/trp_upd.c
trp/trps.c

index 259faa3..de442b0 100644 (file)
@@ -179,7 +179,8 @@ noinst_HEADERS = include/gsscon.h include/tr_config.h \
        include/tid_internal.h include/trp_internal.h \
        include/tr_cfgwatch.h include/tr_event.h \
        include/tr_mq.h include/trp_ptable.h \
-       include/trp_rtable.h include/tr_util.h
+       include/trp_rtable.h include/tr_util.h \
+       include/tr_name_internal.h
 
 pkgdata_DATA=schema.sql
 nobase_dist_pkgdata_DATA=redhat/init redhat/sysconfig redhat/organizations.cfg redhat/tidc-wrapper redhat/trust_router-wrapper redhat/tr-test-internal.cfg redhat/default-internal.cfg redhat/tids-wrapper redhat/sysconfig.tids
index 9fa9294..8f590e8 100644 (file)
@@ -34,7 +34,7 @@
 
 #include <talloc.h>
 
-#include <trust_router/tr_name.h>
+#include <tr_name_internal.h>
 #include <tr_apc.h>
 #include <tr_debug.h>
 
index 4fb890c..6212b5d 100644 (file)
@@ -39,7 +39,7 @@
 
 #include <tr_rp.h>
 #include <tr_idp.h>
-#include <trust_router/tr_name.h>
+#include <tr_name_internal.h>
 #include <tr_comm.h>
 #include <tr_debug.h>
 
index fc91c62..984e6b5 100644 (file)
@@ -35,7 +35,7 @@
 #include <talloc.h>
 #include <time.h>
 
-#include <trust_router/tr_name.h>
+#include <tr_name_internal.h>
 #include <tr_idp.h>
 #include <tr_config.h>
 #include <tr_debug.h>
index 043fa97..59a2efd 100644 (file)
@@ -45,7 +45,7 @@
 #include <tr_apc.h>
 #include <tr_comm.h>
 #include <tr_msg.h>
-#include <trust_router/tr_name.h>
+#include <tr_name_internal.h>
 #include <trp_internal.h>
 #include <trust_router/tr_constraint.h>
 #include <trust_router/tr_dh.h>
index 83d1db0..84f0c1f 100644 (file)
@@ -36,7 +36,7 @@
 #include <string.h>
 #include <jansson.h>
 
-#include <trust_router/tr_name.h>
+#include <tr_name_internal.h>
 
 void tr_free_name (TR_NAME *name)
 {
index f54a5a5..495c77e 100644 (file)
@@ -35,7 +35,7 @@
 #include <talloc.h>
 
 #include <tr.h>
-#include <trust_router/tr_name.h>
+#include <tr_name_internal.h>
 #include <tr_gss.h>
 #include <tr_config.h>
 #include <tr_rp.h>
index bd55176..0c2b37d 100644 (file)
@@ -38,7 +38,6 @@
 #include <talloc.h>
 
 #include <tid_internal.h>
-#include <trust_router/tr_name.h>
 #include <tr_msg.h>
 #include <tr_rp.h>
 #include <tr_trp.h>
index 2919f86..0821477 100644 (file)
@@ -37,7 +37,7 @@
 
 #include <talloc.h>
 
-#include <trust_router/tr_name.h>
+#include <tr_name_internal.h>
 
 /* Used to hold lists of APC names in cfg. */
 typedef struct tr_apc {
index 63b23dd..a7704d7 100644 (file)
@@ -38,7 +38,7 @@
 #include <talloc.h>
 #include <jansson.h>
 
-#include <trust_router/tr_name.h>
+#include <tr_name_internal.h>
 #include <trust_router/tr_constraint.h>
 #include <trust_router/tid.h>
 #include <trust_router/trp.h>
index 575636d..676c8e4 100644 (file)
@@ -36,7 +36,7 @@
 #define __TR_GSS_H__
 
 #include <talloc.h>
-#include <trust_router/tr_name.h>
+#include <tr_name_internal.h>
 
 #define TR_MAX_GSS_NAMES 5
 
index dbcb472..951f7d7 100644 (file)
@@ -38,7 +38,7 @@
 #include <talloc.h>
 #include <time.h>
 
-#include <trust_router/tr_name.h>
+#include <tr_name_internal.h>
 #include <tr_apc.h>
 
 typedef struct tr_aaa_server {
diff --git a/include/tr_name_internal.h b/include/tr_name_internal.h
new file mode 100644 (file)
index 0000000..02c78f8
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2017, JANET(UK)
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of JANET(UK) nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+/** This is the internal version of the trust_router/tr_name.h header.
+ * That one is used for the public API provided by libtr-tid. Declarations
+ * that should not be included in the public API, dependencies on headers
+ * that are not needed for the API, etc., belong here. Anything needed
+ * in order to use the library should go in trust_router/tr_name.h.
+ */
+
+#ifndef TR_NAME_INTERNAL_H
+
+#include<trust_router/tr_name.h>
+#include <jansson.h>
+
+/** Prototypes */
+json_t *tr_name_to_json_string(TR_NAME *src);
+int tr_name_cmp_str(TR_NAME *one, const char *two_str);
+int tr_name_prefix_wildcard_match(TR_NAME *str, TR_NAME *wc_str);
+
+#define TR_NAME_INTERNAL_H
+
+#endif //TRUST_ROUTER_TR_NAME_INTERNAL_H
index 7171952..186f77a 100644 (file)
@@ -38,7 +38,7 @@
 #include <time.h>
 #include <talloc.h>
 
-#include <trust_router/tr_name.h>
+#include <tr_name_internal.h>
 #include <tr_gss.h>
 #include <trust_router/trp.h>
 #include <tr_filter.h>
index 1f392a8..052d291 100644 (file)
@@ -35,7 +35,6 @@
 #ifndef TR_NAME_H
 #define TR_NAME_H
 #include <string.h>
-#include <jansson.h>
 #include <trust_router/tr_versioning.h>
 
 typedef const char *tr_const_string;
@@ -49,11 +48,8 @@ TR_EXPORT TR_NAME *tr_new_name (const char *name);
 TR_EXPORT TR_NAME *tr_dup_name (TR_NAME *from);
 TR_EXPORT void tr_free_name (TR_NAME *name);
 TR_EXPORT int tr_name_cmp (TR_NAME *one, TR_NAME *two);
-int tr_name_cmp_str(TR_NAME *one, const char *two_str);
-int tr_name_prefix_wildcard_match(TR_NAME *str, TR_NAME *wc_str);
 TR_EXPORT void tr_name_strlcat(char *dest, const TR_NAME *src, size_t len);
 TR_EXPORT char *tr_name_strdup(TR_NAME *);
-TR_EXPORT json_t *tr_name_to_json_string(TR_NAME *src);
 TR_EXPORT TR_NAME *tr_name_cat(TR_NAME *n1, TR_NAME *n2);
 
 #endif
index b954584..e47846e 100644 (file)
@@ -35,7 +35,7 @@
 #include <time.h>
 #include <talloc.h>
 
-#include <trust_router/tr_name.h>
+#include <tr_name_internal.h>
 #include <trp_internal.h>
 #include <tr_gss.h>
 #include <trp_ptable.h>
index de3d297..be84310 100644 (file)
@@ -35,7 +35,7 @@
 #include <jansson.h>
 #include <talloc.h>
 
-#include <trust_router/tr_name.h>
+#include <tr_name_internal.h>
 #include <trp_internal.h>
 #include <tr_debug.h>
 
index ab693c5..e2ea5bb 100644 (file)
@@ -38,7 +38,7 @@
 #include <talloc.h>
 #include <time.h>
 
-#include <trust_router/tr_name.h>
+#include <tr_name_internal.h>
 #include <trp_internal.h>
 #include <trp_rtable.h>
 #include <tr_debug.h>
index 7079f22..e1057f1 100644 (file)
@@ -36,7 +36,7 @@
 #include <jansson.h>
 #include <talloc.h>
 
-#include <trust_router/tr_name.h>
+#include <tr_name_internal.h>
 #include <trp_internal.h>
 #include <tr_comm.h>
 #include <tr_apc.h>
index 9d217f2..94ff111 100644 (file)
@@ -44,7 +44,7 @@
 #include <tr_comm.h>
 #include <tr_apc.h>
 #include <tr_rp.h>
-#include <trust_router/tr_name.h>
+#include <tr_name_internal.h>
 #include <trp_internal.h>
 #include <tr_gss.h>
 #include <trp_ptable.h>