Problem writing module

Thiago Bezerra Lima e Silva tbls at brturbo.com
Mon Jan 24 12:48:12 UTC 2005


>A few more things to try -  
>  
>Run the test harness in GDB and step through the code to see where it's hanging  
  
Thats what I did.  
  
>- Run the test harness on a set of modules that are known to work & compare the results  
>- Try isolating which phase the hang is occurring in (maybe it's session?) by using pam_permit in  
all phases except the one you're testing.  
  
I did that too. Session is hanging. Also, later, I splitted the module in two. One of them is a nss .so  
that has a function to perform the authentication (perform_auth()). The other, is the actual pam  
module, with pam_sm_setcred returning PAM_SUCCESS, and pam_sm_authenticate() that dlopens  
the nss .so, calls perform_auth, and dlcloses.  
  
Now the results: doing this all, and debugging the test harness, pam_sm_authenticate is called my  
pam module, wich dlopens the nss .so calls perform_auth(), dlcloses and return PAM_SUCCESS.  
Then, test harness hangs on session (pam_unix module, support.c, line 53, "syslog(err, format,  
args);"). However, if I comment the dlopen/dlclose on my my pam_module and don't use my  
nss .so, (returning PAM_SUCCESS without do anything), everything works!!  
  
Now, simplifying things, I wrote a pam module with only pam_sm_authenticate() and 
pam_sm_setcred(). The only thing pam_sm_authenticate does is dlopen my nss .so, dlclose and 
return PAM_SUCCESS. Nothing more. 
 
For my nss .so, I wrote a single blank funcion (and didn't called) . As I expected, session hanged. 
Latter, I remove the lib flags used to build my nss .so, and session stop hanging. I mean...is not 
working because my pam module is dlopening a .so that is linked with NSS libs. Removing the 
"-lnss3, -lssl3" , etc, from my lib works.  Am I missing some compiler/linker/dlopen catch?? 
I'm suposing this isn't about PAM anymore, but if anyone know about this, I would be grateful! 
 
Thiago 
 


More information about the Pam-list mailing list