1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
/* chkpassword.c - check the password */
#ifndef lint
static char *rcsid = "$Header$";
#endif
/*
* $Header$
*
*
* $Log$
* Revision 1.1 1994/06/10 03:27:03 eichin
* autoconfed isode for kerberos work
*
* Revision 1.1 94/06/10 03:15:30 eichin
* autoconfed isode for kerberos work
*
* Revision 1.1 1994/05/31 20:33:35 eichin
* reduced-isode release from /mit/isode/isode-subset/src
*
* Revision 8.0 91/07/17 12:17:50 isode
* Release 7.0
*
*
*/
/*
* NOTICE
*
* Acquisition, use, and distribution of this module and related
* materials are subject to the restrictions of a license agreement.
* Consult the Preface in the User's Manual for the full terms of
* this agreement.
*
*/
/* LINTLIBRARY */
#include <stdio.h>
#include "general.h"
#include "manifest.h"
char *crypt ();
#ifdef KRB_PASSWD
#include <krb.h>
#endif
/* L.McLoughlin added kerberos passwd checking - based on original
* code from xnlock by S. Lacey.
* Takes the username, the password from the password file, and the passwd
* the user is trying to use.
* Returns 1 if the passwd matches otherwise 0.
*/
#ifndef KRB_PASSWD
/* ARGSUSED */
#endif
int chkpassword ( usrname, pwpass, usrpass )
char *usrname;
char *pwpass;
char *usrpass;
{
#ifdef KRB_PASSWD
char realm[REALM_SZ];
int krbval;
/*
* check to see if the passwd is `*krb*'
* if it is, use kerberos
*/
if (strcmp(pwpass, "*krb*") == 0) {
/*
* use kerberos, first of all find the realm
*/
if (krb_get_lrealm(realm, 1) != KSUCCESS) {
(void) strncpy(realm, KRB_REALM, sizeof(realm));
}
/*
* now check the passwd
*/
krbval = krb_get_pw_in_tkt(usrname, "",
realm, "krbtgt",
realm,
DEFAULT_TKT_LIFE, usrpass);
return (krbval == INTK_OK);;
}
#endif
/*
* use passwd file password
*/
return (strcmp(crypt(usrpass, pwpass), pwpass) == 0);
}
|