*/
RCSID("$Id$")
-#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/map_proc.h>
#include <freeradius-devel/server/modules.h>
#include <freeradius-devel/server/rad_assert.h>
#include <freeradius-devel/server/radmin.h>
#include <freeradius-devel/server/state.h>
+
#include <freeradius-devel/tls/base.h>
+
#include <freeradius-devel/unlang/base.h>
+#include <freeradius-devel/util/misc.h>
+
#include <ctype.h>
#include <fcntl.h>
#include <sys/file.h>
*/
RCSID("$Id$")
-#include <freeradius-devel/server/base.h>
-#include <freeradius-devel/server/radmin.h>
#include <freeradius-devel/io/schedule.h>
+#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/rad_assert.h>
+#include <freeradius-devel/server/radmin.h>
+
+#include <freeradius-devel/util/dict.h>
+#include <freeradius-devel/util/misc.h>
+#include <freeradius-devel/util/socket.h>
#ifdef HAVE_LIBREADLINE
#include <freeradius-devel/server/radutmp.h>
#include <freeradius-devel/server/sysutmp.h>
+#include <freeradius-devel/util/conf.h>
+
#include <pwd.h>
#include <sys/stat.h>
#include <ctype.h>
RCSID("$Id$")
#include <freeradius-devel/server/base.h>
-#include <freeradius-devel/server/modules.h>
-#include <freeradius-devel/unlang/base.h>
#include <freeradius-devel/server/map_proc.h>
-#include <freeradius-devel/server/state.h>
+#include <freeradius-devel/server/modules.h>
#include <freeradius-devel/server/rad_assert.h>
+#include <freeradius-devel/server/state.h>
+
+#include <freeradius-devel/radius/defs.h>
+#include <freeradius-devel/radius/radius.h>
+
+#include <freeradius-devel/util/rand.h>
+
#include <freeradius-devel/tls/base.h>
+#include <freeradius-devel/unlang/base.h>
+
#ifdef HAVE_GETOPT_H
# include <getopt.h>
#endif
*/
RCSIDH(channel_h, "$Id$")
-#include <freeradius-devel/io/message.h>
-#include <freeradius-devel/io/control.h>
-#include <freeradius-devel/io/base.h>
-#include <freeradius-devel/util/dlist.h>
-
-#include <sys/types.h>
-#include <sys/event.h>
-
#ifdef __cplusplus
extern "C" {
#endif
*/
typedef struct fr_listen fr_listen_t;
+#ifdef __cplusplus
+}
+#endif
+
+#include <freeradius-devel/io/message.h>
+#include <freeradius-devel/io/control.h>
+#include <freeradius-devel/io/base.h>
+#include <freeradius-devel/util/dlist.h>
+
+#include <sys/types.h>
+#include <sys/event.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef enum fr_channel_event_t {
FR_CHANNEL_ERROR = 0,
FR_CHANNEL_DATA_READY_WORKER,
*
* @copyright 2018 Alan DeKok (aland@freeradius.org)
*/
-#include <freeradius-devel/server/base.h>
#include <freeradius-devel/io/listen.h>
+#include <freeradius-devel/io/master.h>
+
+#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/modules.h>
+#include <freeradius-devel/server/rad_assert.h>
+
#include <freeradius-devel/unlang/base.h>
-#include <freeradius-devel/io/master.h>
+
+#include <freeradius-devel/util/misc.h>
#include <freeradius-devel/util/syserror.h>
-#include <freeradius-devel/server/rad_assert.h>
typedef struct fr_io_live_t {
fr_event_list_t *el; //!< event list, for the master socket.
#include <talloc.h>
#include <freeradius-devel/util/event.h>
+#include <freeradius-devel/util/misc.h>
+#include <freeradius-devel/util/rand.h>
#include <freeradius-devel/util/rbtree.h>
-#include <freeradius-devel/io/queue.h>
+#include <freeradius-devel/util/thread_local.h>
+
#include <freeradius-devel/io/channel.h>
#include <freeradius-devel/io/control.h>
-#include <freeradius-devel/io/worker.h>
-#include <freeradius-devel/io/network.h>
#include <freeradius-devel/io/listen.h>
+#include <freeradius-devel/io/network.h>
+#include <freeradius-devel/io/queue.h>
+#include <freeradius-devel/io/ring_buffer.h>
+#include <freeradius-devel/io/worker.h>
/*
* Define our own debugging.
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
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
*/
RCSIDH(network_h, "$Id$")
-#include <freeradius-devel/util/log.h>
-
#ifdef __cplusplus
extern "C" {
#endif
typedef struct fr_network_t fr_network_t;
+#ifdef __cplusplus
+}
+#endif
+
+#include <freeradius-devel/io/worker.h>
+#include <freeradius-devel/util/log.h>
+
+#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);
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
}
*/
RCSIDH(schedule_h, "$Id$")
-#include <freeradius-devel/io/worker.h>
-#include <freeradius-devel/io/network.h>
-#include <freeradius-devel/util/log.h>
-
#ifdef __cplusplus
extern "C" {
#endif
typedef struct fr_schedule_t fr_schedule_t;
+#ifdef __cplusplus
+}
+#endif
+
+#include <freeradius-devel/io/channel.h>
+#include <freeradius-devel/io/network.h>
+#include <freeradius-devel/io/worker.h>
+#include <freeradius-devel/util/log.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
/** Setup a new thread
*
* @param[in] ctx to allocate any thread specific memory in.
*/
RCSIDH(worker_h, "$Id$")
-#include <talloc.h>
-
-#include <freeradius-devel/util/heap.h>
-#include <freeradius-devel/util/event.h>
-#include <freeradius-devel/util/log.h>
-#include <freeradius-devel/server/command.h>
-
-#include <freeradius-devel/io/base.h>
#ifdef __cplusplus
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 <freeradius-devel/util/heap.h>
+#include <freeradius-devel/util/event.h>
+#include <freeradius-devel/util/log.h>
+#include <freeradius-devel/server/command.h>
+#include <freeradius-devel/io/base.h>
+
+#include <talloc.h>
+#include <pthread.h>
+
+#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
* after some time. This time is configurable.
*
*/
+
+#include <freeradius-devel/server/rad_assert.h>
+#include <freeradius-devel/server/cf_parse.h>
+
+#include <freeradius-devel/util/fifo.h>
+#include <freeradius-devel/util/misc.h>
+#include <freeradius-devel/util/rand.h>
+
#include "base.h"
#include "cluster.h"
#include "crc16.h"
-#include <freeradius-devel/server/rad_assert.h>
-#include <freeradius-devel/server/cf_parse.h>
#define KEY_SLOTS 16384 //!< Maximum number of keyslots (should not change).
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/modules.h>
-#include <freeradius-devel/server/state.h>
#include <freeradius-devel/server/rad_assert.h>
+#include <freeradius-devel/server/rcode.h>
+#include <freeradius-devel/server/state.h>
+
+#include <freeradius-devel/util/print.h>
+
+#include <freeradius-devel/radius/defs.h>
+
+#include <freeradius-devel/attributes.h>
#include <ctype.h>
* 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;
--- /dev/null
+#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 <freeradius-devel/server/request.h>
+#include <freeradius-devel/server/rcode.h>
+
+rlm_rcode_t rad_postauth(REQUEST *);
+rlm_rcode_t rad_virtual_server(REQUEST *);
+
+#ifdef __cplusplus
+}
+#endif
* @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 <freeradius-devel/features.h>
+#include <freeradius-devel/server/auth.h>
#include <freeradius-devel/server/cf_file.h>
+#include <freeradius-devel/server/cf_parse.h>
+#include <freeradius-devel/server/cf_util.h>
#include <freeradius-devel/server/client.h>
+#include <freeradius-devel/server/command.h>
+#include <freeradius-devel/server/components.h>
+#include <freeradius-devel/server/cond_eval.h>
+#include <freeradius-devel/server/connection.h>
+#include <freeradius-devel/server/crypt.h>
#include <freeradius-devel/server/dependency.h>
+#include <freeradius-devel/server/dl.h>
+#include <freeradius-devel/server/exec.h>
+#include <freeradius-devel/server/exfile.h>
+#include <freeradius-devel/server/listen.h>
#include <freeradius-devel/server/log.h>
+#include <freeradius-devel/server/main_config.h>
+#include <freeradius-devel/server/map_proc_priv.h>
+#include <freeradius-devel/server/map_proc.h>
+#include <freeradius-devel/server/map.h>
+#include <freeradius-devel/server/modules.h>
+#include <freeradius-devel/server/pair.h>
#include <freeradius-devel/server/paircmp.h>
+#include <freeradius-devel/server/pairmove.h>
+#include <freeradius-devel/server/parser.h>
+#include <freeradius-devel/server/pool.h>
#include <freeradius-devel/server/process.h>
+#include <freeradius-devel/server/protocol.h>
+#include <freeradius-devel/server/regex.h>
#include <freeradius-devel/server/rcode.h>
#include <freeradius-devel/server/realms.h>
#include <freeradius-devel/server/request.h>
+#include <freeradius-devel/server/state.h>
#include <freeradius-devel/server/stats.h>
-#include <freeradius-devel/server/trigger.h>
-#include <freeradius-devel/server/util.h>
-
-#include <freeradius-devel/util/base.h>
-
-/*
- * Let any external program building against the library know what
- * features the library was built with.
- */
-#include <freeradius-devel/features.h>
-
-/*
- * All POSIX systems should have these headers
- */
-#include <pwd.h>
-#include <grp.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
+#include <freeradius-devel/server/sysutmp.h>
#ifdef WITH_TCP
# include <freeradius-devel/server/tcp.h>
#endif
+#include <freeradius-devel/server/tmpl.h>
+#include <freeradius-devel/server/trigger.h>
+#include <freeradius-devel/server/users_file.h>
+#include <freeradius-devel/server/util.h>
+#include <freeradius-devel/server/xlat.h>
-/*
- * 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 <freeradius-devel/util/base.h>
#include <freeradius-devel/server/log.h>
#include <freeradius-devel/server/parser.h>
#include <freeradius-devel/server/rad_assert.h>
+#include <freeradius-devel/server/util.h>
+
#include <freeradius-devel/util/cursor.h>
+#include <freeradius-devel/util/syserror.h>
#include "cf_priv.h"
#include <stdint.h>
#include <freeradius-devel/server/cf_util.h>
+
#include <freeradius-devel/util/rbtree.h>
+#include <freeradius-devel/util/syserror.h>
#include <freeradius-devel/util/token.h>
+#include <freeradius-devel/util/print.h>
#ifdef __cplusplus
extern "C" {
#include <freeradius-devel/server/log.h>
#include <freeradius-devel/server/rad_assert.h>
#include <freeradius-devel/server/tmpl.h>
+
#include <freeradius-devel/util/inet.h>
+#include <freeradius-devel/util/misc.h>
#include <freeradius-devel/util/types.h>
#include "cf_priv.h"
#include <string.h>
#include <freeradius-devel/server/cf_util.h>
+#include <freeradius-devel/server/cf_file.h>
#include <freeradius-devel/server/log.h>
#include <freeradius-devel/server/rad_assert.h>
#include <freeradius-devel/util/cursor.h>
*/
RCSID("$Id$")
-#include <ctype.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-
#include <freeradius-devel/server/cf_parse.h>
#include <freeradius-devel/server/modules.h>
#include <freeradius-devel/server/rad_assert.h>
+
#include <freeradius-devel/util/trie.h>
+#include <freeradius-devel/util/misc.h>
+
+#include <freeradius-devel/attributes.h>
+
+#include <ctype.h>
+#include <fcntl.h>
+#include <sys/stat.h>
//#define WITH_TRIE (1)
#include <freeradius-devel/server/log.h>
#include <freeradius-devel/server/rad_assert.h>
+#include <freeradius-devel/util/misc.h>
+
/*
* Registration hooks for radmin.
*/
#include <freeradius-devel/server/parser.h>
#include <freeradius-devel/server/rad_assert.h>
+#include <freeradius-devel/attributes.h>
+
#include <ctype.h>
#include <freeradius-devel/server/connection.h>
#include <freeradius-devel/server/log.h>
#include <freeradius-devel/server/rad_assert.h>
+#include <freeradius-devel/server/cond_eval.h>
+
#include <freeradius-devel/util/base.h>
#include <freeradius-devel/util/event.h>
*
* @copyright 2017 Arran Cudbard-Bell (a.cudbardb@freeradius.org)
*/
-RCSIDH(cond_eval_h, "$Id$")
+RCSIDH(connection_h, "$Id$")
#ifdef __cplusplus
extern "C" {
*/
RCSIDH(dependency_h, "$Id$")
-#include <stddef.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern char const *radiusd_version;
+extern char const *radiusd_version_short;
+
#include <freeradius-devel/server/cf_util.h>
+#include <stddef.h>
+
int rad_check_lib_magic(uint64_t magic);
int ssl_check_consistency(void);
char const *ssl_version_by_num(uint32_t version);
void dependency_features_init(CONF_SECTION *cs);
void dependency_version_numbers_init(CONF_SECTION *cs);
void dependency_version_print(void);
+
+#ifdef __cplusplus
+}
+#endif
*/
RCSID("$Id$")
-#include <ctype.h>
-#include <unistd.h>
#include <freeradius-devel/server/dl.h>
-#include <freeradius-devel/util/cursor.h>
+#include <freeradius-devel/server/log.h>
#include <freeradius-devel/server/rad_assert.h>
-#include <freeradius-devel/server/base.h>
+
+#include <freeradius-devel/util/cursor.h>
+#include <freeradius-devel/util/syserror.h>
+
+#include <ctype.h>
+#include <unistd.h>
#ifdef HAVE_VALGRIND_H
# include <valgrind.h>
*/
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;
}
* - 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)
*
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; \
}
*/
RCSID("$Id$")
-#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/rad_assert.h>
+#include <freeradius-devel/server/request.h>
+#include <freeradius-devel/server/util.h>
+
+#include <freeradius-devel/util/dlist.h>
+#include <freeradius-devel/util/misc.h>
+#include <freeradius-devel/util/syserror.h>
+#include <freeradius-devel/util/thread_local.h>
+
+#include <freeradius-devel/attributes.h>
#include <sys/file.h>
--- /dev/null
+#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 <unistd.h>
+
+#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 <freeradius-devel/server/request.h>
+#include <freeradius-devel/util/pair.h>
+
+#include <sys/types.h>
+#include <talloc.h>
+
+#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
#include <freeradius-devel/server/rad_assert.h>
#include <freeradius-devel/server/exfile.h>
+#include <freeradius-devel/util/misc.h>
+
+#include <freeradius-devel/attributes.h>
+
#include <sys/stat.h>
#include <fcntl.h>
*/
RCSIDH(exfile_h, "$Id$")
+#include <freeradius-devel/server/request.h>
+
#ifdef __cplusplus
extern "C" {
#endif
-
-
/*
* Multiple threads logging to one or more files.
*/
*/
typedef struct log_dst log_dst_t;
-#ifdef __cplusplus
-}
-#endif
-
#include <freeradius-devel/server/request.h>
#include <freeradius-devel/util/log.h>
#include <freeradius-devel/util/pair.h>
-#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
*
* @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.
*/
RCSID("$Id$")
-#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/cond_eval.h>
#include <freeradius-devel/server/main_config.h>
#include <freeradius-devel/server/map_proc.h>
#include <freeradius-devel/server/modules.h>
#include <freeradius-devel/server/rad_assert.h>
+#include <freeradius-devel/util/conf.h>
+#include <freeradius-devel/util/dict.h>
+
#include <sys/stat.h>
#include <pwd.h>
#include <grp.h>
#include <freeradius-devel/server/cf_util.h>
#include <freeradius-devel/server/tmpl.h>
+#include <freeradius-devel/server/main_config.h>
+
#include <freeradius-devel/util/dict.h>
/** Main server configuration
RCSID("$Id$")
-#include <freeradius-devel/server/base.h>
+#include <freeradius-devel/server/exec.h>
#include <freeradius-devel/server/map.h>
+#include <freeradius-devel/server/paircmp.h>
#include <freeradius-devel/server/rad_assert.h>
+#include <freeradius-devel/util/pair_cursor.h>
+#include <freeradius-devel/util/misc.h>
+
+#include <freeradius-devel/rfc2865.h>
+#include <freeradius-devel/attributes.h>
+
#include <ctype.h>
#ifdef DEBUG_MAP
*/
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 <freeradius-devel/server/cf_util.h>
#include <freeradius-devel/server/tmpl.h>
*
* @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.
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)
*/
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 <freeradius-devel/server/cf_util.h>
#include <freeradius-devel/server/tmpl.h>
#include <freeradius-devel/server/map.h>
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.
*/
RCSIDH(modpriv_h, "$Id$")
-#include <freeradius-devel/server/base.h>
-#include <freeradius-devel/server/modules.h>
+#include <freeradius-devel/server/dl.h>
#include <freeradius-devel/server/map.h>
+#include <freeradius-devel/server/modules.h>
#ifdef __cplusplus
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
*/
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 <freeradius-devel/server/cf_parse.h>
+#include <freeradius-devel/server/components.h>
#include <freeradius-devel/server/dl.h>
-#include <freeradius-devel/features.h>
-#include <freeradius-devel/server/pool.h>
#include <freeradius-devel/server/exfile.h>
+#include <freeradius-devel/server/pool.h>
+#include <freeradius-devel/server/rcode.h>
+
#include <freeradius-devel/io/schedule.h>
-#include <freeradius-devel/server/components.h>
+
#include <freeradius-devel/unlang/base.h>
+#include <freeradius-devel/features.h>
+
#ifdef __cplusplus
extern "C" {
#endif
* 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
*
* 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.
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
*
* 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,
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.
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
--- /dev/null
+#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)
+
#include <freeradius-devel/server/regex.h>
#include <freeradius-devel/server/request.h>
+#include <freeradius-devel/rfc2865.h>
+
#include <ctype.h>
typedef struct paircmp_s paircmp_t;
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/rad_assert.h>
#include <freeradius-devel/server/pairmove.h>
+
+#include <freeradius-devel/rfc2865.h>
+#include <freeradius-devel/attributes.h>
+
#include <ctype.h>
/*
#define LOG_PREFIX_ARGS pool->log_prefix
#include <freeradius-devel/server/base.h>
-#include <freeradius-devel/util/heap.h>
#include <freeradius-devel/server/modpriv.h>
#include <freeradius-devel/server/rad_assert.h>
-typedef struct fr_pool_connection fr_pool_connection_t;
+#include <freeradius-devel/util/heap.h>
+#include <freeradius-devel/util/misc.h>
+
+typedef struct fr_pool_connection_s fr_pool_connection_t;
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.
*
* @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.
* @copyright 2012 The FreeRADIUS server project
* @copyright 2012 Alan DeKok <aland@deployingradius.com>
*/
-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 <freeradius-devel/server/base.h>
#include <freeradius-devel/server/stats.h>
#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.
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
*
* 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);
* 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.
*/
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;
typedef struct rad_listen rad_listen_t;
typedef struct rad_client RADCLIENT;
+#ifdef __cplusplus
+}
+#endif
+
#include <freeradius-devel/server/log.h>
#include <freeradius-devel/server/main_config.h>
#include <freeradius-devel/server/process.h>
#include <freeradius-devel/util/heap.h>
#include <freeradius-devel/util/packet.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef NDEBUG
+# define REQUEST_MAGIC (0xdeadbeef)
+#endif
+
typedef enum {
REQUEST_ACTIVE = 1,
REQUEST_STOP_PROCESSING,
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/rad_assert.h>
+
+#include <freeradius-devel/util/misc.h>
+#include <freeradius-devel/util/proto.h>
+
#include <freeradius-devel/freeradius.snmp.h>
#define FR_FREERADIUS_SNMP_TYPE_OBJECT 0
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/state.h>
+#include <freeradius-devel/server/rad_assert.h>
+
#include <freeradius-devel/util/dlist.h>
#include <freeradius-devel/util/md5.h>
-#include <freeradius-devel/server/rad_assert.h>
+#include <freeradius-devel/util/misc.h>
+#include <freeradius-devel/util/rand.h>
/** Holds a state value, and associated VALUE_PAIRs and data
*
/*
* Assume our own State first.
- */
+ */
if (vb->vb_length == sizeof(my_entry.state)) {
memcpy(my_entry.state, vb->vb_octets, sizeof(my_entry.state));
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/rad_assert.h>
+#include <freeradius-devel/util/misc.h>
+
+#include <freeradius-devel/radius/defs.h>
+#include <freeradius-devel/attributes.h>
+
#ifdef WITH_STATS
#define USEC (1000000)
*/
RCSIDH(sysutmp_h, "$Id$")
+#include <freeradius-devel/autoconf.h>
+
/*
* If we have BOTH utmp.h and utmpx.h, then
* we prefer to use utmp.h, but only on systems other than Solaris.
#ifdef HAVE_UTMPX_H
# include <utmpx.h>
# include <sys/fcntl.h>
-# define utmp utmpx
+# define USE_UTMPX 1
# define UT_NAMESIZE 32
# define UT_LINESIZE 32
# define UT_HOSTSIZE 257
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/rad_assert.h>
+#include <freeradius-devel/util/misc.h>
+
#include <ctype.h>
/** Map #tmpl_type_t values to descriptive strings
#include <freeradius-devel/server/cf_parse.h>
#include <freeradius-devel/server/rad_assert.h>
+#include <freeradius-devel/attributes.h>
+
static CONF_SECTION const *trigger_exec_main, *trigger_exec_subcs;
static rbtree_t *trigger_last_fired_tree;
static pthread_mutex_t *trigger_mutex;
#include <freeradius-devel/server/rad_assert.h>
#include <freeradius-devel/server/users_file.h>
+#include <freeradius-devel/util/syserror.h>
+
#include <sys/stat.h>
#include <ctype.h>
#include <freeradius-devel/server/stats.h>
#include <freeradius-devel/server/util.h>
-#include <ctype.h>
+#include <freeradius-devel/util/misc.h>
-#include <sys/stat.h>
+#include <ctype.h>
#include <fcntl.h>
+#include <signal.h>
+#include <sys/stat.h>
static bool suid_down_permanent = false; //!< Record whether we've permanently dropped privilledges
RCSID("$Id$")
#include <freeradius-devel/server/base.h>
+#include <freeradius-devel/server/command.h>
+#include <freeradius-devel/server/dl.h>
#include <freeradius-devel/server/modpriv.h>
-#include <freeradius-devel/unlang/base.h>
#include <freeradius-devel/server/parser.h>
#include <freeradius-devel/server/protocol.h>
-#include <freeradius-devel/io/listen.h>
-#include <freeradius-devel/server/dl.h>
-#include <freeradius-devel/server/command.h>
+
#include <freeradius-devel/io/application.h>
+#include <freeradius-devel/io/listen.h>
+
+#include <freeradius-devel/unlang/base.h>
+
+#include <freeradius-devel/attributes.h>
/*
* Ordered by component
/*
* 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.
typedef struct xlat_thread_inst xlat_thread_inst_t;
typedef struct xlat_exp xlat_exp_t;
-#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/cf_util.h>
+#include <freeradius-devel/server/request.h>
#include <freeradius-devel/server/signal.h>
+
#include <freeradius-devel/util/cursor.h>
#include <freeradius-devel/util/pair.h>
#include <freeradius-devel/util/value.h>
-
/** Instance data for an xlat expansion node
*
*/
#include <freeradius-devel/server/rad_assert.h>
#include <freeradius-devel/server/regex.h>
#include <freeradius-devel/server/request.h>
+
#include <freeradius-devel/unlang/base.h>
+#include <freeradius-devel/attributes.h>
+
#include <ctype.h>
#include "xlat_priv.h"
#include <freeradius-devel/server/parser.h>
#include <freeradius-devel/server/rad_assert.h>
#include <freeradius-devel/server/regex.h>
+
#include <freeradius-devel/util/base64.h>
#include <freeradius-devel/util/md5.h>
+#include <freeradius-devel/util/misc.h>
+#include <freeradius-devel/util/rand.h>
#include <freeradius-devel/util/sha1.h>
#include <freeradius-devel/util/value.h>
+
#ifdef HAVE_OPENSSL_EVP_H
# include <openssl/evp.h>
#endif
#ifdef WITH_TLS
#define LOG_PREFIX "tls - "
+#include <freeradius-devel/util/misc.h>
+#include <freeradius-devel/util/syserror.h>
+#include <freeradius-devel/server/rad_assert.h>
+
#include <openssl/rand.h>
#include <openssl/dh.h>
-#include <freeradius-devel/server/base.h>
-#include <freeradius-devel/server/rad_assert.h>
#include "base.h"
#if OPENSSL_VERSION_NUMBER >= 0x0090800fL
#ifdef HAVE_OPENSSL_OCSP_H
#define LOG_PREFIX "tls - ocsp - "
-#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/modules.h>
#include <freeradius-devel/server/rad_assert.h>
+
+#include <freeradius-devel/util/misc.h>
+
#include <openssl/ocsp.h>
+
#include "base.h"
#include "tls_attrs.h"
#ifdef HAVE_OPENSSL_OCSP_H
#define LOG_PREFIX "tls - "
-#include <ctype.h>
-#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/rad_assert.h>
+#include <freeradius-devel/server/pair.h>
+
+#include <freeradius-devel/util/misc.h>
+#include <freeradius-devel/attributes.h>
+
#include <openssl/x509v3.h>
+#include <ctype.h>
+
#include "base.h"
#include "tls_attrs.h"
#ifdef WITH_TLS
#define LOG_PREFIX "tls - "
-#include <freeradius-devel/server/base.h>
+#include <freeradius-devel/server/exec.h>
+#include <freeradius-devel/server/pair.h>
#include <freeradius-devel/server/rad_assert.h>
+
+#include <freeradius-devel/util/strerror.h>
+#include <freeradius-devel/util/syserror.h>
+
#include "base.h"
#include "tls_attrs.h"
*/
RCSID("$Id$")
-#include <freeradius-devel/io/listen.h>
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/cond_eval.h>
#include <freeradius-devel/server/modpriv.h>
#include <freeradius-devel/server/parser.h>
#include <freeradius-devel/server/xlat.h>
+
+#include <freeradius-devel/io/listen.h>
+
#include <freeradius-devel/util/dlist.h>
+#include <freeradius-devel/util/rand.h>
#include "unlang_priv.h"
RCSID("$Id$")
#include <freeradius-devel/util/md5.h>
+#include <freeradius-devel/util/thread_local.h>
#ifdef HAVE_OPENSSL_EVP_H
# include <freeradius-devel/tls/base.h>
RCSID("$Id$")
#include <freeradius-devel/util/sha1.h>
+#include <freeradius-devel/util/thread_local.h>
#ifdef HMAC_SHA1_DATA_PROBLEMS
unsigned int sha1_data_problems = 0;
+#pragma once
/*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
*/
RCSIDH(rand_h, "$Id$")
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include <freeradius-devel/build.h>
#include <freeradius-devel/missing.h>
#include <stddef.h>
#include <stdint.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* random numbers in isaac.c */
/* context of random number generator */
typedef struct fr_randctx {
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 <freeradius-devel/build.h>
#include <freeradius-devel/missing.h>
#include <freeradius-devel/util/debug.h>
+#include <freeradius-devel/util/dict.h>
#include <freeradius-devel/util/inet.h>
#include <freeradius-devel/util/log.h>
#include <freeradius-devel/util/strerror.h>
+#include <freeradius-devel/util/token.h>
#include <freeradius-devel/util/types.h>
-/*
- * Avoid circular type references.
- */
-typedef struct value_box fr_value_box_t;
-
-#include <freeradius-devel/util/dict.h>
+#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)
)(_var, _box)
/* @} **/
-
/*
* Allocation - init/alloc use static functions (above)
*/
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
*/
#include <freeradius-devel/server/base.h>
-#include <freeradius-devel/server/protocol.h>
#include <freeradius-devel/server/modules.h>
-#include <freeradius-devel/unlang/base.h>
+#include <freeradius-devel/server/protocol.h>
#include <freeradius-devel/server/rad_assert.h>
+
+#include <freeradius-devel/unlang/base.h>
+
#include <freeradius-devel/util/event.h>
#include <freeradius-devel/util/md5.h>
+#include <freeradius-devel/util/misc.h>
+#include <freeradius-devel/util/rand.h>
#include <freeradius-devel/util/sha1.h>
+#include <freeradius-devel/util/socket.h>
#define USEC (1000000)
#define BFD_MAX_SECRET_LENGTH 20
.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,
#define LOG_PREFIX "radmin - "
#include <freeradius-devel/server/base.h>
-#include <freeradius-devel/util/md5.h>
#include <freeradius-devel/server/cf_parse.h>
#include <freeradius-devel/server/radmin.h>
+
+#include <freeradius-devel/util/conf.h>
+#include <freeradius-devel/util/dict.h>
+#include <freeradius-devel/util/dict.h>
+#include <freeradius-devel/util/md5.h>
+#include <freeradius-devel/util/misc.h>
+#include <freeradius-devel/util/socket.h>
+
+
#include "conduit.h"
/*
* @copyright 2017 The FreeRADIUS server project.
* @copyright 2017 Alan DeKok (aland@deployingradius.com)
*/
-#include <netdb.h>
-#include <freeradius-devel/server/base.h>
-#include <freeradius-devel/server/protocol.h>
-#include <freeradius-devel/radius/radius.h>
-#include <freeradius-devel/io/base.h>
+
#include <freeradius-devel/io/application.h>
+#include <freeradius-devel/io/base.h>
#include <freeradius-devel/io/listen.h>
#include <freeradius-devel/io/schedule.h>
+
+#include <freeradius-devel/radius/radius.h>
+
+#include <freeradius-devel/server/base.h>
+#include <freeradius-devel/server/protocol.h>
#include <freeradius-devel/server/rad_assert.h>
+
+#include <freeradius-devel/util/misc.h>
+
#include "proto_detail.h"
+#include <netdb.h>
+
#include <fcntl.h>
#include <sys/stat.h>
#include <freeradius-devel/util/dict.h>
#include <freeradius-devel/server/state.h>
#include <freeradius-devel/server/rad_assert.h>
+#include <freeradius-devel/radius/radius.h>
+
#include "proto_detail.h"
static fr_dict_t *dict_freeradius;
.transports = TRANSPORT_UDP,
.tls = false,
- .load = dhcp_load,
+ .onload = dhcp_load,
.unload = dhcp_unload,
.compile = dhcp_listen_compile,
.parse = dhcp_socket_parse,
.config = proto_dhcpv4_config,
.inst_size = sizeof(proto_dhcpv4_t),
- .load = mod_load,
+ .onload = mod_load,
.unload = mod_unload,
.bootstrap = mod_bootstrap,
.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,
.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,
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),
.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,
.inst_size = sizeof(rlm_cache_memcached_t),
.config = driver_config,
- .load = mod_load,
+ .onload = mod_load,
.instantiate = mod_instantiate,
.free = cache_entry_free,
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,
.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 = {
.name = "dhcpv4",
.inst_size = sizeof(rlm_dhcpv4_t),
- .load = dhcp_load,
+ .onload = dhcp_load,
.unload = dhcp_unload,
.bootstrap = mod_bootstrap,
};
.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,
.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 */
.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,
.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 */
.magic = RLM_MODULE_INIT,
.name = "json",
.type = RLM_TYPE_THREAD_SAFE,
- .load = mod_load,
+ .onload = mod_load,
.bootstrap = mod_bootstrap,
};
.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,
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/modules.h>
#include <freeradius-devel/server/rad_assert.h>
+
+#include <freeradius-devel/util/md4.h>
#include <freeradius-devel/util/md5.h>
+#include <freeradius-devel/util/misc.h>
#include <freeradius-devel/util/sha1.h>
#include <ctype.h>
.thread_inst_size = sizeof(rlm_python_thread_t),
.config = module_config,
- .load = mod_load,
+ .onload = mod_load,
.unload = mod_unload,
.instantiate = mod_instantiate,
.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),
.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,
};
.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,
.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 = {
.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,
.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 = {
.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,
.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,
.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,
.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,
#define LOG_PREFIX_ARGS inst->name
#include <freeradius-devel/server/base.h>
+#include <freeradius-devel/server/modules.h>
+#include <freeradius-devel/server/sysutmp.h>
#include <grp.h>
#include <pwd.h>
# include <shadow.h>
#endif
-#include<freeradius-devel/server/modules.h>
-#include <freeradius-devel/server/sysutmp.h>
-
static char trans[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
#define ENC(c) trans[c]
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
#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
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/util/udp.h>
+#include <freeradius-devel/vqp.h>
#include "vqp.h"