This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PING][PATCH][BZ #15374] Make getent services compliant with RFC 6335 section 5.1


ping
On Sun, Oct 20, 2013 at 08:07:45PM +0200, OndÅej BÃlka wrote:
> Hi,
> 
> >From bugzilla entry "
> RFC 6335 section 5.1 permits service names with leading digits.
> nss/getent.c does not, as they would be treated as port numbers."
> 
> I replaced a check there which checks that uses strtol.
> 
> OK to commit? 
> 
> 	[BZ #15374]
> 	* nss/getent.c: Recognize services starting with digit.
> 
> diff --git a/nss/getent.c b/nss/getent.c
> index 8a3c864..edffc19 100644
> --- a/nss/getent.c
> +++ b/nss/getent.c
> @@ -788,8 +788,11 @@ services_keys (int number, char *key[])
>        if (proto != NULL)
>  	*proto++ = '\0';
>  
> -      if (isdigit (key[i][0]))
> -	serv = getservbyport (htons (atol (key[i])), proto);
> +      char *endptr;
> +      long port = strtol (key[i], &endptr, 0);
> +
> +      if (*endptr == '\0')
> +	serv = getservbyport (htons (port), proto);
>        else
>  	serv = getservbyname (key[i], proto);
>  

-- 

Maintenance window broken


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]