1
/* pwcheck_getpwnam.c -- check passwords using getpwname()
2
$Id: pwcheck_getpwnam.c,v 1.1 1999/08/26 16:22:43 leg Exp $
4
Copyright 1998, 1999 Carnegie Mellon University
8
Permission to use, copy, modify, and distribute this software and its
9
documentation for any purpose and without fee is hereby granted,
10
provided that the above copyright notice appear in all copies and that
11
both that copyright notice and this permission notice appear in
12
supporting documentation, and that the name of Carnegie Mellon
13
University not be used in advertising or publicity pertaining to
14
distribution of the software without specific, written prior
17
CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
18
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
19
FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE FOR
20
ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
21
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
22
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
23
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
24
******************************************************************/
30
char *pwcheck(userid, password)
37
pwd = getpwnam(userid);
39
r = "Userid not found";
41
else if (pwd->pw_passwd[0] == '*') {
42
r = "Account disabled";
44
else if (strcmp(pwd->pw_passwd, crypt(password, pwd->pw_passwd)) != 0) {
45
r = "Incorrect password";