From: Arran Cudbard-Bell Date: Thu, 11 Oct 2018 13:52:35 +0000 (-0400) Subject: s/load/onload due to conflicts with stdatomic.h *sigh* X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c0e5dbfdc80964c34e0fc226bc476a61d6dba332;p=thirdparty%2Ffreeradius-server.git s/load/onload due to conflicts with stdatomic.h *sigh* More header splitting --- diff --git a/src/bin/radiusd.c b/src/bin/radiusd.c index 0f9872bc104..6a5fa9c630c 100644 --- a/src/bin/radiusd.c +++ b/src/bin/radiusd.c @@ -29,15 +29,18 @@ */ RCSID("$Id$") -#include #include #include #include #include #include + #include + #include +#include + #include #include #include diff --git a/src/bin/radmin.c b/src/bin/radmin.c index d0b8a618c7c..7253010b4ca 100644 --- a/src/bin/radmin.c +++ b/src/bin/radmin.c @@ -25,10 +25,14 @@ */ RCSID("$Id$") -#include -#include #include +#include #include +#include + +#include +#include +#include #ifdef HAVE_LIBREADLINE diff --git a/src/bin/radwho.c b/src/bin/radwho.c index 70651ae20c5..6b7edcc72ff 100644 --- a/src/bin/radwho.c +++ b/src/bin/radwho.c @@ -29,6 +29,8 @@ RCSID("$Id$") #include #include +#include + #include #include #include diff --git a/src/bin/unit_test_module.c b/src/bin/unit_test_module.c index 14aa0924c9a..6a1a6308713 100644 --- a/src/bin/unit_test_module.c +++ b/src/bin/unit_test_module.c @@ -26,13 +26,20 @@ RCSID("$Id$") #include -#include -#include #include -#include +#include #include +#include + +#include +#include + +#include + #include +#include + #ifdef HAVE_GETOPT_H # include #endif diff --git a/src/lib/io/channel.h b/src/lib/io/channel.h index 7b104d92ced..e738a014da8 100644 --- a/src/lib/io/channel.h +++ b/src/lib/io/channel.h @@ -25,14 +25,6 @@ */ RCSIDH(channel_h, "$Id$") -#include -#include -#include -#include - -#include -#include - #ifdef __cplusplus extern "C" { #endif @@ -52,6 +44,22 @@ typedef struct fr_channel_t fr_channel_t; */ typedef struct fr_listen fr_listen_t; +#ifdef __cplusplus +} +#endif + +#include +#include +#include +#include + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + typedef enum fr_channel_event_t { FR_CHANNEL_ERROR = 0, FR_CHANNEL_DATA_READY_WORKER, diff --git a/src/lib/io/master.c b/src/lib/io/master.c index 2d1ea808412..b27729590b4 100644 --- a/src/lib/io/master.c +++ b/src/lib/io/master.c @@ -21,13 +21,17 @@ * * @copyright 2018 Alan DeKok (aland@freeradius.org) */ -#include #include +#include + +#include #include +#include + #include -#include + +#include #include -#include typedef struct fr_io_live_t { fr_event_list_t *el; //!< event list, for the master socket. diff --git a/src/lib/io/network.c b/src/lib/io/network.c index e47271b06d8..ae9ffee0089 100644 --- a/src/lib/io/network.c +++ b/src/lib/io/network.c @@ -27,13 +27,18 @@ RCSID("$Id$") #include #include +#include +#include #include -#include +#include + #include #include -#include -#include #include +#include +#include +#include +#include /* * Define our own debugging. @@ -52,14 +57,14 @@ RCSID("$Id$") fr_thread_local_setup(fr_ring_buffer_t *, fr_network_rb) /* macro */ -typedef struct fr_network_inject_t { +typedef struct { fr_listen_t *listen; uint8_t *packet; size_t packet_len; fr_time_t recv_time; } fr_network_inject_t; -typedef struct fr_network_worker_t { +typedef struct { int32_t heap_id; //!< workers are in a heap fr_time_t cpu_time; //!< how much CPU time this worker has spent fr_time_t predicted; //!< predicted processing time for one packet @@ -69,7 +74,7 @@ typedef struct fr_network_worker_t { fr_io_stats_t stats; } fr_network_worker_t; -typedef struct fr_network_socket_t { +typedef struct { fr_network_t *nr; //!< O(N) issues in talloc int number; //!< unique ID int heap_id; //!< for the sockets_by_num heap diff --git a/src/lib/io/network.h b/src/lib/io/network.h index a19af45fe96..4ca1b358095 100644 --- a/src/lib/io/network.h +++ b/src/lib/io/network.h @@ -25,14 +25,23 @@ */ RCSIDH(network_h, "$Id$") -#include - #ifdef __cplusplus extern "C" { #endif typedef struct fr_network_t fr_network_t; +#ifdef __cplusplus +} +#endif + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + fr_network_t *fr_network_create(TALLOC_CTX *ctx, fr_event_list_t *el, fr_log_t const *logger, fr_log_lvl_t lvl) CC_HINT(nonnull(2,3)); void fr_network_exit(fr_network_t *nr) CC_HINT(nonnull); int fr_network_destroy(fr_network_t *nr) CC_HINT(nonnull); diff --git a/src/lib/io/ring_buffer.h b/src/lib/io/ring_buffer.h index b22b1371816..f59a3a5eb44 100644 --- a/src/lib/io/ring_buffer.h +++ b/src/lib/io/ring_buffer.h @@ -36,23 +36,26 @@ extern "C" { typedef struct fr_ring_buffer_t fr_ring_buffer_t; -fr_ring_buffer_t *fr_ring_buffer_create(TALLOC_CTX *ctx, size_t size); +fr_ring_buffer_t *fr_ring_buffer_create(TALLOC_CTX *ctx, size_t size); -uint8_t *fr_ring_buffer_reserve(fr_ring_buffer_t *rb, size_t size) CC_HINT(nonnull); -uint8_t *fr_ring_buffer_alloc(fr_ring_buffer_t *rb, size_t size); -uint8_t *fr_ring_buffer_reserve_split(fr_ring_buffer_t *dst, size_t reserve_size, - fr_ring_buffer_t *src, size_t move_size) CC_HINT(nonnull); +uint8_t *fr_ring_buffer_reserve(fr_ring_buffer_t *rb, size_t size) CC_HINT(nonnull); -int fr_ring_buffer_start(fr_ring_buffer_t *dst, uint8_t **p_start, size_t *p_size); +uint8_t *fr_ring_buffer_alloc(fr_ring_buffer_t *rb, size_t size); -int fr_ring_buffer_free(fr_ring_buffer_t *rb, size_t size) CC_HINT(nonnull); +uint8_t *fr_ring_buffer_reserve_split(fr_ring_buffer_t *dst, size_t reserve_size, + fr_ring_buffer_t *src, size_t move_size) CC_HINT(nonnull); -int fr_ring_buffer_close(fr_ring_buffer_t *rb) CC_HINT(nonnull); +int fr_ring_buffer_start(fr_ring_buffer_t *dst, uint8_t **p_start, size_t *p_size); -size_t fr_ring_buffer_size(fr_ring_buffer_t *rb) CC_HINT(nonnull); -size_t fr_ring_buffer_used(fr_ring_buffer_t *rb) CC_HINT(nonnull); +int fr_ring_buffer_free(fr_ring_buffer_t *rb, size_t size) CC_HINT(nonnull); -void fr_ring_buffer_debug(fr_ring_buffer_t *rb, FILE *fp) CC_HINT(nonnull); +int fr_ring_buffer_close(fr_ring_buffer_t *rb) CC_HINT(nonnull); + +size_t fr_ring_buffer_size(fr_ring_buffer_t *rb) CC_HINT(nonnull); + +size_t fr_ring_buffer_used(fr_ring_buffer_t *rb) CC_HINT(nonnull); + +void fr_ring_buffer_debug(fr_ring_buffer_t *rb, FILE *fp) CC_HINT(nonnull); #ifdef __cplusplus } diff --git a/src/lib/io/schedule.h b/src/lib/io/schedule.h index fe9da4a6b1f..0e14f7ca2e2 100644 --- a/src/lib/io/schedule.h +++ b/src/lib/io/schedule.h @@ -25,16 +25,24 @@ */ RCSIDH(schedule_h, "$Id$") -#include -#include -#include - #ifdef __cplusplus extern "C" { #endif typedef struct fr_schedule_t fr_schedule_t; +#ifdef __cplusplus +} +#endif + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif /** Setup a new thread * * @param[in] ctx to allocate any thread specific memory in. diff --git a/src/lib/io/worker.h b/src/lib/io/worker.h index a7ee3a45ed1..1edc30b3154 100644 --- a/src/lib/io/worker.h +++ b/src/lib/io/worker.h @@ -25,14 +25,6 @@ */ RCSIDH(worker_h, "$Id$") -#include - -#include -#include -#include -#include - -#include #ifdef __cplusplus extern "C" { @@ -45,18 +37,44 @@ extern "C" { */ typedef struct fr_worker_t fr_worker_t; -fr_worker_t *fr_worker_create(TALLOC_CTX *ctx, char const *name, fr_event_list_t *el, fr_log_t const *logger, fr_log_lvl_t lvl) CC_HINT(nonnull(2,3,4)); -void fr_worker_destroy(fr_worker_t *worker) CC_HINT(nonnull); -int fr_worker_kq(fr_worker_t *worker) CC_HINT(nonnull); -fr_event_list_t *fr_worker_el(fr_worker_t *worker) CC_HINT(nonnull); -void fr_worker(fr_worker_t *worker) CC_HINT(nonnull); -void fr_worker_exit(fr_worker_t *worker) CC_HINT(nonnull); -void fr_worker_debug(fr_worker_t *worker, FILE *fp) CC_HINT(nonnull); -void fr_worker_name(fr_worker_t *worker, char const *name) CC_HINT(nonnull); -fr_channel_t *fr_worker_channel_create(fr_worker_t *worker, TALLOC_CTX *ctx, fr_control_t *master) CC_HINT(nonnull); -int fr_worker_stats(fr_worker_t const *worker, int num, uint64_t *stats) CC_HINT(nonnull); +#ifdef __cplusplus +} +#endif + +#include +#include +#include +#include +#include + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif extern fr_cmd_table_t cmd_worker_table[]; +fr_worker_t *fr_worker_create(TALLOC_CTX *ctx, char const *name, fr_event_list_t *el, + fr_log_t const *logger, fr_log_lvl_t lvl) CC_HINT(nonnull(2,3,4)); + +void fr_worker_destroy(fr_worker_t *worker) CC_HINT(nonnull); + +int fr_worker_kq(fr_worker_t *worker) CC_HINT(nonnull); + +fr_event_list_t *fr_worker_el(fr_worker_t *worker) CC_HINT(nonnull); + +void fr_worker(fr_worker_t *worker) CC_HINT(nonnull); + +void fr_worker_exit(fr_worker_t *worker) CC_HINT(nonnull); + +void fr_worker_debug(fr_worker_t *worker, FILE *fp) CC_HINT(nonnull); + +void fr_worker_name(fr_worker_t *worker, char const *name) CC_HINT(nonnull); + +fr_channel_t *fr_worker_channel_create(fr_worker_t *worker, TALLOC_CTX *ctx, fr_control_t *master) CC_HINT(nonnull); + +int fr_worker_stats(fr_worker_t const *worker, int num, uint64_t *stats) CC_HINT(nonnull); #ifdef __cplusplus } #endif diff --git a/src/lib/redis/cluster.c b/src/lib/redis/cluster.c index 12a1e157bdf..79d319752c4 100644 --- a/src/lib/redis/cluster.c +++ b/src/lib/redis/cluster.c @@ -145,11 +145,17 @@ * after some time. This time is configurable. * */ + +#include +#include + +#include +#include +#include + #include "base.h" #include "cluster.h" #include "crc16.h" -#include -#include #define KEY_SLOTS 16384 //!< Maximum number of keyslots (should not change). diff --git a/src/lib/server/auth.c b/src/lib/server/auth.c index 096312ca6b5..55faf564f3a 100644 --- a/src/lib/server/auth.c +++ b/src/lib/server/auth.c @@ -28,8 +28,15 @@ RCSID("$Id$") #include #include -#include #include +#include +#include + +#include + +#include + +#include #include @@ -218,7 +225,7 @@ rlm_rcode_t rad_postauth(REQUEST *request) * The return value of this function isn't actually used right now, so * it's not entirely clear if it is returning the right things. --Pac. */ -rlm_rcode_t rad_authenticate(REQUEST *request) +static rlm_rcode_t rad_authenticate(REQUEST *request) { VALUE_PAIR *tmp = NULL; int result; diff --git a/src/lib/server/auth.h b/src/lib/server/auth.h new file mode 100644 index 00000000000..9267fcda528 --- /dev/null +++ b/src/lib/server/auth.h @@ -0,0 +1,39 @@ +#pragma once +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/** + * $Id$ + * + * @file lib/server/auth.h + * @brief Legacy state machine + * + */ +RCSIDH(auth_h, "$Id$") + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +rlm_rcode_t rad_postauth(REQUEST *); +rlm_rcode_t rad_virtual_server(REQUEST *); + +#ifdef __cplusplus +} +#endif diff --git a/src/lib/server/base.h b/src/lib/server/base.h index 82a3fae1096..5b6471cb459 100644 --- a/src/lib/server/base.h +++ b/src/lib/server/base.h @@ -21,179 +21,53 @@ * @file lib/server/base.h * @brief Structures, prototypes and global variables for the FreeRADIUS server. * - * @copyright 1999-2000,2002-2008 The FreeRADIUS server project + * @copyright 1999-2018 The FreeRADIUS server project */ -RCSIDH(radiusd_h, "$Id$") +RCSIDH(base_h, "$Id$") +#include +#include #include +#include +#include #include +#include +#include +#include +#include +#include #include +#include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include #include +#include +#include +#include #include +#include +#include #include #include #include +#include #include -#include -#include - -#include - -/* - * Let any external program building against the library know what - * features the library was built with. - */ -#include - -/* - * All POSIX systems should have these headers - */ -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - +#include #ifdef WITH_TCP # include #endif +#include +#include +#include +#include +#include -/* - * See util.c - */ -#define EXEC_TIMEOUT 10 - -/* - * Global variables. - * - * We really shouldn't have this many. - */ -extern fr_log_lvl_t rad_debug_lvl; -extern fr_log_lvl_t req_debug_lvl; -extern char const *radiusd_version; -extern char const *radiusd_version_short; - - - -/* - * Function prototypes. - */ - - -/* radiusd.c */ -int log_err (char *); - -/* auth.c */ -rlm_rcode_t rad_authenticate (REQUEST *); -rlm_rcode_t rad_postauth(REQUEST *); -rlm_rcode_t rad_virtual_server(REQUEST *); - -/* exec.c */ -extern pid_t (*rad_fork)(void); -extern pid_t (*rad_waitpid)(pid_t pid, int *status); - -pid_t radius_start_program(char const *cmd, REQUEST *request, bool exec_wait, - int *input_fd, int *output_fd, - VALUE_PAIR *input_pairs, bool shell_escape); -int radius_readfrom_program(int fd, pid_t pid, int timeout, - char *answer, int left); -int radius_exec_program(TALLOC_CTX *ctx, char *out, size_t outlen, VALUE_PAIR **output_pairs, - REQUEST *request, char const *cmd, VALUE_PAIR *input_pairs, - bool exec_wait, bool shell_escape, int timeout) CC_HINT(nonnull (5, 6)); - -/** Allocate a VALUE_PAIR in the request list - * - * @param[in] _attr allocated. - * @param[in] _da #fr_dict_attr_t of the pair to be found or allocated. - * @return - * - 0 on success. - * - -1 on failure. - */ -#define pair_add_request(_attr, _da) fr_pair_add_by_da(request->packet, _attr, &request->packet->vps, _da) - -/** Allocate a VALUE_PAIR in the reply list - * - * @param[in] _attr allocated. - * @param[in] _da #fr_dict_attr_t of the pair to be found or allocated. - * @return - * - 0 on success. - * - -1 on failure. - */ -#define pair_add_reply(_attr, _da) fr_pair_add_by_da(request->reply, _attr, &request->reply->vps, _da) - -/** Allocate a VALUE_PAIR in the control list - * - * @param[in] _attr allocated. - * @param[in] _da #fr_dict_attr_t of the pair to be found or allocated. - * @return - * - 0 on success. - * - -1 on failure. - */ -#define pair_add_control(_attr, _da) fr_pair_add_by_da(request, _attr, &request->control, _da) - -/** Return or allocate a VALUE_PAIR in the request list - * - * @param[in] _attr allocated or found. - * @param[in] _da #fr_dict_attr_t of the pair to be found or allocated. - * @return - * - 1 if attribute already existed. - * - 0 if we allocated a new attribute. - * - -1 on failure. - */ -#define pair_update_request(_attr, _da) fr_pair_update_by_da(request->packet, _attr, &request->packet->vps, _da) - -/** Return or allocate a VALUE_PAIR in the reply list - * - * @param[in] _attr allocated or found. - * @param[in] _da #fr_dict_attr_t of the pair to be found or allocated. - * @return - * - 1 if attribute already existed. - * - 0 if we allocated a new attribute. - * - -1 on failure. - */ -#define pair_update_reply(_attr, _da) fr_pair_update_by_da(request->reply, _attr, &request->reply->vps, _da) - -/** Return or allocate a VALUE_PAIR in the control list - * - * @param[in] _attr allocated or found. - * @param[in] _da #fr_dict_attr_t of the pair to be found or allocated. - * @return - * - 1 if attribute already existed. - * - 0 if we allocated a new attribute. - * - -1 on failure. - */ -#define pair_update_control(_attr, _da) fr_pair_update_by_da(request, _attr, &request->control, _da) - -/** Return or allocate a VALUE_PAIR in the request list - * - * @param[in] _da #fr_dict_attr_t of the pair(s) to be deleted. - * @return - * - >0 the number of pairs deleted. - * - 0 if no pairs were deleted. - */ -#define pair_delete_request(_da) fr_pair_delete_by_da(&request->packet->vps, _da) - -/** Return or allocate a VALUE_PAIR in the reply list - * - * @param[in] _da #fr_dict_attr_t of the pair(s) to be deleted. - * @return - * - >0 the number of pairs deleted. - * - 0 if no pairs were deleted. - */ -#define pair_delete_reply(_da) fr_pair_delete_by_da(&request->reply->vps, _da) - -/** Return or allocate a VALUE_PAIR in the control list - * - * @param[in] _da #fr_dict_attr_t of the pair(s) to be deleted. - * @return - * - >0 the number of pairs deleted. - * - 0 if no pairs were deleted. - */ -#define pair_delete_control(_da) fr_pair_delete_by_da(&request->control, _da) - - -#ifdef __cplusplus -} -#endif +#include diff --git a/src/lib/server/cf_file.c b/src/lib/server/cf_file.c index 51e00383dbd..dd0d55c41ff 100644 --- a/src/lib/server/cf_file.c +++ b/src/lib/server/cf_file.c @@ -34,7 +34,10 @@ RCSID("$Id$") #include #include #include +#include + #include +#include #include "cf_priv.h" diff --git a/src/lib/server/cf_file.h b/src/lib/server/cf_file.h index 27cd4c1de09..0f246878332 100644 --- a/src/lib/server/cf_file.h +++ b/src/lib/server/cf_file.h @@ -29,8 +29,11 @@ RCSIDH(cf_file_h, "$Id$") #include #include + #include +#include #include +#include #ifdef __cplusplus extern "C" { diff --git a/src/lib/server/cf_parse.c b/src/lib/server/cf_parse.c index d0d479ca573..62eb0ae538a 100644 --- a/src/lib/server/cf_parse.c +++ b/src/lib/server/cf_parse.c @@ -33,7 +33,9 @@ RCSID("$Id$") #include #include #include + #include +#include #include #include "cf_priv.h" diff --git a/src/lib/server/cf_util.c b/src/lib/server/cf_util.c index 08c9c85d87c..09f02b814c5 100644 --- a/src/lib/server/cf_util.c +++ b/src/lib/server/cf_util.c @@ -26,6 +26,7 @@ RCSID("$Id$") #include #include +#include #include #include #include diff --git a/src/lib/server/client.c b/src/lib/server/client.c index 555aa74dabd..b1600b640fe 100644 --- a/src/lib/server/client.c +++ b/src/lib/server/client.c @@ -26,14 +26,18 @@ */ RCSID("$Id$") -#include -#include -#include - #include #include #include + #include +#include + +#include + +#include +#include +#include //#define WITH_TRIE (1) diff --git a/src/lib/server/command.c b/src/lib/server/command.c index 43ad3508ad8..0d4d52418c0 100644 --- a/src/lib/server/command.c +++ b/src/lib/server/command.c @@ -29,6 +29,8 @@ RCSID("$Id$") #include #include +#include + /* * Registration hooks for radmin. */ diff --git a/src/lib/server/cond_tokenize.c b/src/lib/server/cond_tokenize.c index 3ed2d843439..072772035d4 100644 --- a/src/lib/server/cond_tokenize.c +++ b/src/lib/server/cond_tokenize.c @@ -29,6 +29,8 @@ RCSID("$Id$") #include #include +#include + #include diff --git a/src/lib/server/connection.c b/src/lib/server/connection.c index d21ca899c63..6e695c7f28a 100644 --- a/src/lib/server/connection.c +++ b/src/lib/server/connection.c @@ -28,6 +28,8 @@ #include #include #include +#include + #include #include diff --git a/src/lib/server/connection.h b/src/lib/server/connection.h index 381fe457c3b..42980737c23 100644 --- a/src/lib/server/connection.h +++ b/src/lib/server/connection.h @@ -22,7 +22,7 @@ * * @copyright 2017 Arran Cudbard-Bell (a.cudbardb@freeradius.org) */ -RCSIDH(cond_eval_h, "$Id$") +RCSIDH(connection_h, "$Id$") #ifdef __cplusplus extern "C" { diff --git a/src/lib/server/dependency.h b/src/lib/server/dependency.h index 6cd8a2b4eb3..21dcf7dbb5c 100644 --- a/src/lib/server/dependency.h +++ b/src/lib/server/dependency.h @@ -25,9 +25,17 @@ */ RCSIDH(dependency_h, "$Id$") -#include +#ifdef __cplusplus +extern "C" { +#endif + +extern char const *radiusd_version; +extern char const *radiusd_version_short; + #include +#include + int rad_check_lib_magic(uint64_t magic); int ssl_check_consistency(void); char const *ssl_version_by_num(uint32_t version); @@ -39,3 +47,7 @@ int dependency_version_number_add(CONF_SECTION *cs, char const *name, char cons void dependency_features_init(CONF_SECTION *cs); void dependency_version_numbers_init(CONF_SECTION *cs); void dependency_version_print(void); + +#ifdef __cplusplus +} +#endif diff --git a/src/lib/server/dl.c b/src/lib/server/dl.c index 1dd464a93ae..af5cb1a084a 100644 --- a/src/lib/server/dl.c +++ b/src/lib/server/dl.c @@ -25,12 +25,15 @@ */ RCSID("$Id$") -#include -#include #include -#include +#include #include -#include + +#include +#include + +#include +#include #ifdef HAVE_VALGRIND_H # include @@ -192,7 +195,7 @@ static int dl_handle_cmp(void const *one, void const *two) */ static int dl_load_func(dl_t const *dl_module, UNUSED void *symbol, UNUSED void *ctx) { - if (dl_module->common->load && (dl_module->common->load() < 0)) { + if (dl_module->common->onload && (dl_module->common->onload() < 0)) { ERROR("Initialisation failed for module \"%s\"", dl_module->common->name); return -1; } diff --git a/src/lib/server/dl.h b/src/lib/server/dl.h index 496e2eea8cb..71a4bac6b3b 100644 --- a/src/lib/server/dl.h +++ b/src/lib/server/dl.h @@ -65,7 +65,7 @@ typedef struct dl_module dl_t; * - 0 on success. * - -1 if initialisation failed. */ -typedef int (*module_load_t)(void); +typedef int (*module_onload_t)(void); /** Called when the module is about to be unloaded (all instances destroyed) * @@ -120,7 +120,7 @@ typedef void (*dl_free_t)(dl_t const *module, void *symbol, void *user_ctx); size_t inst_size; \ char const *inst_type; \ CONF_PARSER const *config; \ - module_load_t load; \ + module_onload_t onload; \ module_unload_t unload; \ module_detach_t detach; \ } diff --git a/src/lib/server/exec.c b/src/lib/server/exec.c index bb34bc9f30d..b01c4abf007 100644 --- a/src/lib/server/exec.c +++ b/src/lib/server/exec.c @@ -24,8 +24,16 @@ */ RCSID("$Id$") -#include #include +#include +#include + +#include +#include +#include +#include + +#include #include diff --git a/src/lib/server/exec.h b/src/lib/server/exec.h new file mode 100644 index 00000000000..6a927a70003 --- /dev/null +++ b/src/lib/server/exec.h @@ -0,0 +1,65 @@ +#pragma once +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/** + * $Id$ + * + * @file lib/server/exfile.h + * @brief API for managing concurrent file access. + * + * @copyright 2014 The FreeRADIUS server project + */ +RCSIDH(exec_h, "$Id$") + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define EXEC_TIMEOUT 10 //!< Default wait time for exec calls. + +extern pid_t (*rad_fork)(void); +extern pid_t (*rad_waitpid)(pid_t pid, int *status); + +#ifdef __cplusplus +} +#endif + +#include +#include + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif +pid_t radius_start_program(char const *cmd, REQUEST *request, bool exec_wait, + int *input_fd, int *output_fd, + VALUE_PAIR *input_pairs, bool shell_escape); + +int radius_readfrom_program(int fd, pid_t pid, int timeout, + char *answer, int left); + +int radius_exec_program(TALLOC_CTX *ctx, char *out, size_t outlen, VALUE_PAIR **output_pairs, + REQUEST *request, char const *cmd, VALUE_PAIR *input_pairs, + bool exec_wait, bool shell_escape, int timeout) CC_HINT(nonnull (5, 6)); + +#ifdef __cplusplus +} +#endif diff --git a/src/lib/server/exfile.c b/src/lib/server/exfile.c index 253cebf45e6..da7147d5506 100644 --- a/src/lib/server/exfile.c +++ b/src/lib/server/exfile.c @@ -27,6 +27,10 @@ #include #include +#include + +#include + #include #include diff --git a/src/lib/server/exfile.h b/src/lib/server/exfile.h index 759ed9b2926..ba9135ff203 100644 --- a/src/lib/server/exfile.h +++ b/src/lib/server/exfile.h @@ -25,11 +25,11 @@ */ RCSIDH(exfile_h, "$Id$") +#include + #ifdef __cplusplus extern "C" { #endif - - /* * Multiple threads logging to one or more files. */ diff --git a/src/lib/server/log.h b/src/lib/server/log.h index cb9ae2aa396..0af62978576 100644 --- a/src/lib/server/log.h +++ b/src/lib/server/log.h @@ -38,17 +38,12 @@ extern "C" { */ typedef struct log_dst log_dst_t; -#ifdef __cplusplus -} -#endif - #include #include #include -#ifdef __cplusplus -extern "C" { -#endif +extern fr_log_lvl_t rad_debug_lvl; //!< Global debug level. +extern fr_log_lvl_t req_debug_lvl; //!< Request specific debug level. /** Logging callback to write log messages to a destination * @@ -63,8 +58,8 @@ extern "C" { * @param[in] ap Arguments for the fmt string. * @param[in] uctx Context data for the log function. Usually an #fr_log_t for vlog_request. */ -typedef void (*log_func_t)(fr_log_type_t type, fr_log_lvl_t lvl, REQUEST *request, char const *fmt, va_list ap, void *uctx); - +typedef void (*log_func_t)(fr_log_type_t type, fr_log_lvl_t lvl, REQUEST *request, + char const *fmt, va_list ap, void *uctx); struct log_dst { log_func_t func; //!< Function to call to log to this destination. diff --git a/src/lib/server/main_config.c b/src/lib/server/main_config.c index 54f981ea68c..e5c26fb6673 100644 --- a/src/lib/server/main_config.c +++ b/src/lib/server/main_config.c @@ -25,7 +25,6 @@ */ RCSID("$Id$") -#include #include #include #include @@ -33,6 +32,9 @@ RCSID("$Id$") #include #include +#include +#include + #include #include #include diff --git a/src/lib/server/main_config.h b/src/lib/server/main_config.h index b6eb27beb2a..8388ae27377 100644 --- a/src/lib/server/main_config.h +++ b/src/lib/server/main_config.h @@ -40,6 +40,8 @@ extern main_config_t const *main_config; //!< Global configuration singleton. #include #include +#include + #include /** Main server configuration diff --git a/src/lib/server/map.c b/src/lib/server/map.c index 79a37cdebc0..e95a8f74750 100644 --- a/src/lib/server/map.c +++ b/src/lib/server/map.c @@ -28,10 +28,17 @@ RCSID("$Id$") -#include +#include #include +#include #include +#include +#include + +#include +#include + #include #ifdef DEBUG_MAP diff --git a/src/lib/server/map.h b/src/lib/server/map.h index b68ec6925d0..1a11999e09a 100644 --- a/src/lib/server/map.h +++ b/src/lib/server/map.h @@ -26,6 +26,17 @@ */ RCSIDH(map_h, "$Id$") +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct vp_map_s vp_map_t; +typedef struct vp_list_mod_s vp_list_mod_t; + +#ifdef __cplusplus +} +#endif + #include #include @@ -43,7 +54,7 @@ extern "C" { * * @see vp_tmpl_t */ -typedef struct vp_map { +struct vp_map_s { vp_tmpl_t *lhs; //!< Typically describes the attribute to add, modify or compare. vp_tmpl_t *rhs; //!< Typically describes a literal value or a src attribute ///< to copy or compare. @@ -54,19 +65,19 @@ typedef struct vp_map { CONF_ITEM *ci; //!< Config item that the map was created from. Mainly used for //!< logging validation errors. - struct vp_map *next; //!< The next valuepair map. -} vp_map_t; + vp_map_t *next; //!< The next valuepair map. +}; /** A list modification * */ -typedef struct vp_list_mod { +struct vp_list_mod_s { vp_map_t const *map; //!< Original map describing the change to be made. vp_map_t *mod; //!< New map containing the destination (LHS) and ///< values (RHS). - struct vp_list_mod *next; -} vp_list_mod_t; + vp_list_mod_t *next; +}; #ifndef WITH_VERIFY_PTR # define MAP_VERIFY(_x) rad_assert((_x)->lhs) diff --git a/src/lib/server/map_proc.h b/src/lib/server/map_proc.h index 538f33cd2f5..9d858a56269 100644 --- a/src/lib/server/map_proc.h +++ b/src/lib/server/map_proc.h @@ -26,6 +26,17 @@ */ RCSIDH(map_proc_h, "$Id$") +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct map_proc map_proc_t; +typedef struct map_proc_inst map_proc_inst_t; + +#ifdef __cplusplus +} +#endif + #include #include #include @@ -34,9 +45,6 @@ RCSIDH(map_proc_h, "$Id$") extern "C" { #endif -typedef struct map_proc map_proc_t; -typedef struct map_proc_inst map_proc_inst_t; - /** Function to evaluate the src string and map the result to server attributes * * @param[in] mod_inst Instance of the module that registered the map_proc. diff --git a/src/lib/server/modpriv.h b/src/lib/server/modpriv.h index 55976006cd0..027570d109f 100644 --- a/src/lib/server/modpriv.h +++ b/src/lib/server/modpriv.h @@ -26,9 +26,9 @@ */ RCSIDH(modpriv_h, "$Id$") -#include -#include +#include #include +#include #ifdef __cplusplus extern "C" { @@ -36,8 +36,11 @@ extern "C" { module_instance_t *module_find_with_method(rlm_components_t *method, CONF_SECTION *modules, char const *asked_name); + module_instance_t *module_find(CONF_SECTION *modules, char const *asked_name); + int module_sibling_section_find(CONF_SECTION **out, CONF_SECTION *module, char const *name); + int unlang_fixup_update(vp_map_t *map, void *ctx); #ifdef __cplusplus diff --git a/src/lib/server/modules.h b/src/lib/server/modules.h index 1822406d44b..a1672e869b7 100644 --- a/src/lib/server/modules.h +++ b/src/lib/server/modules.h @@ -25,15 +25,32 @@ */ RCSIDH(modules_h, "$Id$") +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct rad_module_s rad_module_t; +typedef struct module_instance_s module_instance_t; +typedef struct section_type_value_s section_type_value_t; +typedef struct module_thread_instance_s module_thread_instance_t; + +#ifdef __cplusplus +} +#endif + #include +#include #include -#include -#include #include +#include +#include + #include -#include + #include +#include + #ifdef __cplusplus extern "C" { #endif @@ -45,11 +62,11 @@ extern const FR_NAME_NUMBER mod_rcode_table[]; * Used by module.c to define the mappings between names, types and control * attributes. */ -typedef struct section_type_value_t { +struct section_type_value_s { char const *section; //!< Section name e.g. "Authorize". char const *typename; //!< Type name e.g. "Auth-Type". int attr; //!< Attribute number. -} section_type_value_t; +}; /** Mappings between section names, typenames and control attributes * @@ -185,7 +202,7 @@ typedef void (*fr_unlang_module_signal_t)(REQUEST *request, void *instance, void * Determines the capabilities of the module, and maps internal functions * within the module to different sections. */ -typedef struct rad_module_t { +struct rad_module_s { RAD_MODULE_COMMON; int type; //!< Type flags that control calling conventions for modules. @@ -199,7 +216,7 @@ typedef struct rad_module_t { size_t thread_inst_size; //!< Size of data to allocate to the thread instance. module_method_t methods[MOD_COUNT]; //!< Pointers to the various section callbacks. -} rad_module_t; +}; /** Per instance data * @@ -207,7 +224,7 @@ typedef struct rad_module_t { * instance names (may NOT be the module names!), and the per-instance * data structures. */ -typedef struct { +struct module_instance_s { char const *name; //!< Instance name e.g. user_database. dl_instance_t *dl_inst; //!< Structure containing the module's instance data, @@ -224,13 +241,13 @@ typedef struct { rlm_rcode_t code; //!< Code module will return when 'force' has //!< has been set to true. -} module_instance_t; +}; /** Per thread per instance data * * Stores module and thread specific data. */ -typedef struct { +struct module_thread_instance_s { void *data; //!< Thread specific instance data. fr_event_list_t *el; //!< Event list associated with this thread. @@ -244,7 +261,7 @@ typedef struct { uint64_t total_calls; //! total number of times we've been called uint64_t active_callers; //! number of active callers. i.e. number of current yields -} module_thread_instance_t; +}; /* * Share connection pool instances between modules diff --git a/src/lib/server/pair.h b/src/lib/server/pair.h new file mode 100644 index 00000000000..6078cd04619 --- /dev/null +++ b/src/lib/server/pair.h @@ -0,0 +1,117 @@ +#pragma once +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/** + * $Id$ + * + * @file lib/server/pair.h + * @brief Server pair manipulation macros + * + * @copyright 2018 The FreeRADIUS server project + */ +RCSIDH(server_pair_h, "$Id$") + +/** Allocate a VALUE_PAIR in the request list + * + * @param[in] _attr allocated. + * @param[in] _da #fr_dict_attr_t of the pair to be found or allocated. + * @return + * - 0 on success. + * - -1 on failure. + */ +#define pair_add_request(_attr, _da) fr_pair_add_by_da(request->packet, _attr, &request->packet->vps, _da) + +/** Allocate a VALUE_PAIR in the reply list + * + * @param[in] _attr allocated. + * @param[in] _da #fr_dict_attr_t of the pair to be found or allocated. + * @return + * - 0 on success. + * - -1 on failure. + */ +#define pair_add_reply(_attr, _da) fr_pair_add_by_da(request->reply, _attr, &request->reply->vps, _da) + +/** Allocate a VALUE_PAIR in the control list + * + * @param[in] _attr allocated. + * @param[in] _da #fr_dict_attr_t of the pair to be found or allocated. + * @return + * - 0 on success. + * - -1 on failure. + */ +#define pair_add_control(_attr, _da) fr_pair_add_by_da(request, _attr, &request->control, _da) + +/** Return or allocate a VALUE_PAIR in the request list + * + * @param[in] _attr allocated or found. + * @param[in] _da #fr_dict_attr_t of the pair to be found or allocated. + * @return + * - 1 if attribute already existed. + * - 0 if we allocated a new attribute. + * - -1 on failure. + */ +#define pair_update_request(_attr, _da) fr_pair_update_by_da(request->packet, _attr, &request->packet->vps, _da) + +/** Return or allocate a VALUE_PAIR in the reply list + * + * @param[in] _attr allocated or found. + * @param[in] _da #fr_dict_attr_t of the pair to be found or allocated. + * @return + * - 1 if attribute already existed. + * - 0 if we allocated a new attribute. + * - -1 on failure. + */ +#define pair_update_reply(_attr, _da) fr_pair_update_by_da(request->reply, _attr, &request->reply->vps, _da) + +/** Return or allocate a VALUE_PAIR in the control list + * + * @param[in] _attr allocated or found. + * @param[in] _da #fr_dict_attr_t of the pair to be found or allocated. + * @return + * - 1 if attribute already existed. + * - 0 if we allocated a new attribute. + * - -1 on failure. + */ +#define pair_update_control(_attr, _da) fr_pair_update_by_da(request, _attr, &request->control, _da) + +/** Return or allocate a VALUE_PAIR in the request list + * + * @param[in] _da #fr_dict_attr_t of the pair(s) to be deleted. + * @return + * - >0 the number of pairs deleted. + * - 0 if no pairs were deleted. + */ +#define pair_delete_request(_da) fr_pair_delete_by_da(&request->packet->vps, _da) + +/** Return or allocate a VALUE_PAIR in the reply list + * + * @param[in] _da #fr_dict_attr_t of the pair(s) to be deleted. + * @return + * - >0 the number of pairs deleted. + * - 0 if no pairs were deleted. + */ +#define pair_delete_reply(_da) fr_pair_delete_by_da(&request->reply->vps, _da) + +/** Return or allocate a VALUE_PAIR in the control list + * + * @param[in] _da #fr_dict_attr_t of the pair(s) to be deleted. + * @return + * - >0 the number of pairs deleted. + * - 0 if no pairs were deleted. + */ +#define pair_delete_control(_da) fr_pair_delete_by_da(&request->control, _da) + diff --git a/src/lib/server/paircmp.c b/src/lib/server/paircmp.c index 5c2ee37e002..1ad354a09e1 100644 --- a/src/lib/server/paircmp.c +++ b/src/lib/server/paircmp.c @@ -34,6 +34,8 @@ RCSID("$Id$") #include #include +#include + #include typedef struct paircmp_s paircmp_t; diff --git a/src/lib/server/pairmove.c b/src/lib/server/pairmove.c index 4a13908c703..c86457eae9b 100644 --- a/src/lib/server/pairmove.c +++ b/src/lib/server/pairmove.c @@ -28,6 +28,10 @@ RCSID("$Id$") #include #include #include + +#include +#include + #include /* diff --git a/src/lib/server/pool.c b/src/lib/server/pool.c index 4b46bf1a8ee..eea19e42198 100644 --- a/src/lib/server/pool.c +++ b/src/lib/server/pool.c @@ -29,11 +29,13 @@ RCSID("$Id$") #define LOG_PREFIX_ARGS pool->log_prefix #include -#include #include #include -typedef struct fr_pool_connection fr_pool_connection_t; +#include +#include + +typedef struct fr_pool_connection_s fr_pool_connection_t; static int connection_check(fr_pool_t *pool, REQUEST *request); @@ -44,7 +46,7 @@ static int connection_check(fr_pool_t *pool, REQUEST *request); * * @see fr_pool_t */ -struct fr_pool_connection { +struct fr_pool_connection_s { fr_pool_connection_t *prev; //!< Previous connection in list. fr_pool_connection_t *next; //!< Next connection in list. int32_t heap_id; //!< For the next connection heap. @@ -78,7 +80,7 @@ struct fr_pool_connection { * * @see fr_connection */ -struct fr_pool { +struct fr_pool_s { int ref; //!< Reference counter to prevent connection //!< pool being freed multiple times. uint32_t start; //!< Number of initial connections. diff --git a/src/lib/server/pool.h b/src/lib/server/pool.h index fa25ab0e85b..cbe5df44e9b 100644 --- a/src/lib/server/pool.h +++ b/src/lib/server/pool.h @@ -24,18 +24,26 @@ * @copyright 2012 The FreeRADIUS server project * @copyright 2012 Alan DeKok */ -RCSIDH(connection_h, "$Id$") +RCSIDH(pool_h, "$Id$") + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct fr_pool_s fr_pool_t; +typedef struct fr_pool_state_s fr_pool_state_t; + +#ifdef __cplusplus +} +#endif -#include #include #ifdef __cplusplus extern "C" { #endif -typedef struct fr_pool fr_pool_t; - -typedef struct fr_pool_state { +struct fr_pool_state_s { uint32_t pending; //!< Number of pending open connections. time_t last_checked; //!< Last time we pruned the connection pool. time_t last_spawned; //!< Last time we spawned a connection. @@ -64,7 +72,7 @@ typedef struct fr_pool_state { uint32_t active; //!< Number of currently reserved connections. bool reconnecting; //!< We are currently reconnecting the pool. -} fr_pool_state_t; +}; /** Alter the opaque data of a connection pool during reconnection event * @@ -125,11 +133,11 @@ typedef int (*fr_pool_connection_alive_t)(void *opaque, void *connection); * Pool allocation/initialisation */ fr_pool_t *fr_pool_init(TALLOC_CTX *ctx, - CONF_SECTION const *cs, - void *opaque, - fr_pool_connection_create_t c, - fr_pool_connection_alive_t a, - char const *log_prefix); + CONF_SECTION const *cs, + void *opaque, + fr_pool_connection_create_t c, + fr_pool_connection_alive_t a, + char const *log_prefix); fr_pool_t *fr_pool_copy(TALLOC_CTX *ctx, fr_pool_t *pool, void *opaque); diff --git a/src/lib/server/rcode.h b/src/lib/server/rcode.h index e7ee80d9028..bec63b650dd 100644 --- a/src/lib/server/rcode.h +++ b/src/lib/server/rcode.h @@ -36,7 +36,7 @@ extern "C" { * All module functions must return one of the codes listed below (apart from * RLM_MODULE_NUMCODES, which is used to check for validity). */ -typedef enum rlm_rcodes { +typedef enum { RLM_MODULE_REJECT = 0, //!< Immediately reject the request. RLM_MODULE_FAIL, //!< Module failed, don't reply. RLM_MODULE_OK, //!< The module is OK, continue. diff --git a/src/lib/server/request.h b/src/lib/server/request.h index 4b833fabcb1..33d3e1c50bf 100644 --- a/src/lib/server/request.h +++ b/src/lib/server/request.h @@ -25,17 +25,13 @@ */ RCSIDH(request_h, "$Id$") +/* + * Forward declarations to avoid dependency loops + */ #ifdef __cplusplus extern "C" { #endif -#ifndef NDEBUG -# define REQUEST_MAGIC (0xdeadbeef) -#endif - -/* - * Forward declarations to avoid dependency loops - */ typedef struct fr_async_t fr_async_t; typedef struct rad_request REQUEST; typedef struct request_data_t request_data_t; @@ -43,6 +39,10 @@ typedef struct request_data_t request_data_t; typedef struct rad_listen rad_listen_t; typedef struct rad_client RADCLIENT; +#ifdef __cplusplus +} +#endif + #include #include #include @@ -51,6 +51,14 @@ typedef struct rad_client RADCLIENT; #include #include +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef NDEBUG +# define REQUEST_MAGIC (0xdeadbeef) +#endif + typedef enum { REQUEST_ACTIVE = 1, REQUEST_STOP_PROCESSING, diff --git a/src/lib/server/snmp.c b/src/lib/server/snmp.c index cd8ec86156f..3e077fca66a 100644 --- a/src/lib/server/snmp.c +++ b/src/lib/server/snmp.c @@ -29,6 +29,10 @@ RCSID("$Id$") #include #include + +#include +#include + #include #define FR_FREERADIUS_SNMP_TYPE_OBJECT 0 diff --git a/src/lib/server/state.c b/src/lib/server/state.c index d797b248773..19fdc36a1a6 100644 --- a/src/lib/server/state.c +++ b/src/lib/server/state.c @@ -48,9 +48,12 @@ RCSID("$Id$") #include #include +#include + #include #include -#include +#include +#include /** Holds a state value, and associated VALUE_PAIRs and data * @@ -520,7 +523,7 @@ static fr_state_entry_t *state_entry_find(fr_state_tree_t *state, REQUEST *reque /* * Assume our own State first. - */ + */ if (vb->vb_length == sizeof(my_entry.state)) { memcpy(my_entry.state, vb->vb_octets, sizeof(my_entry.state)); diff --git a/src/lib/server/stats.c b/src/lib/server/stats.c index 095c4b2a96e..7ae15ab575d 100644 --- a/src/lib/server/stats.c +++ b/src/lib/server/stats.c @@ -26,6 +26,11 @@ RCSID("$Id$") #include #include +#include + +#include +#include + #ifdef WITH_STATS #define USEC (1000000) diff --git a/src/lib/server/sysutmp.h b/src/lib/server/sysutmp.h index 82da3ae2608..83d3ad30305 100644 --- a/src/lib/server/sysutmp.h +++ b/src/lib/server/sysutmp.h @@ -25,6 +25,8 @@ */ RCSIDH(sysutmp_h, "$Id$") +#include + /* * If we have BOTH utmp.h and utmpx.h, then * we prefer to use utmp.h, but only on systems other than Solaris. @@ -41,7 +43,7 @@ RCSIDH(sysutmp_h, "$Id$") #ifdef HAVE_UTMPX_H # include # include -# define utmp utmpx +# define USE_UTMPX 1 # define UT_NAMESIZE 32 # define UT_LINESIZE 32 # define UT_HOSTSIZE 257 diff --git a/src/lib/server/tmpl.c b/src/lib/server/tmpl.c index bb1a30e7e9e..7ab25a022cf 100644 --- a/src/lib/server/tmpl.c +++ b/src/lib/server/tmpl.c @@ -29,6 +29,8 @@ RCSID("$Id$") #include #include +#include + #include /** Map #tmpl_type_t values to descriptive strings diff --git a/src/lib/server/trigger.c b/src/lib/server/trigger.c index 1844f7fb928..6f03d2e920e 100644 --- a/src/lib/server/trigger.c +++ b/src/lib/server/trigger.c @@ -29,6 +29,8 @@ RCSID("$Id$") #include #include +#include + static CONF_SECTION const *trigger_exec_main, *trigger_exec_subcs; static rbtree_t *trigger_last_fired_tree; static pthread_mutex_t *trigger_mutex; diff --git a/src/lib/server/users_file.c b/src/lib/server/users_file.c index 5db5db7096f..ba9cd6caf30 100644 --- a/src/lib/server/users_file.c +++ b/src/lib/server/users_file.c @@ -28,6 +28,8 @@ RCSID("$Id$") #include #include +#include + #include #include diff --git a/src/lib/server/util.c b/src/lib/server/util.c index d13a6c11e08..f84c1077f86 100644 --- a/src/lib/server/util.c +++ b/src/lib/server/util.c @@ -27,10 +27,12 @@ RCSID("$Id$") #include #include -#include +#include -#include +#include #include +#include +#include static bool suid_down_permanent = false; //!< Record whether we've permanently dropped privilledges diff --git a/src/lib/server/virtual_servers.c b/src/lib/server/virtual_servers.c index e39fb86e6b5..746bf44d34f 100644 --- a/src/lib/server/virtual_servers.c +++ b/src/lib/server/virtual_servers.c @@ -28,14 +28,18 @@ RCSID("$Id$") #include +#include +#include #include -#include #include #include -#include -#include -#include + #include +#include + +#include + +#include /* * Ordered by component diff --git a/src/lib/server/xlat.h b/src/lib/server/xlat.h index 61354867e22..835785c1623 100644 --- a/src/lib/server/xlat.h +++ b/src/lib/server/xlat.h @@ -32,7 +32,7 @@ extern "C" { /* * Forward declarations */ -typedef enum xlat_action_e { +typedef enum { XLAT_ACTION_PUSH_CHILD = 1, //!< A deeper level of nesting needs to be evaluated. XLAT_ACTION_YIELD, //!< An xlat function pushed a resume frame onto the stack. XLAT_ACTION_DONE, //!< We're done evaluating this level of nesting. @@ -43,14 +43,14 @@ typedef struct xlat_inst xlat_inst_t; typedef struct xlat_thread_inst xlat_thread_inst_t; typedef struct xlat_exp xlat_exp_t; -#include #include +#include #include + #include #include #include - /** Instance data for an xlat expansion node * */ diff --git a/src/lib/server/xlat_eval.c b/src/lib/server/xlat_eval.c index 2733483335c..a17d70cc488 100644 --- a/src/lib/server/xlat_eval.c +++ b/src/lib/server/xlat_eval.c @@ -32,8 +32,11 @@ RCSID("$Id$") #include #include #include + #include +#include + #include #include "xlat_priv.h" diff --git a/src/lib/server/xlat_func.c b/src/lib/server/xlat_func.c index 69b349f8ae6..6edeab6c5ca 100644 --- a/src/lib/server/xlat_func.c +++ b/src/lib/server/xlat_func.c @@ -30,10 +30,14 @@ RCSID("$Id$") #include #include #include + #include #include +#include +#include #include #include + #ifdef HAVE_OPENSSL_EVP_H # include #endif diff --git a/src/lib/tls/ctx.c b/src/lib/tls/ctx.c index 05387a6ceef..13fd87be1e9 100644 --- a/src/lib/tls/ctx.c +++ b/src/lib/tls/ctx.c @@ -30,11 +30,13 @@ USES_APPLE_DEPRECATED_API /* OpenSSL API has been deprecated by Apple */ #ifdef WITH_TLS #define LOG_PREFIX "tls - " +#include +#include +#include + #include #include -#include -#include #include "base.h" #if OPENSSL_VERSION_NUMBER >= 0x0090800fL diff --git a/src/lib/tls/ocsp.c b/src/lib/tls/ocsp.c index c06057107d5..659875aed6e 100644 --- a/src/lib/tls/ocsp.c +++ b/src/lib/tls/ocsp.c @@ -29,10 +29,13 @@ USES_APPLE_DEPRECATED_API /* OpenSSL API has been deprecated by Apple */ #ifdef HAVE_OPENSSL_OCSP_H #define LOG_PREFIX "tls - ocsp - " -#include #include #include + +#include + #include + #include "base.h" #include "tls_attrs.h" diff --git a/src/lib/tls/session.c b/src/lib/tls/session.c index 2b1ac3eaa4e..9cbd5f85cd3 100644 --- a/src/lib/tls/session.c +++ b/src/lib/tls/session.c @@ -28,10 +28,15 @@ #ifdef HAVE_OPENSSL_OCSP_H #define LOG_PREFIX "tls - " -#include -#include #include +#include + +#include +#include + #include +#include + #include "base.h" #include "tls_attrs.h" diff --git a/src/lib/tls/validate.c b/src/lib/tls/validate.c index 66dc520c4c6..649539da725 100644 --- a/src/lib/tls/validate.c +++ b/src/lib/tls/validate.c @@ -28,8 +28,13 @@ #ifdef WITH_TLS #define LOG_PREFIX "tls - " -#include +#include +#include #include + +#include +#include + #include "base.h" #include "tls_attrs.h" diff --git a/src/lib/unlang/op.c b/src/lib/unlang/op.c index 8187000c320..9916229d02c 100644 --- a/src/lib/unlang/op.c +++ b/src/lib/unlang/op.c @@ -24,13 +24,16 @@ */ RCSID("$Id$") -#include #include #include #include #include #include + +#include + #include +#include #include "unlang_priv.h" diff --git a/src/lib/util/hmac_md5.c b/src/lib/util/hmac_md5.c index 953a8a79774..8f93f57998b 100644 --- a/src/lib/util/hmac_md5.c +++ b/src/lib/util/hmac_md5.c @@ -31,6 +31,7 @@ RCSID("$Id$") #include +#include #ifdef HAVE_OPENSSL_EVP_H # include diff --git a/src/lib/util/hmac_sha1.c b/src/lib/util/hmac_sha1.c index 51d2eba1931..24c66bdeb2b 100644 --- a/src/lib/util/hmac_sha1.c +++ b/src/lib/util/hmac_sha1.c @@ -32,6 +32,7 @@ RCSID("$Id$") #include +#include #ifdef HMAC_SHA1_DATA_PROBLEMS unsigned int sha1_data_problems = 0; diff --git a/src/lib/util/rand.h b/src/lib/util/rand.h index 273c8bcbb99..2338288b4df 100644 --- a/src/lib/util/rand.h +++ b/src/lib/util/rand.h @@ -1,3 +1,4 @@ +#pragma once /* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -22,16 +23,16 @@ */ RCSIDH(rand_h, "$Id$") -#ifdef __cplusplus -extern "C" { -#endif - #include #include #include #include +#ifdef __cplusplus +extern "C" { +#endif + /* random numbers in isaac.c */ /* context of random number generator */ typedef struct fr_randctx { diff --git a/src/lib/util/value.h b/src/lib/util/value.h index 5b89d0a3ff9..81b9c439e6b 100644 --- a/src/lib/util/value.h +++ b/src/lib/util/value.h @@ -27,23 +27,32 @@ RCSIDH(value_h, "$Id$") extern "C" { #endif +#define FR_MAX_STRING_LEN 254 /* RFC2138: string 0-253 octets */ + +typedef struct value_box fr_value_box_t; + +#ifdef __cplusplus +} +#endif + #include #include #include +#include #include #include #include +#include #include -/* - * Avoid circular type references. - */ -typedef struct value_box fr_value_box_t; - -#include +#ifdef __cplusplus +extern "C" { +#endif extern const FR_NAME_NUMBER fr_value_box_type_names[]; + extern size_t const fr_value_box_field_sizes[]; + extern size_t const fr_value_box_offsets[]; #define fr_value_box_foreach(_v, _iv) for (fr_value_box_t *_iv = _v; _iv; _iv = _iv->next) @@ -443,7 +452,6 @@ _Generic((_var), \ )(_var, _box) /* @} **/ - /* * Allocation - init/alloc use static functions (above) */ @@ -551,7 +559,6 @@ bool fr_value_box_list_tainted(fr_value_box_t const *head); char *fr_value_box_asprint(TALLOC_CTX *ctx, fr_value_box_t const *data, char quote); size_t fr_value_box_snprint(char *out, size_t outlen, fr_value_box_t const *data, char quote); - #ifdef __cplusplus } #endif diff --git a/src/modules/proto_bfd/proto_bfd.c b/src/modules/proto_bfd/proto_bfd.c index 2a0ae2dab24..b8a5182250c 100644 --- a/src/modules/proto_bfd/proto_bfd.c +++ b/src/modules/proto_bfd/proto_bfd.c @@ -21,13 +21,18 @@ */ #include -#include #include -#include +#include #include + +#include + #include #include +#include +#include #include +#include #define USEC (1000000) #define BFD_MAX_SECRET_LENGTH 20 diff --git a/src/modules/proto_control/proto_control.c b/src/modules/proto_control/proto_control.c index b019bcad16a..2b70357a7c6 100644 --- a/src/modules/proto_control/proto_control.c +++ b/src/modules/proto_control/proto_control.c @@ -574,7 +574,7 @@ fr_app_t proto_control = { .config = proto_control_config, .inst_size = sizeof(proto_control_t), - .load = mod_load, + .onload = mod_load, .unload = mod_unload, .bootstrap = mod_bootstrap, .instantiate = mod_instantiate, diff --git a/src/modules/proto_control/radmin.c b/src/modules/proto_control/radmin.c index 7b35caa5b98..2e415c894f8 100644 --- a/src/modules/proto_control/radmin.c +++ b/src/modules/proto_control/radmin.c @@ -68,9 +68,17 @@ DIAG_ON(strict-prototypes) #define LOG_PREFIX "radmin - " #include -#include #include #include + +#include +#include +#include +#include +#include +#include + + #include "conduit.h" /* diff --git a/src/modules/proto_detail/proto_detail_file.c b/src/modules/proto_detail/proto_detail_file.c index cffae74b5b5..a855243bb58 100644 --- a/src/modules/proto_detail/proto_detail_file.c +++ b/src/modules/proto_detail/proto_detail_file.c @@ -22,17 +22,24 @@ * @copyright 2017 The FreeRADIUS server project. * @copyright 2017 Alan DeKok (aland@deployingradius.com) */ -#include -#include -#include -#include -#include + #include +#include #include #include + +#include + +#include +#include #include + +#include + #include "proto_detail.h" +#include + #include #include diff --git a/src/modules/proto_detail/proto_detail_process.c b/src/modules/proto_detail/proto_detail_process.c index 400eca842c0..158e968e986 100644 --- a/src/modules/proto_detail/proto_detail_process.c +++ b/src/modules/proto_detail/proto_detail_process.c @@ -29,6 +29,8 @@ #include #include #include +#include + #include "proto_detail.h" static fr_dict_t *dict_freeradius; diff --git a/src/modules/proto_dhcpv4/old.c b/src/modules/proto_dhcpv4/old.c index a0abba3a3ef..2d1cf5c016d 100644 --- a/src/modules/proto_dhcpv4/old.c +++ b/src/modules/proto_dhcpv4/old.c @@ -1119,7 +1119,7 @@ rad_protocol_t proto_dhcp = { .transports = TRANSPORT_UDP, .tls = false, - .load = dhcp_load, + .onload = dhcp_load, .unload = dhcp_unload, .compile = dhcp_listen_compile, .parse = dhcp_socket_parse, diff --git a/src/modules/proto_dhcpv4/proto_dhcpv4.c b/src/modules/proto_dhcpv4/proto_dhcpv4.c index c5f8ec16a19..ffb5c27d19d 100644 --- a/src/modules/proto_dhcpv4/proto_dhcpv4.c +++ b/src/modules/proto_dhcpv4/proto_dhcpv4.c @@ -724,7 +724,7 @@ fr_app_t proto_dhcpv4 = { .config = proto_dhcpv4_config, .inst_size = sizeof(proto_dhcpv4_t), - .load = mod_load, + .onload = mod_load, .unload = mod_unload, .bootstrap = mod_bootstrap, diff --git a/src/modules/proto_ldap_sync/proto_ldap_sync.c b/src/modules/proto_ldap_sync/proto_ldap_sync.c index 795a521d0f7..00a4be96b58 100644 --- a/src/modules/proto_ldap_sync/proto_ldap_sync.c +++ b/src/modules/proto_ldap_sync/proto_ldap_sync.c @@ -1275,7 +1275,7 @@ rad_protocol_t proto_ldap_sync = { .inst_size = sizeof(proto_ldap_inst_t), .transports = TRANSPORT_NONE, .tls = false, - .load = proto_ldap_load, + .onload = proto_ldap_load, .unload = proto_ldap_unload, .compile = proto_ldap_listen_compile, .parse = proto_ldap_socket_parse, diff --git a/src/modules/proto_radius/proto_radius.c b/src/modules/proto_radius/proto_radius.c index 61b2e94efe4..c1626dca196 100644 --- a/src/modules/proto_radius/proto_radius.c +++ b/src/modules/proto_radius/proto_radius.c @@ -830,7 +830,7 @@ fr_app_t proto_radius = { .config = proto_radius_config, .inst_size = sizeof(proto_radius_t), - .load = mod_load, + .onload = mod_load, .unload = mod_unload, .bootstrap = mod_bootstrap, .instantiate = mod_instantiate, diff --git a/src/modules/proto_tacacs/proto_tacacs.c b/src/modules/proto_tacacs/proto_tacacs.c index 225d006536c..36094632b81 100644 --- a/src/modules/proto_tacacs/proto_tacacs.c +++ b/src/modules/proto_tacacs/proto_tacacs.c @@ -678,7 +678,7 @@ extern rad_protocol_t proto_tacacs; rad_protocol_t proto_tacacs = { .name = "tacacs", .magic = RLM_MODULE_INIT, - .load = mod_load, + .onload = mod_load, .unload = mod_unload, .config = proto_tacacs_config, .inst_size = sizeof(proto_tacacs_t), diff --git a/src/modules/proto_vmps/proto_vmps.c b/src/modules/proto_vmps/proto_vmps.c index 757070b6b93..f813b04a934 100644 --- a/src/modules/proto_vmps/proto_vmps.c +++ b/src/modules/proto_vmps/proto_vmps.c @@ -676,7 +676,7 @@ fr_app_t proto_vmps = { .config = proto_vmps_config, .inst_size = sizeof(proto_vmps_t), - .load = mod_load, + .onload = mod_load, .unload = mod_unload, .bootstrap = mod_bootstrap, .instantiate = mod_instantiate, diff --git a/src/modules/rlm_cache/drivers/rlm_cache_memcached/rlm_cache_memcached.c b/src/modules/rlm_cache/drivers/rlm_cache_memcached/rlm_cache_memcached.c index 851cb6693bb..c8b8d8acc9d 100644 --- a/src/modules/rlm_cache/drivers/rlm_cache_memcached/rlm_cache_memcached.c +++ b/src/modules/rlm_cache/drivers/rlm_cache_memcached/rlm_cache_memcached.c @@ -313,7 +313,7 @@ cache_driver_t rlm_cache_memcached = { .inst_size = sizeof(rlm_cache_memcached_t), .config = driver_config, - .load = mod_load, + .onload = mod_load, .instantiate = mod_instantiate, .free = cache_entry_free, diff --git a/src/modules/rlm_cache/drivers/rlm_cache_redis/rlm_cache_redis.c b/src/modules/rlm_cache/drivers/rlm_cache_redis/rlm_cache_redis.c index dbb579fb75a..a6ff7c63293 100644 --- a/src/modules/rlm_cache/drivers/rlm_cache_redis/rlm_cache_redis.c +++ b/src/modules/rlm_cache/drivers/rlm_cache_redis/rlm_cache_redis.c @@ -460,7 +460,7 @@ extern cache_driver_t rlm_cache_redis; cache_driver_t rlm_cache_redis = { .name = "rlm_cache_redis", .magic = RLM_MODULE_INIT, - .load = mod_load, + .onload = mod_load, .instantiate = mod_instantiate, .inst_size = sizeof(rlm_cache_redis_t), .config = driver_config, diff --git a/src/modules/rlm_couchbase/rlm_couchbase.c b/src/modules/rlm_couchbase/rlm_couchbase.c index a2e519652e2..6e23c455cb0 100644 --- a/src/modules/rlm_couchbase/rlm_couchbase.c +++ b/src/modules/rlm_couchbase/rlm_couchbase.c @@ -545,7 +545,7 @@ rad_module_t rlm_couchbase = { .type = RLM_TYPE_THREAD_SAFE, .inst_size = sizeof(rlm_couchbase_t), .config = module_config, - .load = mod_load, + .onload = mod_load, .instantiate = mod_instantiate, .detach = mod_detach, .methods = { diff --git a/src/modules/rlm_dhcpv4/rlm_dhcpv4.c b/src/modules/rlm_dhcpv4/rlm_dhcpv4.c index 031a4f71108..5aab6916f63 100644 --- a/src/modules/rlm_dhcpv4/rlm_dhcpv4.c +++ b/src/modules/rlm_dhcpv4/rlm_dhcpv4.c @@ -204,7 +204,7 @@ rad_module_t rlm_dhcpv4 = { .name = "dhcpv4", .inst_size = sizeof(rlm_dhcpv4_t), - .load = dhcp_load, + .onload = dhcp_load, .unload = dhcp_unload, .bootstrap = mod_bootstrap, }; diff --git a/src/modules/rlm_eap/rlm_eap.c b/src/modules/rlm_eap/rlm_eap.c index 503941c9f7b..b8d6dec1332 100644 --- a/src/modules/rlm_eap/rlm_eap.c +++ b/src/modules/rlm_eap/rlm_eap.c @@ -1053,7 +1053,7 @@ rad_module_t rlm_eap = { .name = "eap", .inst_size = sizeof(rlm_eap_t), .config = module_config, - .load = mod_load, + .onload = mod_load, .unload = mod_unload, .bootstrap = mod_bootstrap, .instantiate = mod_instantiate, diff --git a/src/modules/rlm_eap/types/rlm_eap_aka/rlm_eap_aka.c b/src/modules/rlm_eap/types/rlm_eap_aka/rlm_eap_aka.c index 83c3c09adea..0ddaa9fa105 100644 --- a/src/modules/rlm_eap/types/rlm_eap_aka/rlm_eap_aka.c +++ b/src/modules/rlm_eap/types/rlm_eap_aka/rlm_eap_aka.c @@ -1364,7 +1364,7 @@ rlm_eap_submodule_t rlm_eap_aka = { .inst_size = sizeof(rlm_eap_aka_t), .config = submodule_config, - .load = mod_load, + .onload = mod_load, .unload = mod_unload, .session_init = mod_session_init, /* Initialise a new EAP session */ .entry_point = mod_process, /* Process next round of EAP method */ diff --git a/src/modules/rlm_eap/types/rlm_eap_peap/rlm_eap_peap.c b/src/modules/rlm_eap/types/rlm_eap_peap/rlm_eap_peap.c index 3d82f1bc83d..4434f21f423 100644 --- a/src/modules/rlm_eap/types/rlm_eap_peap/rlm_eap_peap.c +++ b/src/modules/rlm_eap/types/rlm_eap_peap/rlm_eap_peap.c @@ -393,7 +393,7 @@ rlm_eap_submodule_t rlm_eap_peap = { .provides = { FR_EAP_PEAP }, .inst_size = sizeof(rlm_eap_peap_t), .config = submodule_config, - .load = mod_load, + .onload = mod_load, .unload = mod_unload, .instantiate = mod_instantiate, diff --git a/src/modules/rlm_eap/types/rlm_eap_sim/rlm_eap_sim.c b/src/modules/rlm_eap/types/rlm_eap_sim/rlm_eap_sim.c index 85300b6232d..4f8934f36ef 100644 --- a/src/modules/rlm_eap/types/rlm_eap_sim/rlm_eap_sim.c +++ b/src/modules/rlm_eap/types/rlm_eap_sim/rlm_eap_sim.c @@ -1178,7 +1178,7 @@ rlm_eap_submodule_t rlm_eap_sim = { .inst_size = sizeof(rlm_eap_sim_t), .config = submodule_config, - .load = mod_load, + .onload = mod_load, .unload = mod_unload, .session_init = mod_session_init, /* Initialise a new EAP session */ .entry_point = mod_process, /* Process next round of EAP method */ diff --git a/src/modules/rlm_json/rlm_json.c b/src/modules/rlm_json/rlm_json.c index d996252f853..c53c1045c1c 100644 --- a/src/modules/rlm_json/rlm_json.c +++ b/src/modules/rlm_json/rlm_json.c @@ -380,6 +380,6 @@ rad_module_t rlm_json = { .magic = RLM_MODULE_INIT, .name = "json", .type = RLM_TYPE_THREAD_SAFE, - .load = mod_load, + .onload = mod_load, .bootstrap = mod_bootstrap, }; diff --git a/src/modules/rlm_ldap/rlm_ldap.c b/src/modules/rlm_ldap/rlm_ldap.c index dfc69f76b08..a723291851f 100644 --- a/src/modules/rlm_ldap/rlm_ldap.c +++ b/src/modules/rlm_ldap/rlm_ldap.c @@ -1994,7 +1994,7 @@ rad_module_t rlm_ldap = { .type = 0, .inst_size = sizeof(rlm_ldap_t), .config = module_config, - .load = mod_load, + .onload = mod_load, .unload = mod_unload, .bootstrap = mod_bootstrap, .instantiate = mod_instantiate, diff --git a/src/modules/rlm_mschap/rlm_mschap.c b/src/modules/rlm_mschap/rlm_mschap.c index 1558d32d241..b9205cf26e8 100644 --- a/src/modules/rlm_mschap/rlm_mschap.c +++ b/src/modules/rlm_mschap/rlm_mschap.c @@ -28,7 +28,10 @@ RCSID("$Id$") #include #include #include + +#include #include +#include #include #include diff --git a/src/modules/rlm_python/rlm_python.c b/src/modules/rlm_python/rlm_python.c index 28f57d0c159..fe24273541d 100644 --- a/src/modules/rlm_python/rlm_python.c +++ b/src/modules/rlm_python/rlm_python.c @@ -1086,7 +1086,7 @@ rad_module_t rlm_python = { .thread_inst_size = sizeof(rlm_python_thread_t), .config = module_config, - .load = mod_load, + .onload = mod_load, .unload = mod_unload, .instantiate = mod_instantiate, diff --git a/src/modules/rlm_radius/rlm_radius.c b/src/modules/rlm_radius/rlm_radius.c index 03fc3273404..7fdcf16d61b 100644 --- a/src/modules/rlm_radius/rlm_radius.c +++ b/src/modules/rlm_radius/rlm_radius.c @@ -899,7 +899,7 @@ rad_module_t rlm_radius = { .config = module_config, .bootstrap = mod_bootstrap, .instantiate = mod_instantiate, - .load = mod_load, + .onload = mod_load, .unload = mod_unload, .thread_inst_size = sizeof(rlm_radius_thread_t), diff --git a/src/modules/rlm_redis/rlm_redis.c b/src/modules/rlm_redis/rlm_redis.c index e4c6ed28e52..344faa905ea 100644 --- a/src/modules/rlm_redis/rlm_redis.c +++ b/src/modules/rlm_redis/rlm_redis.c @@ -358,7 +358,7 @@ rad_module_t rlm_redis = { .type = RLM_TYPE_THREAD_SAFE, .inst_size = sizeof(rlm_redis_t), .config = module_config, - .load = mod_load, + .onload = mod_load, .bootstrap = mod_bootstrap, .instantiate = mod_instantiate, }; diff --git a/src/modules/rlm_redis_ippool/rlm_redis_ippool.c b/src/modules/rlm_redis_ippool/rlm_redis_ippool.c index 38c45f8a966..9050c564d1d 100644 --- a/src/modules/rlm_redis_ippool/rlm_redis_ippool.c +++ b/src/modules/rlm_redis_ippool/rlm_redis_ippool.c @@ -1373,7 +1373,7 @@ rad_module_t rlm_redis_ippool = { .type = RLM_TYPE_THREAD_SAFE, .inst_size = sizeof(rlm_redis_ippool_t), .config = module_config, - .load = mod_load, + .onload = mod_load, .instantiate = mod_instantiate, .methods = { [MOD_ACCOUNTING] = mod_accounting, diff --git a/src/modules/rlm_rediswho/rlm_rediswho.c b/src/modules/rlm_rediswho/rlm_rediswho.c index 9795477b8b5..a3fef18cadd 100644 --- a/src/modules/rlm_rediswho/rlm_rediswho.c +++ b/src/modules/rlm_rediswho/rlm_rediswho.c @@ -255,7 +255,7 @@ rad_module_t rlm_rediswho = { .type = RLM_TYPE_THREAD_SAFE, .inst_size = sizeof(rlm_rediswho_t), .config = module_config, - .load = mod_load, + .onload = mod_load, .instantiate = mod_instantiate, .bootstrap = mod_bootstrap, .methods = { diff --git a/src/modules/rlm_rest/rlm_rest.c b/src/modules/rlm_rest/rlm_rest.c index 5b5ca3f2be4..02d8ec4d316 100644 --- a/src/modules/rlm_rest/rlm_rest.c +++ b/src/modules/rlm_rest/rlm_rest.c @@ -1114,7 +1114,7 @@ rad_module_t rlm_rest = { .inst_size = sizeof(rlm_rest_t), .thread_inst_size = sizeof(rlm_rest_thread_t), .config = module_config, - .load = mod_load, + .onload = mod_load, .unload = mod_unload, .bootstrap = mod_bootstrap, .instantiate = mod_instantiate, diff --git a/src/modules/rlm_soh/rlm_soh.c b/src/modules/rlm_soh/rlm_soh.c index 0feee6dbf68..b8e10d684b2 100644 --- a/src/modules/rlm_soh/rlm_soh.c +++ b/src/modules/rlm_soh/rlm_soh.c @@ -260,7 +260,7 @@ rad_module_t rlm_soh = { .type = RLM_TYPE_THREAD_SAFE, .inst_size = sizeof(rlm_soh_t), .config = module_config, - .load = mod_load, + .onload = mod_load, .unload = mod_unload, .bootstrap = mod_bootstrap, .methods = { diff --git a/src/modules/rlm_sql/drivers/rlm_sql_cassandra/rlm_sql_cassandra.c b/src/modules/rlm_sql/drivers/rlm_sql_cassandra/rlm_sql_cassandra.c index d239d115b4e..eca7c30f69f 100644 --- a/src/modules/rlm_sql/drivers/rlm_sql_cassandra/rlm_sql_cassandra.c +++ b/src/modules/rlm_sql/drivers/rlm_sql_cassandra/rlm_sql_cassandra.c @@ -933,7 +933,7 @@ rlm_sql_driver_t rlm_sql_cassandra = { .name = "rlm_sql_cassandra", .magic = RLM_MODULE_INIT, .inst_size = sizeof(rlm_sql_cassandra_t), - .load = mod_load, + .onload = mod_load, .unload = mod_unload, .config = driver_config, .mod_instantiate = mod_instantiate, diff --git a/src/modules/rlm_sql/drivers/rlm_sql_mysql/rlm_sql_mysql.c b/src/modules/rlm_sql/drivers/rlm_sql_mysql/rlm_sql_mysql.c index b6b2ef09922..a52f59c405c 100644 --- a/src/modules/rlm_sql/drivers/rlm_sql_mysql/rlm_sql_mysql.c +++ b/src/modules/rlm_sql/drivers/rlm_sql_mysql/rlm_sql_mysql.c @@ -752,7 +752,7 @@ rlm_sql_driver_t rlm_sql_mysql = { .magic = RLM_MODULE_INIT, .flags = RLM_SQL_RCODE_FLAGS_ALT_QUERY, .inst_size = sizeof(rlm_sql_mysql_t), - .load = mod_load, + .onload = mod_load, .unload = mod_unload, .config = driver_config, .mod_instantiate = mod_instantiate, diff --git a/src/modules/rlm_sql/drivers/rlm_sql_postgresql/rlm_sql_postgresql.c b/src/modules/rlm_sql/drivers/rlm_sql_postgresql/rlm_sql_postgresql.c index 660a612985c..937ea496593 100644 --- a/src/modules/rlm_sql/drivers/rlm_sql_postgresql/rlm_sql_postgresql.c +++ b/src/modules/rlm_sql/drivers/rlm_sql_postgresql/rlm_sql_postgresql.c @@ -529,7 +529,7 @@ rlm_sql_driver_t rlm_sql_postgresql = { .magic = RLM_MODULE_INIT, // .flags = RLM_SQL_RCODE_FLAGS_ALT_QUERY, /* Needs more testing */ .inst_size = sizeof(rlm_sql_postgres_t), - .load = mod_load, + .onload = mod_load, .config = driver_config, .mod_instantiate = mod_instantiate, .sql_socket_init = sql_socket_init, diff --git a/src/modules/rlm_sql/drivers/rlm_sql_sqlite/rlm_sql_sqlite.c b/src/modules/rlm_sql/drivers/rlm_sql_sqlite/rlm_sql_sqlite.c index b8f4db937cc..979777b9942 100644 --- a/src/modules/rlm_sql/drivers/rlm_sql_sqlite/rlm_sql_sqlite.c +++ b/src/modules/rlm_sql/drivers/rlm_sql_sqlite/rlm_sql_sqlite.c @@ -808,7 +808,7 @@ rlm_sql_driver_t rlm_sql_sqlite = { .flags = RLM_SQL_RCODE_FLAGS_ALT_QUERY, .inst_size = sizeof(rlm_sql_sqlite_t), .config = driver_config, - .load = mod_load, + .onload = mod_load, .mod_instantiate = mod_instantiate, .sql_socket_init = sql_socket_init, .sql_query = sql_query, diff --git a/src/modules/rlm_unix/rlm_unix.c b/src/modules/rlm_unix/rlm_unix.c index d8bf9754543..b5c2c0d424d 100644 --- a/src/modules/rlm_unix/rlm_unix.c +++ b/src/modules/rlm_unix/rlm_unix.c @@ -34,6 +34,8 @@ USES_APPLE_DEPRECATED_API #define LOG_PREFIX_ARGS inst->name #include +#include +#include #include #include @@ -45,9 +47,6 @@ USES_APPLE_DEPRECATED_API # include #endif -#include -#include - static char trans[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; #define ENC(c) trans[c] @@ -468,8 +467,8 @@ static rlm_rcode_t CC_HINT(nonnull) mod_accounting(void *instance, UNUSED void * strlcpy(ut.ut_host, buf, sizeof(ut.ut_host)); } #endif -#ifdef HAVE_UTMPX_H - ut.ut_xtime = t- delay; +#ifdef USE_UTMPX + ut.ut_xtime = t - delay; #else ut.ut_time = t - delay; #endif diff --git a/src/protocols/radius/radius.h b/src/protocols/radius/radius.h index 116c690176f..e57ee9a0c6d 100644 --- a/src/protocols/radius/radius.h +++ b/src/protocols/radius/radius.h @@ -30,7 +30,6 @@ #define AUTH_VECTOR_LEN 16 #define CHAP_VALUE_LENGTH 16 -#define FR_MAX_STRING_LEN 254 /* RFC2138: string 0-253 octets */ #define RADIUS_MAX_ATTRIBUTES 255 #ifdef _LIBRADIUS diff --git a/src/protocols/vqp/vqp.c b/src/protocols/vqp/vqp.c index 3a700868192..37ac2fec55e 100644 --- a/src/protocols/vqp/vqp.c +++ b/src/protocols/vqp/vqp.c @@ -27,6 +27,7 @@ RCSID("$Id$") #include #include +#include #include "vqp.h"