EAP-SIM DB: Remove client socket file on connect() error

If the connection from hostapd authentication server to hlr_auc_gw fails
due to hlr_auc_gw not running yet, the local socket file was left
behind. Delete the socket file on connect() failure path.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2014-02-15 16:45:57 +02:00
parent 4fcee244b9
commit a0ac572611

View file

@ -639,6 +639,11 @@ static int eap_sim_db_open_socket(struct eap_sim_db_data *data)
"/tmp/eap_sim_db_%d-%d", getpid(), counter++);
os_free(data->local_sock);
data->local_sock = os_strdup(addr.sun_path);
if (data->local_sock == NULL) {
close(data->sock);
data->sock = -1;
return -1;
}
if (bind(data->sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
wpa_printf(MSG_INFO, "bind(eap_sim_db): %s", strerror(errno));
close(data->sock);
@ -657,6 +662,9 @@ static int eap_sim_db_open_socket(struct eap_sim_db_data *data)
os_strlen(addr.sun_path));
close(data->sock);
data->sock = -1;
unlink(data->local_sock);
os_free(data->local_sock);
data->local_sock = NULL;
return -1;
}