mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 18:55:19 +00:00 
			
		
		
		
	cdr_radius, cel_radius: build agains libfreeradius-client
Asterisk's RADIUS module currently build against libradiusclient-ng, but this
project has been superseeded by libfreeradius-client. The API is 99% compatible
except that the header name has changed, the library name has changed, and
the configuration file location has changed.
(closes issue ASTERISK-22980)
Reported by: Jeremy Lainé
Patches:
     freeradius-client.patch uploaded by sharky (license 6561)
........
Merged revisions 406801 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 406802 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 406803 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406825 65c4cc65-6c06-0410-ace0-fbb531ad65f3
			
			
This commit is contained in:
		| @@ -41,7 +41,11 @@ | |||||||
|  |  | ||||||
| ASTERISK_FILE_VERSION(__FILE__, "$Revision$") | ASTERISK_FILE_VERSION(__FILE__, "$Revision$") | ||||||
|  |  | ||||||
|  | #ifdef FREERADIUS_CLIENT | ||||||
|  | #include <freeradius-client.h> | ||||||
|  | #else | ||||||
| #include <radiusclient-ng.h> | #include <radiusclient-ng.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #include "asterisk/channel.h" | #include "asterisk/channel.h" | ||||||
| #include "asterisk/cdr.h" | #include "asterisk/cdr.h" | ||||||
| @@ -87,7 +91,11 @@ static const char desc[] = "RADIUS CDR Backend"; | |||||||
| static const char name[] = "radius"; | static const char name[] = "radius"; | ||||||
| static const char cdr_config[] = "cdr.conf"; | static const char cdr_config[] = "cdr.conf"; | ||||||
|  |  | ||||||
|  | #ifdef FREERADIUS_CLIENT | ||||||
|  | static char radiuscfg[PATH_MAX] = "/etc/radiusclient/radiusclient.conf"; | ||||||
|  | #else | ||||||
| static char radiuscfg[PATH_MAX] = "/etc/radiusclient-ng/radiusclient.conf"; | static char radiuscfg[PATH_MAX] = "/etc/radiusclient-ng/radiusclient.conf"; | ||||||
|  | #endif | ||||||
|  |  | ||||||
| static struct ast_flags global_flags = { RADIUS_FLAG_USEGMTIME | RADIUS_FLAG_LOGUNIQUEID | RADIUS_FLAG_LOGUSERFIELD }; | static struct ast_flags global_flags = { RADIUS_FLAG_USEGMTIME | RADIUS_FLAG_LOGUNIQUEID | RADIUS_FLAG_LOGUSERFIELD }; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -35,7 +35,11 @@ | |||||||
|  |  | ||||||
| ASTERISK_FILE_VERSION(__FILE__, "$Rev$") | ASTERISK_FILE_VERSION(__FILE__, "$Rev$") | ||||||
|  |  | ||||||
|  | #ifdef FREERADIUS_CLIENT | ||||||
|  | #include <freeradius-client.h> | ||||||
|  | #else | ||||||
| #include <radiusclient-ng.h> | #include <radiusclient-ng.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #include "asterisk/channel.h" | #include "asterisk/channel.h" | ||||||
| #include "asterisk/cel.h" | #include "asterisk/cel.h" | ||||||
| @@ -79,7 +83,11 @@ enum { | |||||||
|  |  | ||||||
| static char *cel_config = "cel.conf"; | static char *cel_config = "cel.conf"; | ||||||
|  |  | ||||||
|  | #ifdef FREERADIUS_CLIENT | ||||||
|  | static char radiuscfg[PATH_MAX] = "/etc/radiusclient/radiusclient.conf"; | ||||||
|  | #else | ||||||
| static char radiuscfg[PATH_MAX] = "/etc/radiusclient-ng/radiusclient.conf"; | static char radiuscfg[PATH_MAX] = "/etc/radiusclient-ng/radiusclient.conf"; | ||||||
|  | #endif | ||||||
|  |  | ||||||
| static struct ast_flags global_flags = { RADIUS_FLAG_USEGMTIME | RADIUS_FLAG_LOGUNIQUEID | RADIUS_FLAG_LOGUSERFIELD }; | static struct ast_flags global_flags = { RADIUS_FLAG_USEGMTIME | RADIUS_FLAG_LOGUNIQUEID | RADIUS_FLAG_LOGUSERFIELD }; | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										114
									
								
								configure
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										114
									
								
								configure
									
									
									
									
										vendored
									
									
								
							| @@ -1,5 +1,5 @@ | |||||||
| #! /bin/sh | #! /bin/sh | ||||||
| # From configure.ac Revision: 403330 . | # From configure.ac Revision: 405130 . | ||||||
| # Guess values for system-dependent variables and create Makefiles. | # Guess values for system-dependent variables and create Makefiles. | ||||||
| # Generated by GNU Autoconf 2.69 for asterisk trunk. | # Generated by GNU Autoconf 2.69 for asterisk trunk. | ||||||
| # | # | ||||||
| @@ -27758,6 +27758,117 @@ fi | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | # Accept either RADIUS client library, their APIs are fully compatible, | ||||||
|  | # just different header filenames and different SONAMEs | ||||||
|  |  | ||||||
|  | if test "x${PBX_RADIUS}" != "x1" -a "${USE_RADIUS}" != "no"; then | ||||||
|  |    pbxlibdir="" | ||||||
|  |    # if --with-RADIUS=DIR has been specified, use it. | ||||||
|  |    if test "x${RADIUS_DIR}" != "x"; then | ||||||
|  |       if test -d ${RADIUS_DIR}/lib; then | ||||||
|  |          pbxlibdir="-L${RADIUS_DIR}/lib" | ||||||
|  |       else | ||||||
|  |          pbxlibdir="-L${RADIUS_DIR}" | ||||||
|  |       fi | ||||||
|  |    fi | ||||||
|  |    pbxfuncname="rc_read_config" | ||||||
|  |    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers | ||||||
|  |       AST_RADIUS_FOUND=yes | ||||||
|  |    else | ||||||
|  |       ast_ext_lib_check_save_CFLAGS="${CFLAGS}" | ||||||
|  |       CFLAGS="${CFLAGS} " | ||||||
|  |       as_ac_Lib=`$as_echo "ac_cv_lib_freeradius-client_${pbxfuncname}" | $as_tr_sh` | ||||||
|  | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lfreeradius-client" >&5 | ||||||
|  | $as_echo_n "checking for ${pbxfuncname} in -lfreeradius-client... " >&6; } | ||||||
|  | if eval \${$as_ac_Lib+:} false; then : | ||||||
|  |   $as_echo_n "(cached) " >&6 | ||||||
|  | else | ||||||
|  |   ac_check_lib_save_LIBS=$LIBS | ||||||
|  | LIBS="-lfreeradius-client ${pbxlibdir}  $LIBS" | ||||||
|  | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | ||||||
|  | /* end confdefs.h.  */ | ||||||
|  |  | ||||||
|  | /* Override any GCC internal prototype to avoid an error. | ||||||
|  |    Use char because int might match the return type of a GCC | ||||||
|  |    builtin and then its argument prototype would still apply.  */ | ||||||
|  | #ifdef __cplusplus | ||||||
|  | extern "C" | ||||||
|  | #endif | ||||||
|  | char ${pbxfuncname} (); | ||||||
|  | int | ||||||
|  | main () | ||||||
|  | { | ||||||
|  | return ${pbxfuncname} (); | ||||||
|  |   ; | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
|  | _ACEOF | ||||||
|  | if ac_fn_c_try_link "$LINENO"; then : | ||||||
|  |   eval "$as_ac_Lib=yes" | ||||||
|  | else | ||||||
|  |   eval "$as_ac_Lib=no" | ||||||
|  | fi | ||||||
|  | rm -f core conftest.err conftest.$ac_objext \ | ||||||
|  |     conftest$ac_exeext conftest.$ac_ext | ||||||
|  | LIBS=$ac_check_lib_save_LIBS | ||||||
|  | fi | ||||||
|  | eval ac_res=\$$as_ac_Lib | ||||||
|  | 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 | ||||||
|  | $as_echo "$ac_res" >&6; } | ||||||
|  | if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : | ||||||
|  |   AST_RADIUS_FOUND=yes | ||||||
|  | else | ||||||
|  |   AST_RADIUS_FOUND=no | ||||||
|  | fi | ||||||
|  |  | ||||||
|  |       CFLAGS="${ast_ext_lib_check_save_CFLAGS}" | ||||||
|  |    fi | ||||||
|  |  | ||||||
|  |    # now check for the header. | ||||||
|  |    if test "${AST_RADIUS_FOUND}" = "yes"; then | ||||||
|  |       RADIUS_LIB="${pbxlibdir} -lfreeradius-client " | ||||||
|  |       # if --with-RADIUS=DIR has been specified, use it. | ||||||
|  |       if test "x${RADIUS_DIR}" != "x"; then | ||||||
|  |          RADIUS_INCLUDE="-I${RADIUS_DIR}/include" | ||||||
|  |       fi | ||||||
|  |       RADIUS_INCLUDE="${RADIUS_INCLUDE} " | ||||||
|  |       if test "xfreeradius-client.h" = "x" ; then	# no header, assume found | ||||||
|  |          RADIUS_HEADER_FOUND="1" | ||||||
|  |       else				# check for the header | ||||||
|  |          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}" | ||||||
|  |          CPPFLAGS="${CPPFLAGS} ${RADIUS_INCLUDE}" | ||||||
|  |          ac_fn_c_check_header_mongrel "$LINENO" "freeradius-client.h" "ac_cv_header_freeradius_client_h" "$ac_includes_default" | ||||||
|  | if test "x$ac_cv_header_freeradius_client_h" = xyes; then : | ||||||
|  |   RADIUS_HEADER_FOUND=1 | ||||||
|  | else | ||||||
|  |   RADIUS_HEADER_FOUND=0 | ||||||
|  | fi | ||||||
|  |  | ||||||
|  |  | ||||||
|  |          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}" | ||||||
|  |       fi | ||||||
|  |       if test "x${RADIUS_HEADER_FOUND}" = "x0" ; then | ||||||
|  |          RADIUS_LIB="" | ||||||
|  |          RADIUS_INCLUDE="" | ||||||
|  |       else | ||||||
|  |          if test "x${pbxfuncname}" = "x" ; then		# only checking headers -> no library | ||||||
|  |             RADIUS_LIB="" | ||||||
|  |          fi | ||||||
|  |          PBX_RADIUS=1 | ||||||
|  |          cat >>confdefs.h <<_ACEOF | ||||||
|  | #define HAVE_RADIUS 1 | ||||||
|  | _ACEOF | ||||||
|  |  | ||||||
|  |       fi | ||||||
|  |    fi | ||||||
|  | fi | ||||||
|  |  | ||||||
|  |  | ||||||
|  | if test "x${PBX_RADIUS}" = "x1"; then | ||||||
|  |  | ||||||
|  | $as_echo "#define FREERADIUS_CLIENT /**/" >>confdefs.h | ||||||
|  |  | ||||||
|  | else | ||||||
|  |  | ||||||
| if test "x${PBX_RADIUS}" != "x1" -a "${USE_RADIUS}" != "no"; then | if test "x${PBX_RADIUS}" != "x1" -a "${USE_RADIUS}" != "no"; then | ||||||
|    pbxlibdir="" |    pbxlibdir="" | ||||||
| @@ -27862,6 +27973,7 @@ _ACEOF | |||||||
| fi | fi | ||||||
|  |  | ||||||
|  |  | ||||||
|  | fi | ||||||
|  |  | ||||||
|  |  | ||||||
| if test "x${PBX_COROSYNC}" != "x1" -a "${USE_COROSYNC}" != "no"; then | if test "x${PBX_COROSYNC}" != "x1" -a "${USE_COROSYNC}" != "no"; then | ||||||
|   | |||||||
| @@ -2134,7 +2134,14 @@ fi | |||||||
| # Some distributions (like SuSE) remove the 5.1 suffix. | # Some distributions (like SuSE) remove the 5.1 suffix. | ||||||
| AST_EXT_LIB_CHECK([LUA], [lua], [luaL_openlib], [lua.h], [-lm]) | AST_EXT_LIB_CHECK([LUA], [lua], [luaL_openlib], [lua.h], [-lm]) | ||||||
|  |  | ||||||
| AST_EXT_LIB_CHECK([RADIUS], [radiusclient-ng], [rc_read_config], [radiusclient-ng.h]) | # Accept either RADIUS client library, their APIs are fully compatible, | ||||||
|  | # just different header filenames and different SONAMEs | ||||||
|  | AST_EXT_LIB_CHECK([RADIUS], [freeradius-client], [rc_read_config], [freeradius-client.h]) | ||||||
|  | if test "x${PBX_RADIUS}" = "x1"; then | ||||||
|  | 	AC_DEFINE(FREERADIUS_CLIENT, [], [Use the FreeRADIUS-client library]) | ||||||
|  | else | ||||||
|  | 	AST_EXT_LIB_CHECK([RADIUS], [radiusclient-ng], [rc_read_config], [radiusclient-ng.h]) | ||||||
|  | fi | ||||||
|  |  | ||||||
| AST_EXT_LIB_CHECK([COROSYNC], [cpg], [cpg_join], [corosync/cpg.h], [-lcfg]) | AST_EXT_LIB_CHECK([COROSYNC], [cpg], [cpg_join], [corosync/cpg.h], [-lcfg]) | ||||||
| AST_EXT_LIB_CHECK([COROSYNC_CFG_STATE_TRACK], [cfg], [corosync_cfg_state_track], [corosync/cfg.h], [-lcfg]) | AST_EXT_LIB_CHECK([COROSYNC_CFG_STATE_TRACK], [cfg], [corosync_cfg_state_track], [corosync/cfg.h], [-lcfg]) | ||||||
|   | |||||||
| @@ -29,6 +29,9 @@ | |||||||
| /* Define to 1 if using `alloca.c'. */ | /* Define to 1 if using `alloca.c'. */ | ||||||
| #undef C_ALLOCA | #undef C_ALLOCA | ||||||
|  |  | ||||||
|  | /* Use the FreeRADIUS-client library */ | ||||||
|  | #undef FREERADIUS_CLIENT | ||||||
|  |  | ||||||
| /* Define to 1 if anonymous semaphores work. */ | /* Define to 1 if anonymous semaphores work. */ | ||||||
| #undef HAS_WORKING_SEMAPHORE | #undef HAS_WORKING_SEMAPHORE | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user