Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in 1.1.8 when there is no entry for radius port in /etc/services #116

Open
jordil2 opened this issue Apr 11, 2023 · 1 comment
Open

Comments

@jordil2
Copy link

jordil2 commented Apr 11, 2023

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;
	} 		
}
@jpereira
Copy link
Contributor

@jordil2 could you share the exact code using our library causing the reported error? it will be helpful to validate the report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants