2 * version.c Print version number and exit.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 * Copyright 1999-2014 The FreeRADIUS server project
21 * Copyright 2012 Alan DeKok <aland@ox.org>
22 * Copyright 2000 Chris Parker <cparker@starnetusa.com>
27 #include <freeradius-devel/radiusd.h>
28 USES_APPLE_DEPRECATED_API /* OpenSSL API has been deprecated by Apple */
30 static uint64_t libmagic = RADIUSD_MAGIC_NUMBER;
32 #ifdef HAVE_OPENSSL_CRYPTO_H
33 # include <openssl/crypto.h>
34 # include <openssl/opensslv.h>
36 static long ssl_built = OPENSSL_VERSION_NUMBER;
38 /** Check build and linked versions of OpenSSL match
40 * Startup check for whether the linked version of OpenSSL matches the
41 * version the server was built against.
43 * @return 0 if ok, else -1
45 int ssl_check_version(void)
49 ssl_linked = SSLeay();
51 if (ssl_linked != ssl_built) {
52 ERROR("libssl version mismatch."
53 " Built with: %lx Linked: %lx",
54 (unsigned long) ssl_built,
55 (unsigned long) ssl_linked);
63 /** Print the current linked version of Openssl
65 * Print the currently linked version of the OpenSSL library.
67 char const *ssl_version(void)
69 return SSLeay_version(SSLEAY_VERSION);
72 int ssl_check_version(void) {
76 char const *ssl_version()
80 #endif /* ifdef HAVE_OPENSSL_CRYPTO_H */
83 /** Check if the application linking to the library has the correct magic number
85 * @param magic number as defined by RADIUSD_MAGIC_NUMBER
86 * @returns 0 on success, -1 on prefix mismatch, -2 on version mismatch -3 on commit mismatch.
88 int rad_check_lib_magic(uint64_t magic)
90 if (MAGIC_PREFIX(magic) != MAGIC_PREFIX(libmagic)) {
91 ERROR("Application and libfreeradius-server magic number (prefix) mismatch."
92 " application: %x library: %x",
93 MAGIC_PREFIX(magic), MAGIC_PREFIX(libmagic));
97 if (MAGIC_VERSION(magic) != MAGIC_VERSION(libmagic)) {
98 ERROR("Application and libfreeradius-server magic number (version) mismatch."
99 " application: %lx library: %lx",
100 (unsigned long) MAGIC_VERSION(magic), (unsigned long) MAGIC_VERSION(libmagic));
104 if (MAGIC_COMMIT(magic) != MAGIC_COMMIT(libmagic)) {
105 ERROR("Application and libfreeradius-server magic number (commit) mismatch."
106 " application: %lx library: %lx",
107 (unsigned long) MAGIC_COMMIT(magic), (unsigned long) MAGIC_COMMIT(libmagic));
115 * Display the revision number for this program
119 INFO("%s: %s", progname, radiusd_version);
121 DEBUG3("Server was built with: ");
123 #ifdef WITH_ACCOUNTING
124 DEBUG3(" accounting");
126 DEBUG3(" authentication"); /* always enabled */
128 #ifdef WITH_ASCEND_BINARY
129 DEBUG3(" ascend binary attributes");
134 #ifdef WITH_COMMAND_SOCKET
135 DEBUG3(" control-socket");
143 #ifdef WITH_DYNAMIC_CLIENTS
144 DEBUG3(" dynamic clients");
152 #ifdef HAVE_PCREPOSIX_H
153 DEBUG3(" regex-pcre");
156 DEBUG3(" regex-posix");
160 #ifdef WITH_SESSION_MGMT
161 DEBUG3(" session-management");
182 DEBUG3("Server core libs:");
183 DEBUG3(" talloc : %i.%i.*", talloc_version_major(), talloc_version_minor());
184 DEBUG3(" ssl : %s", ssl_version());
186 DEBUG3("Library magic number:");
187 DEBUG3(" 0x%llx", (unsigned long long) libmagic);
189 INFO("Copyright (C) 1999-2014 The FreeRADIUS server project and contributors");
190 INFO("There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A");
191 INFO("PARTICULAR PURPOSE");
192 INFO("You may redistribute copies of FreeRADIUS under the terms of the");
193 INFO("GNU General Public License");
194 INFO("For more information about these matters, see the file named COPYRIGHT");