27RCSID(
"$Id: f3b7c61a1d866136f5bb9fe819b2c00a82ed1e54 $")
29#include <freeradius-devel/util/regex.h>
30#include <freeradius-devel/util/syserror.h>
32#include <freeradius-devel/server/cf_util.h>
33#include <freeradius-devel/server/dependency.h>
34#include <freeradius-devel/server/log.h>
44#include <freeradius-devel/tls/openssl_user_macros.h>
47# include <freeradius-devel/tls/version.h>
48# include <openssl/crypto.h>
49# include <openssl/opensslv.h>
50# include <openssl/engine.h>
53#ifdef HAVE_GPERFTOOLS_PROFILER_H
54# include <gperftools/profiler.h>
73 ERROR(
"Application and libfreeradius-server magic number (prefix) mismatch."
74 " application: %x library: %x",
80 ERROR(
"Application and libfreeradius-server magic number (version) mismatch."
81 " application: %lx library: %lx",
87 ERROR(
"Application and libfreeradius-server magic number (commit) mismatch."
88 " application: %lx library: %lx",
116 if (!
fr_cond_assert_msg(cs,
"dependency_features_init() must be called before calling %s", __FUNCTION__)) {
157 if (!
fr_cond_assert_msg(cs,
"dependency_version_numbers_init() must be called before calling %s", __FUNCTION__)) {
188#ifdef HAVE_CAPABILITY_H
196#ifdef HAVE_REGEX_PCRE
204#ifdef HAVE_REGEX_PCRE2
211#ifdef HAVE_REGEX_POSIX
214# ifdef HAVE_REG_EXTENDED
226#
if defined(HAVE_REGNEXEC) || defined(HAVE_REGEX_PCRE) || defined(HAVE_REGEX_PCRE2)
274#ifdef __SANITIZE_ADDRESS__
281#ifdef HAVE_SANITIZER_COMMON_INTERFACE_DEFS_H
288#ifdef HAVE_GPERFTOOLS_PROFILER_H
290 struct ProfilerState state;
292 ProfilerGetCurrentState(&state);
301#ifdef HAVE_VALGRIND_H
314#ifdef EVFILT_LIBKQUEUE
315static void dependency_libqueue_version(
CONF_SECTION *cs)
318 struct kevent kev, receipt;
327 EV_SET(&kev, 0, EVFILT_LIBKQUEUE, EV_ADD, NOTE_VERSION_STR, 0, NULL);
328 ret = kevent(kqfd, &kev, 1, &receipt, 1, &(
struct timespec){});
330 if (ret != 1)
goto kqueue_error;
357# ifdef HAVE_REGEX_PCRE2
360# elif defined(HAVE_REGEX_PCRE)
365#ifdef EVFILT_LIBKQUEUE
366 dependency_libqueue_version(cs);
390 DEBUG2(
"Server was built with:");
396 if (max < len) max = len;
403 if (max < len) max = len;
414 DEBUG2(
" %s%.*s : %s", attr,
418 DEBUG2(
"Server core libs:");
428 DEBUG2(
" %s%.*s : %s", attr,
436#ifdef WORDS_BIGENDIAN
442 DEBUG2(
"Compilation flags:");
443#ifdef BUILT_WITH_CPPFLAGS
444 DEBUG2(
" cppflags : " BUILT_WITH_CPPFLAGS);
446#ifdef BUILT_WITH_CFLAGS
447 DEBUG2(
" cflags : " BUILT_WITH_CFLAGS);
449#ifdef BUILT_WITH_LDFLAGS
450 DEBUG2(
" ldflags : " BUILT_WITH_LDFLAGS);
452#ifdef BUILT_WITH_LIBS
453 DEBUG2(
" libs : " BUILT_WITH_LIBS);
457 INFO(
"Copyright 1999-2024 The FreeRADIUS server project and contributors");
458 INFO(
"There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A");
459 INFO(
"PARTICULAR PURPOSE");
460 INFO(
"You may redistribute copies of FreeRADIUS under the terms of the");
461 INFO(
"GNU General Public License");
462 INFO(
"For more information about these matters, see the file named COPYRIGHT");
static int const char char buffer[256]
#define USES_APPLE_DEPRECATED_API
Common header for all CONF_* types.
Configuration AVP similar to a fr_pair_t.
A section grouping multiple CONF_PAIR.
CONF_PAIR * cf_pair_alloc(CONF_SECTION *parent, char const *attr, char const *value, fr_token_t op, fr_token_t lhs_quote, fr_token_t rhs_quote)
Allocate a CONF_PAIR.
CONF_PAIR * cf_pair_find(CONF_SECTION const *cs, char const *attr)
Search for a CONF_PAIR with a specific name.
CONF_PAIR * cf_item_to_pair(CONF_ITEM const *ci)
Cast a CONF_ITEM to a CONF_PAIR.
char const * cf_pair_value(CONF_PAIR const *pair)
Return the value of a CONF_PAIR.
int cf_pair_replace(CONF_SECTION *cs, CONF_PAIR *cp, char const *value)
Replace pair in a given section with a new pair, of the given value.
char const * cf_pair_attr(CONF_PAIR const *pair)
Return the attr of a CONF_PAIR.
#define cf_item_next(_parent, _curr)
#define cf_section_alloc(_ctx, _parent, _name1, _name2)
int fr_get_lsan_state(void)
int fr_get_debug_state(void)
#define fr_cond_assert_msg(_x, _fmt,...)
Calls panic_action ifndef NDEBUG, else logs error and evaluates to value of _x.
void dependency_version_print(void)
void dependency_features_init(CONF_SECTION *cs)
Initialise core feature flags.
int rad_check_lib_magic(uint64_t magic)
Check if the application linking to the library has the correct magic number.
static USES_APPLE_DEPRECATED_API uint64_t libmagic
char const * radiusd_version_short
void dependency_version_numbers_init(CONF_SECTION *cs)
Initialise core version flags.
int dependency_feature_add(CONF_SECTION *cs, char const *name, bool enabled)
Add a feature flag to the main configuration.
int dependency_version_number_add(CONF_SECTION *cs, char const *name, char const *version)
Add a library/server version pair to the main configuration.
static CONF_SECTION * default_feature_cs
Default configuration section to add features to.
static char const * spaces
static CONF_SECTION * default_version_cs
Default configuration section to add features to.
#define RUNNING_ON_VALGRIND
#define DEBUG_ENABLED3
True if global debug level 1-3 messages are enabled.
PUBLIC int snprintf(char *string, size_t length, char *format, va_alist)
char const * fr_syserror(int num)
Guaranteed to be thread-safe version of strerror.
char const * fr_openssl_version_basic(void)
#define MAGIC_VERSION(_x)
#define RADIUSD_MAGIC_NUMBER