Skip to content

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

@jordil2

Description

@jordil2

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;
	} 		
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions