]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix other warnings
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 20 Feb 2021 23:48:25 +0000 (23:48 +0000)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 20 Feb 2021 23:48:25 +0000 (23:48 +0000)
src/lib/server/method.c
src/lib/tls/log.c
src/lib/tls/ocsp.c
src/lib/tls/session.c
src/lib/tls/validate.c
src/lib/util/dbuff.c
src/lib/util/dbuff_tests.c
src/lib/util/pair.c
src/lib/util/pair_legacy.c
src/lib/util/rbtree_tests.c

index 577212b0f1531b3b561941dfd590d98c4a859f5d..1626a34ff6341411694e8fc77640bca6ea1245a9 100644 (file)
@@ -36,7 +36,7 @@ fr_dict_autoload_t method_dict[] = {
        { NULL }
 };
 
-fr_dict_attr_t const *attr_module_method;
+static fr_dict_attr_t const *attr_module_method;
 
 extern fr_dict_attr_autoload_t module_method_attr[];
 fr_dict_attr_autoload_t module_method_attr[] = {
index fd83f04c04a4b3ad1e84aeede88c9f47ed592802..28b707498c310d548ada3243c5eb20c58e936fac 100644 (file)
@@ -254,6 +254,7 @@ static void _tls_ctx_print_cert_line(char const *file, int line,
        }
 }
 
+DIAG_OFF(used-but-marked-unused)       /* fix spurious warnings for sk macros */
 /** Print out the current stack of certs
  *
  * @param[in] file     File where this function is being called.
@@ -272,7 +273,7 @@ void _fr_tls_log_certificate_chain(char const *file, int line,
        }
        _tls_ctx_print_cert_line(file, line, request, i, cert);
 }
-
+DIAG_ON(used-but-marked-unused)
 
 /** Print errors raised by OpenSSL I/O functions
  *
index 51b76565cb614b20f5e5ad6b8984e554edb5d7b5..439cd5df6afa1a077e2c96ed264f49e8ca72c458 100644 (file)
@@ -57,6 +57,7 @@ typedef enum {
  */
 #define OCSP_MAX_VALIDITY_PERIOD (5 * 60)
 
+DIAG_OFF(used-but-marked-unused)       /* fix spurious warnings for sk macros */
 /** Extract components of OCSP responser URL from a certificate
  *
  * @param[in] cert to extract URL from.
@@ -90,6 +91,7 @@ static int ocsp_cert_url_parse(X509 *cert, char **host_out, char **port_out, cha
        }
        return found_uri ? -1 : 0;
 }
+DIAG_ON(used-but-marked-unused)
 
 /** Set the OCSP TLS stapling extension for a SSL session, from cached response data
  *
@@ -169,6 +171,7 @@ static int ocsp_staple_to_pair(fr_pair_t **out, request_t *request, OCSP_RESPONS
        return 0;
 }
 
+DIAG_OFF(used-but-marked-unused)       /* fix spurious warnings for sk macros */
 /** Callback used to get stapling data for the current server cert
  *
  * @param ssl  Current SSL session.
@@ -326,6 +329,7 @@ int fr_tls_ocsp_staple_cb(SSL *ssl, void *data)
        return ret;
 }
 
+DIAG_ON(used-but-marked-unused)
 /** Sends a OCSP request to a defined OCSP responder
  *
  */
index b8c74193475feee66622fc995917dd0828f235c5..f38e8c7828f1c4f29f2e0b26068566c33a44f044 100644 (file)
@@ -378,8 +378,8 @@ static bool session_psk_identity_is_safe(const char *identity)
  *     - >0 if a PSK matching identity was found (the length of bytes written to psk).
  */
 unsigned int fr_tls_session_psk_client_cb(SSL *ssl, UNUSED char const *hint,
-                                      char *identity, unsigned int max_identity_len,
-                                      unsigned char *psk, unsigned int max_psk_len)
+                                         char *identity, unsigned int max_identity_len,
+                                         unsigned char *psk, unsigned int max_psk_len)
 {
        unsigned int psk_len;
        fr_tls_conf_t *conf;
@@ -488,6 +488,7 @@ unsigned int fr_tls_session_psk_server_cb(SSL *ssl, const char *identity,
 }
 #endif /* PSK_MAX_IDENTITY_LEN */
 
+DIAG_OFF(used-but-marked-unused)       /* Fix spurious warnings for sk_ macros */
 /** Record session state changes
  *
  * Called by OpenSSL whenever the session state changes, an alert is received or an error occurs.
@@ -601,6 +602,7 @@ void fr_tls_session_info_cb(SSL const *ssl, int where, int ret)
                }
        }
 }
+DIAG_ON(used-but-marked-unused)
 
 /** Print a message to the request or global log detailing handshake state
  *
@@ -860,6 +862,7 @@ static inline fr_pair_t *fr_tls_session_cert_attr_add(TALLOC_CTX *ctx, request_t
        return vp;
 }
 
+DIAG_OFF(used-but-marked-unused)       /* fix spurious warnings for sk macros */
 /** Extract attributes from an X509 certificate
  *
  * @param pair_list    to copy attributes to.
@@ -872,7 +875,7 @@ static inline fr_pair_t *fr_tls_session_cert_attr_add(TALLOC_CTX *ctx, request_t
  *     - < 0 on failure.
  */
 int fr_tls_session_pairs_from_x509_cert(fr_pair_list_t *pair_list, TALLOC_CTX *ctx,
-                                    fr_tls_session_t *session, X509 *cert, int depth)
+                                       fr_tls_session_t *session, X509 *cert, int depth)
 {
        char            buffer[1024];
        char            attribute[256];
@@ -1105,6 +1108,7 @@ int fr_tls_session_pairs_from_x509_cert(fr_pair_list_t *pair_list, TALLOC_CTX *c
 
        return 0;
 }
+DIAG_ON(used-but-marked-unused)
 
 /** Decrypt application data
  *
index 5acb9cf466f5a80d447806f1a25aeff42f78644d..628de3931a3d78ad43bb6023e502a674c273dfd0 100644 (file)
@@ -39,6 +39,7 @@
 #include "base.h"
 #include "missing.h"
 
+DIAG_OFF(used-but-marked-unused)       /* fix spurious warnings for sk macros */
 /** Validates a certificate using custom logic
  *
  * Before trusting a certificate, we make sure that the certificate is
@@ -346,6 +347,7 @@ int fr_tls_validate_cert_cb(int ok, X509_STORE_CTX *x509_ctx)
        RDEBUG2("[verify client] = %s", my_ok ? "ok" : "invalid");
        return my_ok;
 }
+DIAG_ON(used-but-marked-unused)
 
 /** Revalidates the client's certificate chain
  *
index 6af875b048a19ef5e156ed5cf8a506415737868d..10fc46019910af54d33181e7b98d61e39e0597b9 100644 (file)
@@ -34,6 +34,7 @@ RCSID("$Id$")
 #  define CHECK_DBUFF_INIT(_sbuff)
 #endif
 
+DIAG_OFF(overlength-strings)   /* Seems broken */
 /** Internal macro for defining dbuff move functions
  * @private
  */
@@ -60,6 +61,7 @@ FR_DBUFF_MOVE_DEF(dbuff, dbuff)
 FR_DBUFF_MOVE_DEF(dbuff, dbuff_marker)
 FR_DBUFF_MOVE_DEF(dbuff_marker, dbuff)
 FR_DBUFF_MOVE_DEF(dbuff_marker, dbuff_marker)
+DIAG_ON(overlength-strings)
 
 static inline CC_HINT(always_inline) size_t min(size_t x, size_t y)
 {
index f988bee5c713e80df2401aa485b2602b9503849c..e5d86b5ad6e9d6860316505778397275ed3fc7f4 100644 (file)
@@ -492,12 +492,12 @@ static void test_dbuff_out(void)
        TEST_CHECK(fr_dbuff_in(&dbuff2, *(uint32_t *)&fval1) == 4);
        fr_dbuff_set_to_start(&dbuff2);
        TEST_CHECK(fr_dbuff_out(&fval2, &dbuff2) == 4);
-       TEST_CHECK(fval1 == fval2);
+       TEST_CHECK(memcmp(&fval1, &fval2, sizeof(fval1)) == 0);
        fr_dbuff_set_to_start(&dbuff2);
        TEST_CHECK(fr_dbuff_in(&dbuff2, *(uint64_t *)&dval1) == 8);
        fr_dbuff_set_to_start(&dbuff2);
        TEST_CHECK(fr_dbuff_out(&dval2, &dbuff2) == 8);
-       TEST_CHECK(dval1 == dval2);
+       TEST_CHECK(memcmp(&fval1, &fval2, sizeof(fval1)) == 0);
 
        TEST_CASE("Check variable length uint64_t read");
        fr_dbuff_set_to_start(&dbuff1);
index 4a14afc3073944a29bea1b4a0d9e6201bb836a4b..ccc26159f857f50ba2aad17d69923d2427121ac5 100644 (file)
@@ -33,15 +33,11 @@ RCSID("$Id$")
 
 #include <ctype.h>
 
-#ifndef NDEBUG
-#  define FREE_MAGIC (0xF4EEF4EE)
-#endif
-
 /** Initialise a pair list header
  *
  * @param[in,out] list to initialise
  */
-inline void fr_pair_list_init(fr_pair_list_t *list)
+void fr_pair_list_init(fr_pair_list_t *list)
 {
        fr_dlist_talloc_init(&list->head, fr_pair_t, entry);
 }
@@ -373,7 +369,7 @@ void fr_pair_steal(TALLOC_CTX *ctx, fr_pair_t *vp)
  *
  * @hidecallergraph
  */
-inline void fr_pair_list_free(fr_pair_list_t *list)
+void fr_pair_list_free(fr_pair_list_t *list)
 {
        fr_dlist_talloc_free(&list->head);
 }
@@ -385,7 +381,7 @@ inline void fr_pair_list_free(fr_pair_list_t *list)
  *
  * @hidecallergraph
  */
-inline bool fr_pair_list_empty(fr_pair_list_t const *list)
+bool fr_pair_list_empty(fr_pair_list_t const *list)
 {
        return fr_dlist_empty(&list->head);
 }
@@ -577,7 +573,7 @@ static inline CC_HINT(always_inline) fr_pair_list_t *pair_children(fr_pair_t *vp
  *     - NULL on error
  *     - pointer to head of the child list.
  */
-inline fr_pair_list_t *fr_pair_children(fr_pair_t *vp)
+fr_pair_list_t *fr_pair_children(fr_pair_t *vp)
 {
        return pair_children(vp);
 }
@@ -591,7 +587,7 @@ inline fr_pair_list_t *fr_pair_children(fr_pair_t *vp)
  *     - pointer to the first item in the list.
  * @hidecallergraph
  */
-inline void *fr_pair_list_head(fr_pair_list_t const *list)
+void *fr_pair_list_head(fr_pair_list_t const *list)
 {
        return fr_dlist_head(&list->head);
 }
@@ -605,7 +601,7 @@ inline void *fr_pair_list_head(fr_pair_list_t const *list)
  *     - pointer to the next item
  * @hidecallergraph
  */
-inline void *fr_pair_list_next(fr_pair_list_t const *list, fr_pair_t const *item)
+void *fr_pair_list_next(fr_pair_list_t const *list, fr_pair_t const *item)
 {
        return fr_dlist_next(&list->head, item);
 }
@@ -618,7 +614,7 @@ inline void *fr_pair_list_next(fr_pair_list_t const *list, fr_pair_t const *item
  *     - NULL if the head of the list has been reached
  *     - pointer to the previous item
  */
-inline void *fr_pair_list_prev(fr_pair_list_t const *list, fr_pair_t const *item)
+void *fr_pair_list_prev(fr_pair_list_t const *list, fr_pair_t const *item)
 {
        return fr_dlist_prev(&list->head, item);
 }
@@ -631,7 +627,7 @@ inline void *fr_pair_list_prev(fr_pair_list_t const *list, fr_pair_t const *item
  *     - NULL if the list is empty
  *     - pointer to the last item in the list.
  */
-inline void *fr_pair_list_tail(fr_pair_list_t const *list)
+void *fr_pair_list_tail(fr_pair_list_t const *list)
 {
        return fr_dlist_tail(&list->head);
 }
@@ -2526,7 +2522,7 @@ bool fr_pair_matches_da(void const *item, void const *uctx)
  *
  * @return number of entries in the list
  */
-inline size_t fr_pair_list_len(fr_pair_list_t const *list)
+size_t fr_pair_list_len(fr_pair_list_t const *list)
 {
        return list->head.num_elements;
 }
index 09fba5b3a6a691b6b9e73cc9b8d36fd510ac3f58..e3f20da3d7c580c6993a7e8935467b0172143879 100644 (file)
@@ -35,7 +35,7 @@ RCSID("$Id$")
 
 #include <ctype.h>
 
-fr_sbuff_term_t const          bareword_terminals =
+static fr_sbuff_term_t const   bareword_terminals =
                                FR_SBUFF_TERMS(
                                        L("\t"),
                                        L("\n"),
index 6c25645e4cbfb726b52cd00f8a7761dc057702c1..4b2f542a5230e69fdad35271ed0ffe8688132937 100644 (file)
@@ -173,8 +173,8 @@ static bool is_prime(uint32_t n)
        return true;
 }
 
-uint32_t       non_primes[] = { 1,  4,  6,  8,  9, 10, 12, 14, 15, 16, 18, 20, 21, 22, 24, 25, 26, 27, 28,
-                               30, 32, 33, 34, 35, 36, 38, 39, 40, 42, 44, 45, 46, 48, 49, 50};
+static uint32_t        non_primes[] = { 1,  4,  6,  8,  9, 10, 12, 14, 15, 16, 18, 20, 21, 22, 24, 25, 26, 27, 28,
+                                30, 32, 33, 34, 35, 36, 38, 39, 40, 42, 44, 45, 46, 48, 49, 50};
 
 static void test_rbtree_iter_delete(void)
 {