27RCSID(
"$Id: 8cdba7d2338bc569a75e1eb5576ef079974157c7 $")
29#include <freeradius-devel/util/regex.h>
30#include <freeradius-devel/util/syserror.h>
31#include <freeradius-devel/util/version.h>
33#include <freeradius-devel/server/cf_util.h>
34#include <freeradius-devel/server/dependency.h>
35#include <freeradius-devel/server/log.h>
45#include <freeradius-devel/tls/openssl_user_macros.h>
48# include <freeradius-devel/tls/version.h>
49# include <openssl/crypto.h>
50# include <openssl/opensslv.h>
51# include <openssl/engine.h>
54#ifdef HAVE_GPERFTOOLS_PROFILER_H
55# include <gperftools/profiler.h>
74 ERROR(
"Application and libfreeradius-server magic number (prefix) mismatch."
75 " application: %x library: %x",
81 ERROR(
"Application and libfreeradius-server magic number (version) mismatch."
82 " application: %lx library: %lx",
88 ERROR(
"Application and libfreeradius-server magic number (commit) mismatch."
89 " application: %lx library: %lx",
117 if (!
fr_cond_assert_msg(cs,
"dependency_features_init() must be called before calling %s", __FUNCTION__)) {
158 if (!
fr_cond_assert_msg(cs,
"dependency_version_numbers_init() must be called before calling %s", __FUNCTION__)) {
189#ifdef HAVE_CAPABILITY_H
197#ifdef HAVE_REGEX_PCRE
205#ifdef HAVE_REGEX_PCRE2
212#ifdef HAVE_REGEX_POSIX
215# ifdef HAVE_REG_EXTENDED
227#
if defined(HAVE_REGNEXEC) || defined(HAVE_REGEX_PCRE) || defined(HAVE_REGEX_PCRE2)
275#ifdef __SANITIZE_ADDRESS__
282#ifdef HAVE_SANITIZER_COMMON_INTERFACE_DEFS_H
289#ifdef HAVE_GPERFTOOLS_PROFILER_H
291 struct ProfilerState state;
293 ProfilerGetCurrentState(&state);
302#ifdef HAVE_VALGRIND_H
315#ifdef EVFILT_LIBKQUEUE
316static void dependency_libqueue_version(
CONF_SECTION *cs)
319 struct kevent kev, receipt;
328 EV_SET(&kev, 0, EVFILT_LIBKQUEUE, EV_ADD, NOTE_VERSION_STR, 0, NULL);
329 ret = kevent(kqfd, &kev, 1, &receipt, 1, &(
struct timespec){});
331 if (ret != 1)
goto kqueue_error;
358# ifdef HAVE_REGEX_PCRE2
361# elif defined(HAVE_REGEX_PCRE)
366#ifdef EVFILT_LIBKQUEUE
367 dependency_libqueue_version(cs);
391 DEBUG2(
"Server was built with:");
397 if (max < len) max = len;
404 if (max < len) max = len;
415 DEBUG2(
" %s%.*s : %s", attr,
419 DEBUG2(
"Server core libs:");
429 DEBUG2(
" %s%.*s : %s", attr,
437#ifdef WORDS_BIGENDIAN
443 DEBUG2(
"Compilation flags:");
444#ifdef BUILT_WITH_CPPFLAGS
445 DEBUG2(
" cppflags : " BUILT_WITH_CPPFLAGS);
447#ifdef BUILT_WITH_CFLAGS
448 DEBUG2(
" cflags : " BUILT_WITH_CFLAGS);
450#ifdef BUILT_WITH_LDFLAGS
451 DEBUG2(
" ldflags : " BUILT_WITH_LDFLAGS);
453#ifdef BUILT_WITH_LIBS
454 DEBUG2(
" libs : " BUILT_WITH_LIBS);
458 INFO(
"Copyright 1999-2024 The FreeRADIUS server project and contributors");
459 INFO(
"There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A");
460 INFO(
"PARTICULAR PURPOSE");
461 INFO(
"You may redistribute copies of FreeRADIUS under the terms of the");
462 INFO(
"GNU General Public License");
463 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_section_alloc(_ctx, _parent, _name1, _name2)
#define cf_item_next(_ci, _curr)
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