source: trunk/minix/man/man8/pwdauth.8@ 11

Last change on this file since 11 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 1.8 KB
Line 
1.TH PWDAUTH
2.SH NAME
3pwdauth \- password authentication program
4.SH SYNOPSIS
5.B /usr/lib/pwdauth
6.SH DESCRIPTION
7.B Pwdauth
8is a program that is used by the
9.BR crypt (3)
10function to do the hard work. It is a setuid root utility so that it is
11able to read the shadow password file.
12.PP
13.B Pwdauth
14expects on standard input two null terminated strings, the
15password typed by the user, and the salt. That is, the two arguments of
16the
17.B crypt
18function. The input read in a single read call must be 1024 characters or
19less including the nulls.
20.B Pwdauth
21takes one of two actions depending on the salt.
22.PP
23If the salt has the form "\fB##\fIuser\fR" then the
24.I user
25is used to index the shadow password file to obtain the encrypted password.
26The input password is encrypted with the one-way encryption function
27contained within
28.B pwdauth
29and compared to the encrypted password from the shadow password file. If
30equal then
31.B pwdauth
32returns the string "\fB##\fIuser\fR" with exit code 0, otherwise exit
33code 2 to signal failure. The string "\fB##\fIuser\fR" is also returned
34if both the shadow password and the input password are null strings to
35allow a password-less login.
36.PP
37If the salt is not of the form "\fB##\fIuser\fR" then the password is
38encrypted and the result of the encryption is returned. If salt and
39password are null strings then a null string is returned.
40.PP
41The return value is written to standard output as a null terminated string
42of 1024 characters or less including the null.
43.PP
44The exit code is 1 on any error.
45.SH "SEE ALSO"
46.BR crypt (3),
47.BR passwd (5).
48.SH NOTES
49A password must be checked like in this example:
50.PP
51.RS
52pw_ok = (strcmp(crypt(key, pw->pw_passwd), pw->pw_passwd) == 0);
53.RE
54.PP
55The second argument of crypt must be the entire encrypted password and
56not just the two character salt.
57.SH AUTHOR
58Kees J. Bot (kjb@cs.vu.nl)
Note: See TracBrowser for help on using the repository browser.