freeradius-client
freeradius-client copied to clipboard
Error in 1.1.8 when there is no entry for radius port in /etc/services
The issue was introduced in version 1.1.8. The rc_getaddrinfo function (at /lib/ip_util.c) calls getaddrinfo(). This function returns an error when the "radius" (or "radius-acct") service is not defined in the /etc/services file. The library should take this case into account and use the default value.
As a workaround, I've used this code in rc_getaddrinfo:
char defport[10];
...
if (flags & PW_AI_AUTH)
{
service = "radius";
snprintf(defport, sizeof(defport), "%d", PW_AUTH_UDP_PORT);
}
else if (flags & PW_AI_ACCT)
{
service = "radius-acct";
snprintf(defport, sizeof(defport), "%d", PW_ACCT_UDP_PORT);
}
err = getaddrinfo(host, service, &hints, &res);
if (err != 0) {
/* Execute again using the default (old) radius port number */
hints.ai_flags |= AI_NUMERICSERV;
err = getaddrinfo(host, defport, &hints, &res);
if (err != 0) {
return NULL;
}
}
@jordil2 could you share the exact code using our library causing the reported error? it will be helpful to validate the report.