<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16481" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=625443921-03082007><FONT face=宋体>I'm studying on pam library , 
and I run the code given by "The Linux-PAM Application Developer's Guide" on 
redhat linux.</FONT></SPAN></DIV>
<DIV><SPAN class=625443921-03082007><FONT face=宋体></FONT></SPAN> </DIV>
<DIV><SPAN class=625443921-03082007><FONT face=宋体>"retval = 
pam_authenticate(pamh, 0);" is running successfully</FONT></SPAN></DIV>
<DIV><SPAN class=625443921-03082007><FONT face=宋体></FONT></SPAN> </DIV>
<DIV><SPAN class=625443921-03082007><FONT face=宋体>but the next "retval = 
pam_acct_mgmt(pamh, 0);" return "PAM_AUTHINFO_UNAVAIL"</FONT></SPAN></DIV>
<DIV><SPAN class=625443921-03082007><FONT face=宋体></FONT></SPAN> </DIV>
<DIV><SPAN class=625443921-03082007><FONT face=宋体>I don't know what problem is 
it? Please do me a favour.</FONT></SPAN></DIV>
<DIV><SPAN class=625443921-03082007><FONT face=宋体></FONT></SPAN> </DIV>
<DIV><SPAN class=625443921-03082007><FONT face=宋体>Thank you very 
much</FONT></SPAN></DIV>
<DIV><SPAN class=625443921-03082007><FONT face=宋体></FONT></SPAN> </DIV>
<DIV><SPAN class=625443921-03082007><FONT face=宋体>Chu Qiu</FONT></SPAN></DIV>
<DIV><SPAN class=625443921-03082007><FONT face=宋体></FONT></SPAN> </DIV>
<DIV><SPAN class=625443921-03082007><FONT face=宋体>This is the code, and the 
service file is the same as what mentioned in this code</FONT></SPAN></DIV>
<DIV><SPAN class=625443921-03082007><FONT face=宋体>/*<BR>This program was 
contributed by Shane Watts<BR>[modifications by AGM and kukuk]<BR>You need to 
add the following (or equivalent) to the<BR>/etc/pam.d/check_user file:<BR># 
check authorization<BR>auth required pam_unix.so<BR>account required 
pam_unix.so<BR>*/<BR>#include <security/pam_appl.h><BR>#include 
<security/pam_misc.h><BR>#include <stdio.h><BR>static struct 
pam_conv conv = {<BR>misc_conv,<BR>NULL<BR>};<BR>int main(int argc, char 
*argv[])<BR>{<BR>pam_handle_t *pamh=NULL;<BR>int retval;<BR>const char 
*user="nobody";<BR>if(argc == 2) {<BR>user = argv[1];<BR>}<BR>if(argc > 2) 
{<BR>fprintf(stderr, "Usage: check_user 
[username]\n");<BR>exit(1);<BR>}<BR>retval = pam_start("check_user", user, 
&conv, &pamh);<BR>if (retval == PAM_SUCCESS)<BR>retval = 
pam_authenticate(pamh, 0); /* is user really user? */</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=625443921-03082007><FONT face=宋体>if (retval == 
PAM_SUCCESS)<BR>retval = pam_acct_mgmt(pamh, 0); /* permitted access? 
*/<BR><BR>/* This is where we have been authorized or not. */<BR>if (retval == 
PAM_SUCCESS) {<BR>fprintf(stdout, "Authenticated\n");<BR>} else 
{<BR>fprintf(stdout, "Not Authenticated\n");<BR>}<BR>if (pam_end(pamh,retval) != 
PAM_SUCCESS) { /* close Linux-PAM */<BR>pamh = NULL;<BR>fprintf(stderr, 
"check_user: failed to release authenticator\n");<BR>exit(1);<BR>}<BR>return ( 
retval == PAM_SUCCESS ? 0:1 ); /* indicate success */<BR>}</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV class=Section1>
<P class=MsoAutoSig>
<P class=MsoAutoSig><SPAN lang=EN-US style="FONT-SIZE: 12pt"><?xml:namespace 
prefix = o ns = "urn:schemas-microsoft-com:office:office" 
/><o:p></o:p></SPAN></P><SPAN lang=EN-US style="FONT-SIZE: 12pt"><o:p><FONT 
face=宋体></FONT></o:p></SPAN></P></DIV>
<DIV> </DIV></BODY></HTML>