RSS feed

Re: Incorrect service port handling in nss/services.c

[Date Prev][Date Next] [Thread Prev][Thread Next]

Re: Incorrect service port handling in nss/services.c

On Tue, 2010-07-20 at 16:35 -0700, Ted C. Cheng wrote:
Testing on Linux x86_64, one service entry is defined as:

dn: cn=test_service1,ou=Services,dc=example,dc=com
objectClass: top
objectClass: ipService
cn: test_service1
ipServicePort: 10001 <-- service port defined
description: Symas SUUM services
ipServiceProtocol: tcp

The service port returned from nss-pam-ldapd/nss/services.c, however,
becomes 4391.

This is a bit strange. In my test environment getent returns the correct
service number. The tests are in tests/

# ./testgetservbyname debug
servent.s_name: test_service1
servent.s_port: 4391 <-- wrong service port returned.
servent.s_proto: tcp
./testgetservbyname: failed

Can you post the source for testgetservbyname? Note that the port number
as returned by getservent() and friends is in network byte order (at
least in Glibc). On what platform are you seeing this?

Please find attached source code for testgetservbyname.c.

Platform information:
Red Hat Enterprise Linux WS release 4 (Nahant Update 3)
Linux 2.6.9-34.ELsmp #1 SMP x86_64 GNU/Linux

The testing was via testgetservbyname <-> nss <-> nssov/slapd/back-ldap/pcache for client-side caching and disconnected operations when LDAP server is off-line.

Also note that the nslcd protocol uses host byte order as much as
possible (except for IP addresses which are in network byte order most
of the time anyway).

-- arthur - - --

Attachment: testgetservbyname.c
Description: Binary data

To unsubscribe send an email to or see