25 RCSID(
"$Id: 8d7cf68f92c9bd689dfe86ae087a491cf9f13793 $")
27 #include <freeradius-devel/radiusd.h>
33 #ifdef HAVE_OPENSSL_CRYPTO_H
34 # include <openssl/crypto.h>
35 # include <openssl/opensslv.h>
36 # include <openssl/engine.h>
38 static long ssl_built = OPENSSL_VERSION_NUMBER;
58 ssl_linked = SSLeay();
63 if ((ssl_linked & 0x0000000f) != (ssl_built & 0x0000000f)) {
65 ERROR(
"libssl version mismatch. built: %lx linked: %lx",
66 (
unsigned long) ssl_built,
67 (
unsigned long) ssl_linked);
77 if (ssl_built & 0xf0000000) {
78 if ((ssl_built & 0xfffff000) != (ssl_linked & 0xfffff000) ||
79 (ssl_built & 0x00000ff0) > (ssl_linked & 0x00000ff0))
goto mismatch;
84 }
else if ((ssl_built & 0xfffff000) != (ssl_linked & 0xfffff000))
goto mismatch;
99 static char buffer[18];
102 p += sprintf(p,
"%u.%u.%u",
103 (0xf0000000 & v) >> 28,
104 (0x0ff00000 & v) >> 20,
105 (0x000ff000 & v) >> 12);
107 if ((0x00000ff0 & v) >> 4) {
108 *p++ = (char) (0x60 + ((0x00000ff0 & v) >> 4));
116 if ((0x0000000f & v) == 0) {
121 }
else if ((0x0000000f & v) <= 14) {
122 sprintf(p,
"beta %u", 0x0000000f & v);
124 strcpy(p,
"release");
138 ssl_linked = SSLeay();
153 static char buffer[28];
157 p +=
strlcpy(p,
" - ",
sizeof(buffer) - (p - buffer));
172 static char buffer[256];
174 uint32_t v = SSLeay();
176 snprintf(buffer,
sizeof(buffer),
"%s 0x%.8x (%s)",
177 SSLeay_version(SSLEAY_VERSION),
211 ERROR(
"Application and libfreeradius-server magic number (prefix) mismatch."
212 " application: %x library: %x",
218 ERROR(
"Application and libfreeradius-server magic number (version) mismatch."
219 " application: %lx library: %lx",
225 ERROR(
"Application and libfreeradius-server magic number (commit) mismatch."
226 " application: %lx library: %lx",
299 WARN(
"Replacing user version.%s (%s) with %s", name,
cf_pair_value(old), version);
316 #ifdef WITH_ACCOUNTING
326 #ifdef WITH_ASCEND_BINARY
343 #ifdef WITH_COMMAND_SOCKET
368 #ifdef WITH_DYNAMIC_CLIENTS
399 #if !defined(HAVE_PCRE) && defined(HAVE_REGEX)
402 # ifdef HAVE_REG_EXTENDED
414 #ifdef WITH_SESSION_MGMT
497 snprintf(buffer,
sizeof(buffer),
"%i.%i.*", talloc_version_major(), talloc_version_minor());
502 #if defined(HAVE_REGEX) && defined(HAVE_PCRE)
521 char const *engine_id;
531 DEBUG2(
"Server was built with: ");
537 if (max < len) max = len;
544 if (max < len) max = len;
548 for (engine = ENGINE_get_first();
550 engine = ENGINE_get_next(engine)) {
551 len = strlen(ENGINE_get_id(engine) + 1);
552 if (max < len) max = len;
564 DEBUG2(
" %s%.*s : %s", attr,
565 (
int)(max - talloc_array_length(attr)), spaces,
cf_pair_value(cp));
568 talloc_free(features);
570 DEBUG2(
"Server core libs:");
580 DEBUG2(
" %s%.*s : %s", attr,
581 (
int)(max - talloc_array_length(attr)), spaces,
cf_pair_value(cp));
585 DEBUG3(
"OpenSSL engines:");
586 for (engine = ENGINE_get_first();
588 engine = ENGINE_get_next(engine)) {
589 engine_id = ENGINE_get_id(engine);
591 DEBUG3(
" %s%.*s : %s", engine_id, (
int)(max - (strlen(engine_id) + 1)), spaces,
592 ENGINE_get_name(engine));
596 talloc_free(versions);
599 #ifdef WORDS_BIGENDIAN
605 DEBUG2(
"Compilation flags:");
606 #ifdef BUILT_WITH_CPPFLAGS
607 DEBUG2(
" cppflags : " BUILT_WITH_CPPFLAGS);
609 #ifdef BUILT_WITH_CFLAGS
610 DEBUG2(
" cflags : " BUILT_WITH_CFLAGS);
612 #ifdef BUILT_WITH_LDFLAGS
613 DEBUG2(
" ldflags : " BUILT_WITH_LDFLAGS);
615 #ifdef BUILT_WITH_LIBS
616 DEBUG2(
" libs : " BUILT_WITH_LIBS);
620 INFO(
"Copyright (C) 1999-2015 The FreeRADIUS server project and contributors");
621 INFO(
"There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A");
622 INFO(
"PARTICULAR PURPOSE");
623 INFO(
"You may redistribute copies of FreeRADIUS under the terms of the");
624 INFO(
"GNU General Public License");
625 INFO(
"For more information about these matters, see the file named COPYRIGHT");
static char const * spaces
int ssl_check_consistency(void)
int rad_check_lib_magic(uint64_t magic)
Check if the application linking to the library has the correct magic number.
void cf_pair_add(CONF_SECTION *parent, CONF_PAIR *cp)
Add a configuration pair to a section.
PUBLIC int snprintf(char *string, size_t length, char *format, va_alist)
char const * ssl_version_by_num(uint32_t version)
CONF_PAIR * cf_pair_find(CONF_SECTION const *, char const *name)
char const * cf_pair_value(CONF_PAIR const *pair)
int version_add_number(CONF_SECTION *cs, char const *name, char const *version)
Add a library/server version pair to the main configuration.
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)
char const * ssl_version_range(uint32_t low, uint32_t high)
static USES_APPLE_DEPRECATED_API uint64_t libmagic
char const * radiusd_version_short
char const * ssl_version()
CONF_PAIR * cf_item_to_pair(CONF_ITEM const *item)
Cast a CONF_ITEM to a CONF_PAIR.
Configuration AVP similar to a VALUE_PAIR.
CONF_PAIR * cf_pair_alloc(CONF_SECTION *parent, char const *attr, char const *value, FR_TOKEN op, FR_TOKEN lhs_type, FR_TOKEN rhs_type)
Allocate a CONF_PAIR.
char const * ssl_version_num(void)
void version_init_numbers(CONF_SECTION *cs)
Initialise core version flags.
int version_add_feature(CONF_SECTION *cs, char const *name, bool enabled)
Add a feature flag to the main configuration.
CONF_SECTION * cf_section_alloc(CONF_SECTION *parent, char const *name1, char const *name2)
Allocate a CONF_SECTION.
CONF_ITEM * cf_item_find_next(CONF_SECTION const *section, CONF_ITEM const *item)
Return the next item after a CONF_ITEM.
void version_init_features(CONF_SECTION *cs)
Initialise core feature flags.
size_t strlcpy(char *dst, char const *src, size_t siz)
#define USES_APPLE_DEPRECATED_API
#define MAGIC_VERSION(_x)
#define RADIUSD_MAGIC_NUMBER
#define DEBUG_ENABLED2
True if global debug level 1-2 messages are enabled.