Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 May 1996 18:08:24 -0600
From:      Sean Kelly <kelly@fsl.noaa.gov>
To:        ims@bcgrizzly.com
Cc:        questions@freebsd.org
Message-ID:  <199606010008.AAA24931@gatekeeper.fsl.noaa.gov>
In-Reply-To: <199606010001.RAA21750@kodiak.bcgrizzly.com> (message from Ed Imhoff on Fri, 31 May 96 19:49:49 -700)

next in thread | previous in thread | raw e-mail | index | archive | help
>>>>> "Ed" == Ed Imhoff <ims@bcgrizzly.com> writes:

    Ed> Hello :) I'm trying to code some HTML to allow a user to login
    Ed> via WWW interface.  How do I create a form that authenticates
    Ed> a user???

In C, look up the user's password entry with getpwent(3), then get the
password salt from the pw_passwd field and pass that along with the
typed password to crypt(3).  Compare the result to the pw_passwd field
with strcmp(3).  If it's identical, authenticate.  If not, punt 'em
out.

The perl solution is similar and is left as an exercise.  :-)

See /usr/src/usr.bin/login/login.c for sample code.

-- 
Sean Kelly                          
NOAA Forecast Systems Laboratory    kelly@fsl.noaa.gov
Boulder Colorado USA                http://www-sdd.fsl.noaa.gov/~kelly/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199606010008.AAA24931>