This is the mail archive of the cygwin mailing list for the Cygwin 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: getent services enumeration glitch

Hi Mark,

On Aug 18 09:40, Mark Geisert wrote:
> There is a glitch when getent enumerates all services; it shows an incorrect
> port number.  Providing a service name on invocation shows the correct port
> number.  Examples:
> $ getent services man
> man                   9535/tcp
> $ getent services | grep man
> man                   16165/tcp
> It looks like when all services are enumerated there is an extra or missing
> byte swap call to htons() or ntohs().  This can be observed by comparing the
> hex values of the two port numbers shown above, giving 0x253F and 0x3F25.

Congratulations!  You found a 13 years old bug in Cygwin's getservent
implementation, which returned the port number in host byte order
instead of in network byte order for all this time.  Makes me wonder
how often getservent is used in the wild...

Since I uploaded 2.2.1-0.2 just before your bug report, I quickly
created a new snapshot with the patch on
Please give it a try.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: pgpjW_35VfAnJ.pgp
Description: PGP signature

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