« Return to Thread: Issues while authenticating a user over openLDAP through C progarm using PAM

Issues while authenticating a user over openLDAP through C progarm using PAM

by Vikrant :: Rate this Message:

Reply to Author | View in Thread

Hi all

I am using openLDAP 2.3.32 on RHEL 4.

I have configured PAM to have the authentication over LDAP. SSH and su work fine and authenticate the users over LDAP. But when tried to authenticate user through C code using Linux_PAM API, it fails.

Here are the LDAP logs when tried it through SSH or su


conn=2 fd=12 ACCEPT from IP=135.27.151.4:54980 (IP=0.0.0.0:389)
conn=2 op=0 BIND dn="" method=128
conn=2 op=0 RESULT tag=97 err=0 text=
conn=2 op=1 SRCH base="ou=people,dc=avaya,dc=com" scope=2 deref=0 filter="(uid=admin)"
conn=2 op=1 SEARCH RESULT tag=101 err=0 nentries=1 text=
conn=3 fd=15 ACCEPT from IP=135.27.151.4:54981 (IP=0.0.0.0:389)
conn=2 op=2 UNBIND
conn=2 fd=12 closed ()
conn=3 op=0 BIND dn="" method=128
conn=3 op=0 RESULT tag=97 err=0 text=
conn=3 op=1 SRCH base="ou=people,dc=avaya,dc=com" scope=2 deref=0 filter="(&(objectClass=posixAccount)(uid=admin))"
conn=3 op=1 SEARCH RESULT tag=101 err=0 nentries=1 text=
conn=3 op=2 SRCH base="ou=people,dc=avaya,dc=com" scope=2 deref=0 filter="(&(objectClass=posixGroup)(|(memberUid=admin)(uniqueMember=uid=admin,ou=people,dc=avaya,dc=com)))"
conn=3 op=2 SRCH attr=gidNumber
conn=3 op=2 SEARCH RESULT tag=101 err=0 nentries=0 text=
conn=3 fd=15 closed (connection lost)

And the user is successfully authenticated

But when tried it through C program using Linux_PAM API, I get the following logs

conn=5 fd=12 ACCEPT from IP=135.27.151.4:54986 (IP=0.0.0.0:389)
conn=5 op=0 BIND dn="" method=128
conn=5 op=0 RESULT tag=97 err=0 text=
conn=5 op=1 SRCH base="ou=people,dc=avaya,dc=com" scope=2 deref=0 filter="(uid=admin)"
conn=5 op=1 SEARCH RESULT tag=101 err=0 nentries=1 text=
conn=5 op=2 UNBIND
conn=5 fd=12 closed ()

And the authentication is failed for the same user. The PAM service which is started in C program has got the similar specs as that of "su", i.e it is configured for LDAP.

Not sure what is going wrong above

 « Return to Thread: Issues while authenticating a user over openLDAP through C progarm using PAM