27 RCSID(
"$Id: 2c9af55db2d575a91d8388066c875be03ab530a9 $")
29 #include <freeradius-devel/server/base.h>
38 #include <freeradius-devel/tls/openssl_user_macros.h>
41 # include <freeradius-devel/tls/version.h>
42 # include <openssl/crypto.h>
43 # include <openssl/opensslv.h>
44 # include <openssl/engine.h>
47 #ifdef HAVE_GPERFTOOLS_PROFILER_H
48 # include <gperftools/profiler.h>
51 #ifdef HAVE_VALGRIND_H
52 # include <valgrind.h>
67 ERROR(
"Application and libfreeradius-server magic number (prefix) mismatch."
68 " application: %x library: %x",
74 ERROR(
"Application and libfreeradius-server magic number (version) mismatch."
75 " application: %lx library: %lx",
81 ERROR(
"Application and libfreeradius-server magic number (commit) mismatch."
82 " application: %lx library: %lx",
110 if (!
fr_cond_assert_msg(cs,
"dependency_features_init() must be called before calling %s", __FUNCTION__)) {
151 if (!
fr_cond_assert_msg(cs,
"dependency_version_numbers_init() must be called before calling %s", __FUNCTION__)) {
182 #ifdef HAVE_CAPABILITY_H
190 #ifdef HAVE_REGEX_PCRE
198 #ifdef HAVE_REGEX_PCRE2
205 #ifdef HAVE_REGEX_POSIX
208 # ifdef HAVE_REG_EXTENDED
220 #
if defined(HAVE_REGNEXEC) || defined(HAVE_REGEX_PCRE) || defined(HAVE_REGEX_PCRE2)
268 #ifdef __SANITIZE_ADDRESS__
275 #ifdef HAVE_SANITIZER_COMMON_INTERFACE_DEFS_H
282 #ifdef HAVE_GPERFTOOLS_PROFILER_H
284 struct ProfilerState state;
286 ProfilerGetCurrentState(&state);
295 #ifdef HAVE_VALGRIND_H
308 #ifdef EVFILT_LIBKQUEUE
309 static void dependency_libqueue_version(
CONF_SECTION *cs)
312 struct kevent kev, receipt;
321 EV_SET(&kev, 0, EVFILT_LIBKQUEUE, EV_ADD, NOTE_VERSION_STR, 0, NULL);
322 ret = kevent(kqfd, &kev, 1, &receipt, 1, &(
struct timespec){});
324 if (ret != 1)
goto kqueue_error;
351 # ifdef HAVE_REGEX_PCRE2
354 # elif defined(HAVE_REGEX_PCRE)
359 #ifdef EVFILT_LIBKQUEUE
360 dependency_libqueue_version(cs);
376 #if defined(WITH_TLS) && (OPENSSL_VERSION_NUMBER < 0x30000000L)
378 char const *engine_id;
388 DEBUG2(
"Server was built with:");
394 if (max < len) max = len;
401 if (max < len) max = len;
404 #if defined(WITH_TLS) && (OPENSSL_VERSION_NUMBER < 0x30000000L)
405 for (engine = ENGINE_get_first();
407 engine = ENGINE_get_next(engine)) {
408 len = strlen(ENGINE_get_id(engine) + 1);
409 if (max < len) max = len;
421 DEBUG2(
" %s%.*s : %s", attr,
425 DEBUG2(
"Server core libs:");
435 DEBUG2(
" %s%.*s : %s", attr,
442 #if defined(WITH_TLS) && (OPENSSL_VERSION_NUMBER < 0x30000000L)
443 DEBUG3(
"OpenSSL engines:");
444 for (engine = ENGINE_get_first();
446 engine = ENGINE_get_next(engine)) {
447 engine_id = ENGINE_get_id(engine);
449 DEBUG3(
" %s%.*s : %s", engine_id, (
int)(max - (strlen(engine_id) + 1)),
spaces,
450 ENGINE_get_name(engine));
455 #ifdef WORDS_BIGENDIAN
461 DEBUG2(
"Compilation flags:");
462 #ifdef BUILT_WITH_CPPFLAGS
463 DEBUG2(
" cppflags : " BUILT_WITH_CPPFLAGS);
465 #ifdef BUILT_WITH_CFLAGS
466 DEBUG2(
" cflags : " BUILT_WITH_CFLAGS);
468 #ifdef BUILT_WITH_LDFLAGS
469 DEBUG2(
" ldflags : " BUILT_WITH_LDFLAGS);
471 #ifdef BUILT_WITH_LIBS
472 DEBUG2(
" libs : " BUILT_WITH_LIBS);
476 INFO(
"Copyright 1999-2024 The FreeRADIUS server project and contributors");
477 INFO(
"There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A");
478 INFO(
"PARTICULAR PURPOSE");
479 INFO(
"You may redistribute copies of FreeRADIUS under the terms of the");
480 INFO(
"GNU General Public License");
481 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_item_to_pair(CONF_ITEM const *ci)
Cast a CONF_ITEM to a CONF_PAIR.
char const * cf_pair_attr(CONF_PAIR const *pair)
Return the attr of a CONF_PAIR.
CONF_PAIR * cf_pair_find(CONF_SECTION const *cs, char const *attr)
Search for a CONF_PAIR with a specific name.
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.
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.
#define cf_item_next(_ci, _prev)
#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)
MEM(pair_append_request(&vp, attr_eap_aka_sim_identity) >=0)
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