This is the mail archive of the 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]

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

On Thu, Oct 31, 2013 at 02:09:54PM +0100, Florian Weimer wrote:
> On 10/20/2013 08:07 PM, OndÅej BÃlka wrote:
> >+      char *endptr;
> >+      long port = strtol (key[i], &endptr, 0);
> >+
> >+      if (*endptr == '\0')
> >+	serv = getservbyport (htons (port), proto);
> This accepts leading "-" and "0x", which is not compliant with RFC
> 6335, either.
There should be strtol (_, _, 10) in case when  somebody names their
service as 0x0.

> I'm not sure if the RFC is correct, a lot of software assumes that a
> leading digits in a service name indicates that it's a port number.
In bugzilla a reason for this change was:

Checking IANA, there are currently 28 service names registered that
begin with a digit, for example 3com-tsmux and 3gpp-cbsp.

We currently do not do validation as conditions on name are:

RFC 6335

Valid service names are hereby normatively defined as follows:

   o  MUST be at least 1 character and no more than 15 characters long

   o  MUST contain only US-ASCII [ANSI.X3.4-1986] letters 'A' - 'Z' and
      'a' - 'z', digits '0' - '9', and hyphens ('-', ASCII 0x2D or
      decimal 45)

   o  MUST contain at least one letter ('A' - 'Z' or 'a' - 'z')

   o  MUST NOT begin or end with a hyphen

   o  hyphens MUST NOT be adjacent to other hyphens

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