ph10 2005/03/29 15:19:21 BST
Modified files:
exim-doc/doc-txt ChangeLog NewStuff
exim-src ACKNOWLEDGMENTS
exim-src/src EDITME buildconfig.c
exim-src/src/auths call_radius.c
Log:
Add support for libradiusclient version 0.4.0 onwards, where they have
changed the API.
Revision Changes Path
1.103 +6 -0 exim/exim-doc/doc-txt/ChangeLog
1.31 +6 -0 exim/exim-doc/doc-txt/NewStuff
1.17 +2 -1 exim/exim-src/ACKNOWLEDGMENTS
1.10 +14 -7 exim/exim-src/src/EDITME
1.3 +38 -9 exim/exim-src/src/auths/call_radius.c
1.7 +1 -0 exim/exim-src/src/buildconfig.c
Index: ChangeLog
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -r1.102 -r1.103
--- ChangeLog 29 Mar 2005 11:01:32 -0000 1.102
+++ ChangeLog 29 Mar 2005 14:19:21 -0000 1.103
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.102 2005/03/29 11:01:32 ph10 Exp $
+$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.103 2005/03/29 14:19:21 ph10 Exp $
Change log file for Exim from version 4.21
-------------------------------------------
@@ -89,6 +89,12 @@
negation of where the condition IS allowed.
PH/16 Installed updated OS/os.c-cygwin from the Cygwin maintainer.
+
+PH/17 The API for radiusclient changed at release 0.4.0. Unfortunately, the
+ header file does not have a version number, so I've had to invent a new
+ value for RADIUS_LIB_TYPE, namely "RADIUSCLIENTNEW" to request the new
+ API. The code is untested by me (my Linux distribution still has 0.3.2 of
+ radiusclient), but it was contributed by a Radius user.
A note about Exim versions 4.44 and 4.50
Index: NewStuff
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/NewStuff,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- NewStuff 22 Mar 2005 16:52:06 -0000 1.30
+++ NewStuff 29 Mar 2005 14:19:21 -0000 1.31
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/NewStuff,v 1.30 2005/03/22 16:52:06 ph10 Exp $
+$Cambridge: exim/exim-doc/doc-txt/NewStuff,v 1.31 2005/03/29 14:19:21 ph10 Exp $
New Features in Exim
--------------------
@@ -90,6 +90,12 @@
TF/01 $received_time is a new expansion variable containing the time and date
as a number of seconds since the start of the Unix epoch when the
current message was received.
+
+PH/03 There is a new value for RADIUS_LIB_TYPE that can be set in
+ Local/Makefile. It is RADIUSCLIENTNEW, and it requests that the new API,
+ in use from radiusclient 0.4.0 onwards, be used. It does not appear to be
+ possible to detect the different versions automatically.
+
Version 4.50
------------
Index: ACKNOWLEDGMENTS
===================================================================
RCS file: /home/cvs/exim/exim-src/ACKNOWLEDGMENTS,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- ACKNOWLEDGMENTS 22 Mar 2005 14:11:54 -0000 1.16
+++ ACKNOWLEDGMENTS 29 Mar 2005 14:19:21 -0000 1.17
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-src/ACKNOWLEDGMENTS,v 1.16 2005/03/22 14:11:54 ph10 Exp $
+$Cambridge: exim/exim-src/ACKNOWLEDGMENTS,v 1.17 2005/03/29 14:19:21 ph10 Exp $
EXIM ACKNOWLEDGEMENTS
@@ -20,7 +20,7 @@
Philip Hazel
Lists created: 20 November 2002
-Last updated: 22 March 2005
+Last updated: 29 March 2005
THE OLD LIST
@@ -83,6 +83,7 @@
Brian Candler Use h_errno for gethostbyname()
Suggested patch for .ifdef etc
Several minor fixes and suggestions
+Pete Carah Patch for change to radiusclient API
Oliver Cook Suggested patch for exigrep & rejected messages
Patch to add sender/host info to local_scan() rejects
Suggested patch to add queue time to "Completed"
Index: EDITME
===================================================================
RCS file: /home/cvs/exim/exim-src/src/EDITME,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- EDITME 22 Mar 2005 14:11:54 -0000 1.9
+++ EDITME 29 Mar 2005 14:19:21 -0000 1.10
@@ -1,4 +1,4 @@
-# $Cambridge: exim/exim-src/src/EDITME,v 1.9 2005/03/22 14:11:54 ph10 Exp $
+# $Cambridge: exim/exim-src/src/EDITME,v 1.10 2005/03/29 14:19:21 ph10 Exp $
##################################################
# The Exim mail transport agent #
@@ -722,17 +722,24 @@
# If you have set RADIUS_CONFIG_FILE, you should also set one of these to
# indicate which RADIUS library is used:
-#
-# RADIUSCLIENT is the radiusclient library; you probably need to add
-# -libradiusclient to EXTRALIBS
-#
-# RADLIB is the Radius library that comes with FreeBSD (the header file is
-# called radlib.h); you probably need to add -lradius to EXTRALIBS
# RADIUS_LIB_TYPE=RADIUSCLIENT
+# RADIUS_LIB_TYPE=RADIUSCLIENTNEW
# RADIUS_LIB_TYPE=RADLIB
-# If you don't set one of these, Exim assumes the radiusclient library.
+# RADIUSCLIENT is the radiusclient library; you probably need to add
+# -lradiusclient to EXTRALIBS.
+#
+# The API for the radiusclient library was changed at release 0.4.0.
+# Unfortunately, the header file does not define a version number that clients
+# can use to support both the old and new APIs. If you are using version 0.4.0
+# or later of the radiusclient library, you should use RADIUSCLIENTNEW.
+#
+# RADLIB is the Radius library that comes with FreeBSD (the header file is
+# called radlib.h); you probably need to add -lradius to EXTRALIBS.
+#
+# If you do not set RADIUS_LIB_TYPE, Exim assumes the radiusclient library,
+# using the original API.
#------------------------------------------------------------------------------
Index: buildconfig.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/buildconfig.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- buildconfig.c 17 Feb 2005 11:58:25 -0000 1.6
+++ buildconfig.c 29 Mar 2005 14:19:21 -0000 1.7
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/buildconfig.c,v 1.6 2005/02/17 11:58:25 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/buildconfig.c,v 1.7 2005/03/29 14:19:21 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -677,6 +677,7 @@
else if (strcmp(name, "RADIUS_LIB_TYPE") == 0)
{
if (strcmp(value, "RADIUSCLIENT") == 0 ||
+ strcmp(value, "RADIUSCLIENTNEW") == 0 ||
strcmp(value, "RADLIB") == 0)
{
fprintf(new, "#define RADIUS_LIB_%s\n", value);
Index: call_radius.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/auths/call_radius.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- call_radius.c 4 Jan 2005 10:00:43 -0000 1.2
+++ call_radius.c 29 Mar 2005 14:19:21 -0000 1.3
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/auths/call_radius.c,v 1.2 2005/01/04 10:00:43 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/auths/call_radius.c,v 1.3 2005/03/29 14:19:21 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -29,12 +29,13 @@
#else /* RADIUS_CONFIG_FILE */
-/* Two different Radius libraries are supported. The default is radiusclient. */
+/* Two different Radius libraries are supported. The default is radiusclient,
+using its original API. At release 0.4.0 the API changed. */
#ifdef RADIUS_LIB_RADLIB
#include <radlib.h>
#else
- #ifndef RADIUS_LIB_RADIUSCLIENT
+ #if !defined(RADIUS_LIB_RADIUSCLIENT) && !defined(RADIUS_LIB_RADIUSCLIENTNEW)
#define RADIUS_LIB_RADIUSCLIENT
#endif
#include <radiusclient.h>
@@ -67,12 +68,15 @@
int sep = 0;
#ifdef RADIUS_LIB_RADLIB
-struct rad_handle *h;
+ struct rad_handle *h;
#else
-VALUE_PAIR *send = NULL;
-VALUE_PAIR *received;
-unsigned int service = PW_AUTHENTICATE_ONLY;
-char msg[4096];
+ #ifdef RADIUS_LIB_RADIUSCLIENTNEW
+ rc_handle *h;
+ #endif
+ VALUE_PAIR *send = NULL;
+ VALUE_PAIR *received;
+ unsigned int service = PW_AUTHENTICATE_ONLY;
+ char msg[4096];
#endif
@@ -87,10 +91,11 @@
/* Authenticate using the radiusclient library */
-#ifdef RADIUS_LIB_RADIUSCLIENT
+#ifndef RADIUS_LIB_RADLIB
rc_openlog("exim");
+#ifdef RADIUS_LIB_RADIUSCLIENT
if (rc_read_config(RADIUS_CONFIG_FILE) != 0)
*errptr = string_sprintf("RADIUS: can't open %s", RADIUS_CONFIG_FILE);
@@ -106,13 +111,37 @@
else if (rc_avpair_add(&send, PW_SERVICE_TYPE, &service, 0) == NULL)
*errptr = string_sprintf("RADIUS: add service type failed\n");
+#else /* RADIUS_LIB_RADIUSCLIENT unset => RADIUS_LIB_RADIUSCLIENT2 */
+
+if ((h = rc_read_config(RADIUS_CONFIG_FILE)) != 0)
+ *errptr = string_sprintf("RADIUS: can't open %s", RADIUS_CONFIG_FILE);
+
+else if (rc_read_dictionary(h, rc_conf_str(h, "dictionary")) != 0)
+ *errptr = string_sprintf("RADIUS: can't read dictionary");
+
+else if (rc_avpair_add(h, &send, PW_USER_NAME, user, 0, 0) == NULL)
+ *errptr = string_sprintf("RADIUS: add user name failed\n");
+
+else if (rc_avpair_add(h, &send, PW_USER_PASSWORD, CS radius_args, 0, 0) == NULL)
+ *errptr = string_sprintf("RADIUS: add password failed\n");
+
+else if (rc_avpair_add(h, &send, PW_SERVICE_TYPE, &service, 0, 0) == NULL)
+ *errptr = string_sprintf("RADIUS: add service type failed\n");
+
+#endif /* RADIUS_LIB_RADIUSCLIENT */
+
if (*errptr != NULL)
{
DEBUG(D_auth) debug_printf("%s\n", *errptr);
return ERROR;
}
+#ifdef RADIUS_LIB_RADIUSCLIENT
result = rc_auth(0, send, &received, msg);
+#else
+result = rc_auth(h, 0, send, &received, msg);
+#endif
+
DEBUG(D_auth) debug_printf("RADIUS code returned %d\n", result);
switch (result)
@@ -133,7 +162,7 @@
return ERROR;
}
-#else /* RADIUS_LIB_RADIUSCLIENT not set => RADIUS_LIB_RADLIB is set */
+#else /* RADIUS_LIB_RADLIB is set */
/* Authenticate using the libradius library */