git://git.exim.org
/
exim.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
68f71b9
)
Fix build with Radius auth expansion condition support. Bug 2572
author
= Fabian Groffen
<grobian@gentoo.org>
Sat, 9 May 2020 14:06:06 +0000
(15:06 +0100)
committer
Jeremy Harris
<jgh146exb@wizmail.org>
Sat, 9 May 2020 14:06:06 +0000
(15:06 +0100)
src/src/auths/call_radius.c
patch
|
blob
|
history
diff --git
a/src/src/auths/call_radius.c
b/src/src/auths/call_radius.c
index c3637436dc168da653ef39cdfa04035b77b75fe6..cc269dcd5521bbf7f825287cd950e2ada38e1863 100644
(file)
--- a/
src/src/auths/call_radius.c
+++ b/
src/src/auths/call_radius.c
@@
-2,6
+2,7
@@
* Exim - an Internet mail transport agent *
*************************************************/
* Exim - an Internet mail transport agent *
*************************************************/
+/* Copyright (c) The Exim Maintainers 2020 */
/* Copyright (c) University of Cambridge 1995 - 2016 */
/* See the file NOTICE for conditions of use and distribution. */
/* Copyright (c) University of Cambridge 1995 - 2016 */
/* See the file NOTICE for conditions of use and distribution. */
@@
-96,7
+97,7
@@
int sep = 0;
user = string_nextinlist(&radius_args, &sep, big_buffer, big_buffer_size);
user = string_nextinlist(&radius_args, &sep, big_buffer, big_buffer_size);
-if (
user == NULL
) user = US"";
+if (
!user
) user = US"";
DEBUG(D_auth) debug_printf("Running RADIUS authentication for user \"%s\" "
"and \"%s\"\n", user, radius_args);
DEBUG(D_auth) debug_printf("Running RADIUS authentication for user \"%s\" "
"and \"%s\"\n", user, radius_args);
@@
-115,38
+116,38
@@
if (rc_read_config(RADIUS_CONFIG_FILE) != 0)
*errptr = string_sprintf("RADIUS: can't open %s", RADIUS_CONFIG_FILE);
else if (rc_read_dictionary(rc_conf_str("dictionary")) != 0)
*errptr = string_sprintf("RADIUS: can't open %s", RADIUS_CONFIG_FILE);
else if (rc_read_dictionary(rc_conf_str("dictionary")) != 0)
- *errptr =
string_sprintf("RADIUS: can't read dictionary")
;
+ *errptr =
US"RADIUS: can't read dictionary"
;
-else if (
rc_avpair_add(&send, PW_USER_NAME, user, 0) == NULL
)
- *errptr =
string_sprintf("RADIUS: add user name failed\n")
;
+else if (
!rc_avpair_add(&send, PW_USER_NAME, user, 0)
)
+ *errptr =
US"RADIUS: add user name failed"
;
-else if (
rc_avpair_add(&send, PW_USER_PASSWORD, CS radius_args, 0) == NULL
)
- *errptr =
string_sprintf("RADIUS: add password failed\n
");
+else if (
!rc_avpair_add(&send, PW_USER_PASSWORD, CS radius_args, 0)
)
+ *errptr =
US"RADIUS: add password failed
");
-else if (
rc_avpair_add(&send, PW_SERVICE_TYPE, &service, 0) == NULL
)
- *errptr =
string_sprintf("RADIUS: add service type failed\n")
;
+else if (
!rc_avpair_add(&send, PW_SERVICE_TYPE, &service, 0)
)
+ *errptr =
US"RADIUS: add service type failed"
;
#else /* RADIUS_LIB_RADIUSCLIENT unset => RADIUS_LIB_RADIUSCLIENT2 */
#else /* RADIUS_LIB_RADIUSCLIENT unset => RADIUS_LIB_RADIUSCLIENT2 */
-if (
(h = rc_read_config(RADIUS_CONFIG_FILE)) == NULL
)
+if (
!(h = rc_read_config(RADIUS_CONFIG_FILE))
)
*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 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")
;
+ *errptr =
US"RADIUS: can't read dictionary"
;
-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_NAME, user, Ustrlen(user), 0)
)
+ *errptr =
US"RADIUS: add user name failed"
;
-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_USER_PASSWORD, CS radius_args,
+ Ustrlen(radius_args), 0))
+ *errptr =
US"RADIUS: add password failed"
;
-else if (
rc_avpair_add(h, &send, PW_SERVICE_TYPE, &service, 0, 0) == NULL
)
- *errptr =
string_sprintf("RADIUS: add service type failed\n")
;
+else if (
!rc_avpair_add(h, &send, PW_SERVICE_TYPE, &service, 0, 0)
)
+ *errptr =
US"RADIUS: add service type failed"
;
#endif /* RADIUS_LIB_RADIUSCLIENT */
#endif /* RADIUS_LIB_RADIUSCLIENT */
-if (*errptr
!= NULL
)
+if (*errptr)
{
DEBUG(D_auth) debug_printf("%s\n", *errptr);
return ERROR;
{
DEBUG(D_auth) debug_printf("%s\n", *errptr);
return ERROR;
@@
-163,28
+164,27
@@
DEBUG(D_auth) debug_printf("RADIUS code returned %d\n", result);
switch (result)
{
case OK_RC:
switch (result)
{
case OK_RC:
- return OK;
+
return OK;
case REJECT_RC:
case ERROR_RC:
case REJECT_RC:
case ERROR_RC:
- return FAIL;
+
return FAIL;
case TIMEOUT_RC:
case TIMEOUT_RC:
- *errptr = US"RADIUS: timed out";
- return ERROR;
+
*errptr = US"RADIUS: timed out";
+
return ERROR;
- default:
case BADRESP_RC:
case BADRESP_RC:
- *errptr = string_sprintf("RADIUS: unexpected response (%d)", result);
- return ERROR;
+ default:
+ *errptr = string_sprintf("RADIUS: unexpected response (%d)", result);
+ return ERROR;
}
#else /* RADIUS_LIB_RADLIB is set */
/* Authenticate using the libradius library */
}
#else /* RADIUS_LIB_RADLIB is set */
/* Authenticate using the libradius library */
-h = rad_auth_open();
-if (h == NULL)
+if (!(h = rad_auth_open()))
{
*errptr = string_sprintf("RADIUS: can't initialise libradius");
return ERROR;
{
*errptr = string_sprintf("RADIUS: can't initialise libradius");
return ERROR;
@@
-200,32
+200,28
@@
if (rad_config(h, RADIUS_CONFIG_FILE) != 0 ||
result = ERROR;
}
else
result = ERROR;
}
else
- {
- result = rad_send_request(h);
-
- switch(result)
+ switch (result = rad_send_request(h))
{
case RAD_ACCESS_ACCEPT:
{
case RAD_ACCESS_ACCEPT:
- result = OK;
- break;
+
result = OK;
+
break;
case RAD_ACCESS_REJECT:
case RAD_ACCESS_REJECT:
- result = FAIL;
- break;
+
result = FAIL;
+
break;
case -1:
case -1:
- *errptr = string_sprintf("RADIUS: %s", rad_strerror(h));
- result = ERROR;
- break;
+
*errptr = string_sprintf("RADIUS: %s", rad_strerror(h));
+
result = ERROR;
+
break;
default:
default:
- *errptr = string_sprintf("RADIUS: unexpected response (%d)", result);
- result= ERROR;
- break;
+
*errptr = string_sprintf("RADIUS: unexpected response (%d)", result);
+
result= ERROR;
+
break;
}
}
- }
-if (*errptr
!= NULL
) DEBUG(D_auth) debug_printf("%s\n", *errptr);
+if (*errptr) DEBUG(D_auth) debug_printf("%s\n", *errptr);
rad_close(h);
return result;
rad_close(h);
return result;