X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsrc%2Fauths%2Fcall_radius.c;h=d93e6a94a1be04b90ba081e93a5ba0c3d51f634b;hb=80fea873648ca2ab2e592999a336c59cf054ab55;hp=8161642530be7e68e49c9abbaaf8890075df736b;hpb=750af86e830d828a4fbbed17a5b248503fdf1f54;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/src/src/auths/call_radius.c b/src/src/auths/call_radius.c index 816164253..d93e6a94a 100644 --- a/src/src/auths/call_radius.c +++ b/src/src/auths/call_radius.c @@ -1,15 +1,23 @@ -/* $Cambridge: exim/src/src/auths/call_radius.c,v 1.4 2005/08/22 10:49:04 ph10 Exp $ */ - /************************************************* * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2005 */ +/* Copyright (c) University of Cambridge 1995 - 2016 */ /* See the file NOTICE for conditions of use and distribution. */ /* This file was originally supplied by Ian Kirk. The libradius support came from Alex Kiernan. */ +/* ugly hack to work around redefinition of ENV by radiusclient.h and + * db.h: define _DB_H_ so the db.h include thinks it's already included, + * we can get away with it like this, since this file doesn't use any db + * functions. */ +#ifndef _DB_H_ +# define _DB_H_ 1 +# define _DB_EXT_PROT_IN_ 1 +# define DB void +#endif + #include "../exim.h" /* This module contains functions that call the Radius authentication @@ -22,10 +30,12 @@ RADIUS_CONFIG_FILE is defined. However, some compilers don't like compiling empty modules, so keep them happy with a dummy when skipping the rest. Make it reference itself to stop picky compilers complaining that it is unused, and put in a dummy argument to stop even pickier compilers complaining about infinite -loops. */ +loops. Then use a mutually-recursive pair as gcc is just getting stupid. */ #ifndef RADIUS_CONFIG_FILE -static void dummy(int x) { dummy(x-1); } +static void dummy(int x); +static void dummy2(int x) { dummy(x-1); } +static void dummy(int x) { dummy2(x-1); } #else /* RADIUS_CONFIG_FILE */ @@ -36,9 +46,14 @@ using its original API. At release 0.4.0 the API changed. */ #include #else #if !defined(RADIUS_LIB_RADIUSCLIENT) && !defined(RADIUS_LIB_RADIUSCLIENTNEW) - #define RADIUS_LIB_RADIUSCLIENT + # define RADIUS_LIB_RADIUSCLIENT + #endif + + #ifdef RADIUS_LIB_RADIUSCLIENTNEW + # include + #else + # include #endif - #include #endif @@ -60,10 +75,10 @@ Returns: OK if authentication succeeded */ int -auth_call_radius(uschar *s, uschar **errptr) +auth_call_radius(const uschar *s, uschar **errptr) { uschar *user; -uschar *radius_args = s; +const uschar *radius_args = s; int result; int sep = 0; @@ -177,7 +192,8 @@ if (rad_config(h, RADIUS_CONFIG_FILE) != 0 || rad_create_request(h, RAD_ACCESS_REQUEST) != 0 || rad_put_string(h, RAD_USER_NAME, CS user) != 0 || rad_put_string(h, RAD_USER_PASSWORD, CS radius_args) != 0 || - rad_put_int(h, RAD_SERVICE_TYPE, RAD_AUTHENTICATE_ONLY) != 0) + rad_put_int(h, RAD_SERVICE_TYPE, RAD_AUTHENTICATE_ONLY) != 0 || + rad_put_string(h, RAD_NAS_IDENTIFIER, CS primary_hostname) != 0) { *errptr = string_sprintf("RADIUS: %s", rad_strerror(h)); result = ERROR;