Compile question?

Jason Gerfen jason.gerfen at scl.utah.edu
Fri Jun 4 19:33:51 UTC 2004


When compiling a new PAM module I have found several variations of 
making the module.

Examples:
 From the PAM module writers guide-

% gcc -shared -Xlinker -x -o pam_module.so pam_module.o -lwhatever

>From a tutorial found on linuxjournal-

% gcc -fPIC -c pam_module.c
% ld -x --shared -o pam_module.so pam_module.o

>From a tutorial found on linuxdevcenter.com-

% gcc -o pam_module.so -lpam pam_module.c

I am still fairly new to C, however when compiling a new pam source file 
from the directory specified in the pam module writters guide on all 
instances it fails.

My question is if I wanted a PAM module to simply gather the user name 
of the currently logged in user (on success) or place an error message 
in a simple text file on login I would take the following steps (correct 
me if I am wrong);

1. Place the I/O function within the pam_sm_authenticate function() 
(because I want the file to be created / appended to as the user is 
attempting to log in).  I ask because I have also been told that this 
would go under the pam_sm_start_session() function because once the user 
is logged in it would create the file and work much like a startup 
script.  I have tried it both ways and both have failed.

2. During compile time if I have linked against header files such as 
#include <io.h> or #include <errono.h> I would need to compile the new 
module with links to these libraries, if this is correct could you give 
me an example of how this is accomplished. (I have never created a 
shared object like this before, so please bear with me.)

3. Are there differences in how PAM might be used in say a SuSE 
distribution vs. a RedHat distribution?

Thanks a ton,

-- 
Jason Gerfen

"...Sometimes I just yell at myself. And it
 makes me sad, sometimes I make myself cry..."
			~ My nephew Dawsyn






More information about the Pam-list mailing list