3 pwdauth \- password authentication program
8 is a program that is used by the
10 function to do the hard work. It is a setuid root utility so that it is
11 able to read the shadow password file.
14 expects on standard input two null terminated strings, the
15 password typed by the user, and the salt. That is, the two arguments of
18 function. The input read in a single read call must be 1024 characters or
19 less including the nulls.
21 takes one of two actions depending on the salt.
23 If the salt has the form "\fB##\fIuser\fR" then the
25 is used to index the shadow password file to obtain the encrypted password.
26 The input password is encrypted with the one-way encryption function
29 and compared to the encrypted password from the shadow password file. If
32 returns the string "\fB##\fIuser\fR" with exit code 0, otherwise exit
33 code 2 to signal failure. The string "\fB##\fIuser\fR" is also returned
34 if both the shadow password and the input password are null strings to
35 allow a password-less login.
37 If the salt is not of the form "\fB##\fIuser\fR" then the password is
38 encrypted and the result of the encryption is returned. If salt and
39 password are null strings then a null string is returned.
41 The return value is written to standard output as a null terminated string
42 of 1024 characters or less including the null.
44 The exit code is 1 on any error.
49 A password must be checked like in this example:
52 pw_ok = (strcmp(crypt(key, pw->pw_passwd), pw->pw_passwd) == 0);
55 The second argument of crypt must be the entire encrypted password and
56 not just the two character salt.
58 Kees J. Bot (kjb@cs.vu.nl)