]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
RADIUS client: Do not try to send message without socket
authorJouni Malinen <j@w1.fi>
Fri, 30 May 2014 08:33:01 +0000 (11:33 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 30 May 2014 15:08:37 +0000 (18:08 +0300)
It is possible for the RADIUS authentication/accounting socket to not be
open even if partial RADIUS server configuration has been done through
the control interface SET commands. Previously, this resulted in send()
attempt using fd=-1 which fails with bad file descriptor. Clean this up
by logging this as a missing configuration instead of trying to send the
message when that is known to fail.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/radius/radius_client.c

index 762599668fd002ca8c15d672909ed0b877d7b8f0..5199da7f470643e2954b3da8c1eb82eeb404fdbf 100644 (file)
@@ -633,7 +633,7 @@ int radius_client_send(struct radius_client_data *radius,
        }
 
        if (msg_type == RADIUS_ACCT || msg_type == RADIUS_ACCT_INTERIM) {
-               if (conf->acct_server == NULL) {
+               if (conf->acct_server == NULL || radius->acct_sock < 0) {
                        hostapd_logger(radius->ctx, NULL,
                                       HOSTAPD_MODULE_RADIUS,
                                       HOSTAPD_LEVEL_INFO,
@@ -647,7 +647,7 @@ int radius_client_send(struct radius_client_data *radius,
                s = radius->acct_sock;
                conf->acct_server->requests++;
        } else {
-               if (conf->auth_server == NULL) {
+               if (conf->auth_server == NULL || radius->auth_sock < 0) {
                        hostapd_logger(radius->ctx, NULL,
                                       HOSTAPD_MODULE_RADIUS,
                                       HOSTAPD_LEVEL_INFO,