The problem which others seem to have missed is that you probably don't have permission to read /etc/shadow - that's why the passwords are kept in a separate file, to prevent non-root users from reading them. The only way for a non-root user to check a password is to simulare a logon.
The ways to do this are:1. Attempt a logon [messy]
2. Attempt an ftp access [probably the easiest]
3. Run an su command with password [not sure]
The easiest is probably number 2. You'd login to their account using the supplied password, and either check for the correct NNN status codes from FTP, or check that a directory listing of '.' returns something. Sorry I don't have time to write a version of number 2 at the moment but it shouldn't be hard if you can find some FTP code around the place and just use that.
- Brian