getent services enumeration glitch

Corinna Vinschen corinna-cygwin@cygwin.com
Tue Aug 18 11:24:00 GMT 2015


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 https://cygwin.com/snapshots/
Please give it a try.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20150818/5531a0be/attachment.sig>


More information about the Cygwin mailing list