Enable warnings; fix many of them
authorSam Hartman <hartmans@debian.org>
Wed, 20 Mar 2013 18:12:23 +0000 (14:12 -0400)
committerSam Hartman <hartmans@debian.org>
Wed, 20 Mar 2013 18:12:23 +0000 (14:12 -0400)
Makefile.am
common/tr_dh.c
common/tr_msg.c
include/tr_dh.h
include/trust_router/tid.h
tid/example/tidc_main.c
tid/example/tids_main.c
tid/tidc.c
tid/tids.c
tr/tr_main.c

index 82a136c..4e501b1 100644 (file)
@@ -1,5 +1,6 @@
 bin_PROGRAMS= tr/tr tid/example/tidc tid/example/tids common/dh_test/tr_dh_test
 AM_CPPFLAGS=-I$(srcdir)/include
+AM_CFLAGS = -Wall -Werror=missing-prototypes -Werror=strict-prototypes -Wno-parentheses
 SUBDIRS = gsscon 
 common_srcs = common/tr_name.c \
 common/tr_msg.c \
index a6b5867..ab3a7a4 100644 (file)
@@ -33,6 +33,7 @@
  */
 
 #include <openssl/dh.h>
+#include <tr_dh.h>
 
 unsigned char tr_2048_dhprime[2048/8] = {
   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
index b475c02..0554d5a 100644 (file)
@@ -98,7 +98,7 @@ static DH *tr_msg_decode_dh(json_t *jdh)
   return dh;
 }
 
-json_t *tr_msg_encode_tidreq(TID_REQ *req)
+static json_t * tr_msg_encode_tidreq(TID_REQ *req)
 {
   json_t *jreq = NULL;
   json_t *jstr = NULL;
@@ -122,7 +122,7 @@ json_t *tr_msg_encode_tidreq(TID_REQ *req)
   return jreq;
 }
 
-TID_REQ *tr_msg_decode_tidreq(json_t *jreq)
+static TID_REQ *tr_msg_decode_tidreq(json_t *jreq)
 {
   TID_REQ *treq = NULL;
   json_error_t rc;
@@ -169,7 +169,7 @@ TID_REQ *tr_msg_decode_tidreq(json_t *jreq)
   return treq;
 }
 
-json_t *tr_msg_encode_tidresp(TID_RESP *resp)
+static json_t * tr_msg_encode_tidresp(TID_RESP *resp)
 {
   json_t *jresp = NULL;
   json_t *jstr = NULL;
@@ -201,7 +201,7 @@ json_t *tr_msg_encode_tidresp(TID_RESP *resp)
   return jresp;
 }
 
-TID_RESP *tr_msg_decode_tidresp(json_t *jresp)
+static TID_RESP *tr_msg_decode_tidresp(json_t *jresp)
 {
   TID_RESP *tresp = NULL;
   json_error_t rc;
index ef3f0a9..b027e83 100644 (file)
@@ -41,6 +41,6 @@
 DH *tr_create_dh_params(char *key, size_t len);
 DH *tr_create_matching_dh(char *key, size_t len, DH *in_dh);
 void tr_destroy_dh_params(DH *dh);
-int tr_compute_dh_key(char *buf, size_t buflen, BIGNUM *pub_key, DH *priv_dh);
+int tr_compute_dh_key(unsigned char *buf, size_t buflen, BIGNUM *pub_key, DH *priv_dh);
 
 #endif
index a6e510a..2c37e18 100644 (file)
@@ -96,7 +96,7 @@ TR_EXPORT int tidc_open_connection (TIDC_INSTANCE *tidc, char *server, gss_ctx_i
 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 void tidc_destroy (TIDC_INSTANCE *tidc);
 
-TR_EXPORT TIDS_INSTANCE *tids_create ();
+TR_EXPORT TIDS_INSTANCE *tids_create (void);
 TR_EXPORT int tids_start (TIDS_INSTANCE *tids, TIDS_REQ_FUNC *req_handler, void *cookie);
 TR_EXPORT void tids_destroy (TIDS_INSTANCE *tids);
 
index e6c1579..b3da638 100644 (file)
 
 static int tidc_response_received = 0;
 
-void tidc_print_usage (const char *name)
+void static tidc_print_usage (const char *name)
 {
   printf("Usage: %s <server> <RP-realm> <target-realm> <community>\n", name);
 }
 
-void tidc_resp_handler (TIDC_INSTANCE * tidc, 
+static void tidc_resp_handler (TIDC_INSTANCE * tidc, 
                        TID_RESP *resp, 
                        void *cookie) 
 {
index b35f37a..26bb10e 100644 (file)
@@ -36,7 +36,7 @@
 
 #include <trust_router/tid.h>
 
-int tids_req_handler (TIDS_INSTANCE * tids,
+static int tids_req_handler (TIDS_INSTANCE * tids,
                      TID_REQ *req, 
                      TID_RESP *resp,
                      void *cookie)
index bb97ebd..4e94990 100644 (file)
@@ -162,7 +162,7 @@ int tidc_send_request (TIDC_INSTANCE *tidc,
     return -1;
   }
 
-  fprintf(stdout, "Response Received, %d bytes.\n", resp_buflen);
+  fprintf(stdout, "Response Received, %u bytes.\n", (unsigned) resp_buflen);
 
   /* Parse response -- TBD */
 
index 7ffac8c..f9d20b2 100644 (file)
@@ -104,7 +104,7 @@ static int tids_read_request (int conn, gss_ctx_id_t *gssctx, TID_REQ *req)
     return -1;
   }
 
-  fprintf(stdout, "Request Received, %d bytes.\n", buflen);
+  fprintf(stdout, "Request Received, %u bytes.\n", (unsigned) buflen);
 
   /* Parse request -- TBD */
 
@@ -203,7 +203,7 @@ static void tids_handle_connection (int conn)
   return;
 }
 
-TIDS_INSTANCE *tids_create ()
+TIDS_INSTANCE *tids_create (void)
 {
   TIDS_INSTANCE *tids = 0;
   if (tids = malloc(sizeof(TIDS_INSTANCE)))
index 8625383..90bfd13 100644 (file)
@@ -36,7 +36,7 @@
 
 #include <tr.h>
 
-int tids_req_handler (TIDS_INSTANCE * tids,
+int static tids_req_handler (TIDS_INSTANCE * tids,
                      TID_REQ *req, 
                      TID_RESP *resp,
                      void *cookie)