Operating System - HP-UX
1837383 Members
3107 Online
110116 Solutions
New Discussion

getpwnam_r() failed on HPPA-11.23 using ldap

 
Bohai Zhang
Occasional Advisor

getpwnam_r() failed on HPPA-11.23 using ldap

Hi,

We are using ldap to auth user through PAM.

When I tried to use getpwnam_r() in a multi-thread application, the code hung. The gdb showed:
(gdb) where
#0 0xc0bfb22c in _hp_ldap_send_recv_query (message_type=MTYPE_RSRVD_REQ,
cache_id=RSRVD0, request_data=0x0, request_size=0,
reply_data=0xb9a41d60 "", reply_size_max=512, nss_status=0xb9a409fc,
reply_size=0xb9a49d60) at ldapd_client.c:466
#1 0xc1f6d9cc in _query_daemon_pw (message_type=MTYPE_REQUEST, id=1,
op_type=0, argp=0xb9a40720, search_str=0x92ae12 "ldaptest", state_id=0x0,
result=0xb9a409fc) at getpwnam.c:81
#2 0xc1f6e8fc in getbynam (be=0x401efc10,
a=0xb9a40720 "\271\244\003\310\271\244\003\364") at getpwnam.c:381
#3 0x8b1a30 in nss_search+0x248 ()
#4 0x8aba4c in __getpwnam_r+0x7c ()
#5 0x8aa674 in getpwnam_r+0x68 ()
...

Any body knows why? And how can I resolve it?

Thanks,

Bohai
9 REPLIES 9
Arunvijai_4
Honored Contributor

Re: getpwnam_r() failed on HPPA-11.23 using ldap

A few questions
1) Which version of LDAP server you use ?
2) Is the server up and running ?
3) Use tusc to get a detailed information of system calls.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Bohai Zhang
Occasional Advisor

Re: getpwnam_r() failed on HPPA-11.23 using ldap

Hi Arun,

Thanks for the reply. Here is my answer:

1. The version of LDAP server is:
# swlist |grep -i netscape
J4258CA B.06.11.20 Netscape Directory Server v6 for HP-UX

2. I think it is up and running.
root 795 1 0 Sep 21 ? 0:49 /opt/ldapux/bin/ldapclientd
And when I use a simple code (not multi-thread) to call the function, it works, which means it could get the right gid and uid.

3. I never used the "tusc" before. I'll try.

Bohai

P.S. If I use "chatr +q3p enable" command on the bionary, the getpwnam_r() call will failed (return value = 12) even in the single thread env.
Bohai Zhang
Occasional Advisor

Re: getpwnam_r() failed on HPPA-11.23 using ldap

Any ideas?

Bohai
Steven E. Protter
Exalted Contributor

Re: getpwnam_r() failed on HPPA-11.23 using ldap

tusc can be used to hang a collection agent on any process.

This will get you lots of fun details on what went wrong. HP or other forumers will then be able to direct you to a solution.

Is LDAP server and system fully patched?

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Bohai Zhang
Occasional Advisor

Re: getpwnam_r() failed on HPPA-11.23 using ldap

Hi Steven,

Thanks for the reply. I run a few time with tusc. Here is the result.

If the call of getpwnam() is within a thread (#46 in this case),
...
{86137} #46 open(0xc1f6ca58, O_RDONLY, 0666) ............. [entry]
{86137} #46 open("/etc/opt/ldapux/ldapux_client.conf", O_RDONLY, 0666) = 25
{86137} #46 ioctl(25, TCGETA, 0xb9a225e0) ................ [entry]
{86137} #46 ioctl(25, TCGETA, 0xb9a225e0) ................ ERR#25 ENOTTY
{86137} #46 read(25, 0x4030cfc8, 8192) ................... [entry]
{86137} #46 read(25, "# L D A P - U X C l i e n t ".., 8192) = 5294
{86137} #46 read(25, 0x4030cfc8, 8192) ................... [entry]
{86137} #46 read(25, 0x4030cfc8, 8192) ................... = 0
{86137} #46 close(25) .................................... [entry]
{86137} #46 close(25) .................................... = 0

I attached the info for thread #46.

I'll add anohter reply to attace the info if the call of getpwnam() is in the main thread.

Thanks for the help.

Bohai
Bohai Zhang
Occasional Advisor

Re: getpwnam_r() failed on HPPA-11.23 using ldap

Hi Steven,

Here comes the one which call getpwnam() from the main thread.
...
{90041} #1 poll(0x7a00ab78, 1, 0) ........................ [entry]
{90041} #1 poll(0x7a00ab78, 1, 0) ........................ = 1
{90041} #1 sendto(24, 0x7a00ab80, 36, 0, 0x79a71738, 0x1d) [entry]
{90041} #1 sendto(24, "f2\0\0010201\0c4\0\0\0\t\0\002\0".., 36, 0, 0x79a71738, 0
x1d) = 36
{90041} #1 poll(0x7a0147c8, 1, 200) ...................... [entry]
{90041} #1 poll(0x7a0147c8, 1, 200) ...................... = 1
{90041} #1 recv(24, 0x7a00bb80, 32768, 0) ................ [entry]
{90041} #1 recv(24, "f2\0\0010201\0\0\0\0\0X \0\0\0\0".., 32768, 0) = 115

If the call is from the main thread, the getpwnam() will return.

Cheers,

Bohai
Ermin Borovac
Honored Contributor

Re: getpwnam_r() failed on HPPA-11.23 using ldap

HP knowledge base article 4000093790 talks about problem with getpwnam_r() with multi-threaded apps.

http://www2.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000079976790

Apparently this problem should have been fixed in the latest version of LDAP-UX client (4.x) which you can download from www.software.hp.com.
Bohai Zhang
Occasional Advisor

Re: getpwnam_r() failed on HPPA-11.23 using ldap

Thanks all for the help. It works now. The app is not hung anymore.

Thanks again.

Bohai
Bohai Zhang
Occasional Advisor

Re: getpwnam_r() failed on HPPA-11.23 using ldap

Not finished yet. Some customers may make my app to reach 2G mem, so I need to do "chatr +q3p enable app" to let it over 2G mem. When it is +q3p enable, the getpwnam_r() will return 12. But if I don't do "chatr +q3p enable app", the routine could give me correct/expected return.

Cheers,

Bohai