I’m currently in the process of writing a CGI blog engine in C (fun project – don’t hate! 🙂 and I’d like to enable posting for every user that has a login on the machine the webserver is running on.
What is the correct way to see if a supplied login and password match against the systems login data?
Just to clarify, if I have a shell login “user” with password “pass” on the host machine, I’d like to be able to authorize myself with the same “user” and “pass” on the CGI page.
Disclaimer: I know that sending your shell login data unencrypted over possibly multiple routers to a CGI site is as secure as trying to make fire inside a filled gas-tank, but this is (and remains) a localized fun project 🙂
You’ll need libshadow to do you authentication. There’s a convenient overview here.
http://www.linux.org/docs/ldp/howto/Shadow-Password-HOWTO-8.html