Update version number and copyright year.
[exim.git] / src / src / auths / call_radius.c
index a20237689dcace9c36ec9559b68eec08f8b5bff8..ce22b2278646052e6a222cbb57a82645ff7df2d4 100644 (file)
@@ -1,10 +1,10 @@
-/* $Cambridge: exim/src/src/auths/call_radius.c,v 1.3 2005/03/29 14:19:21 ph10 Exp $ */
+/* $Cambridge: exim/src/src/auths/call_radius.c,v 1.7 2007/01/08 10:50:19 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) University of Cambridge 1995 - 2005 */
+/* Copyright (c) University of Cambridge 1995 - 2007 */
 /* See the file NOTICE for conditions of use and distribution. */
 
 /* This file was originally supplied by Ian Kirk. The libradius support came
@@ -113,16 +113,17 @@ else if (rc_avpair_add(&send, PW_SERVICE_TYPE, &service, 0) == NULL)
 
 #else  /* RADIUS_LIB_RADIUSCLIENT unset => RADIUS_LIB_RADIUSCLIENT2 */
 
-if ((h = rc_read_config(RADIUS_CONFIG_FILE)) != 0)
+if ((h = rc_read_config(RADIUS_CONFIG_FILE)) == NULL)
   *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)
+else if (rc_avpair_add(h, &send, PW_USER_NAME, user, Ustrlen(user), 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)
+else if (rc_avpair_add(h, &send, PW_USER_PASSWORD, CS radius_args,
+    Ustrlen(radius_args), 0) == NULL)
   *errptr = string_sprintf("RADIUS: add password failed\n");
 
 else if (rc_avpair_add(h, &send, PW_SERVICE_TYPE, &service, 0, 0) == NULL)
@@ -176,7 +177,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;