On Wed, 14 Feb 2001, Shridhar Daithankar wrote:

> You can use pam. Need to read about it. Everything should be available in
> /usr/doc.
> 
> HTH
> Prashanth Venkatesh wrote:
> > How can i programatically(using shell/C/java) verify
> > the user id and password of the users logging into my

Never got to read the Pam docs, but you can do what you ask for with a bit
of c. Use getpw_nam() to locate the passwd string as stored in the
/etc/passwd. Take the 1st 2 chars and save that as a string. Lets call
this salt[2].
  Now get the passwd the user entered in another string say char
*response. Use 

char* encrypted = crypt( response, salt). 

Now do a strncpy() on encrypted and the passwd you obtained from
get_pwnam(). If they match...thats your user.
  
  Man pages to look out for, crypt, getpw_ent. I think perl has a good
interface for all this too, suresh keeps posting a neat little script,
time to time.

sreangsu 



----------------------------------------------
An alpha version of a web based tool to manage
your subscription with this mailing list is at
http://lists.linux-india.org/cgi-bin/mj_wwwusr

Reply via email to