xref: /titanic_44/usr/src/lib/pam_modules/krb5/utils.h (revision 269473047d747f7815af570197e4ef7322d3632c)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _UTILS_H
27 #define	_UTILS_H
28 
29 #ifdef	__cplusplus
30 extern "C" {
31 #endif
32 
33 #include <security/pam_appl.h>
34 #include <security/pam_impl.h>
35 #include <krb5.h>
36 #include <netdb.h>
37 
38 #define	KRB5_DATA	"SUNW-KRB5-AUTH-DATA"
39 #define	ROOT_UNAME	"root"
40 
41 typedef struct {
42 	char		*user;
43 	int		debug;
44 	int		warn;
45 	int		err_on_exp;
46 	int		auth_status;
47 	char		*env;		/* don't free! sent to putenv... */
48 	krb5_ccache	ccache;		/* file credential cache */
49 	krb5_context	kcontext;
50 	krb5_creds	initcreds;	/* initial creds from */
51 					/* pam_authenticate() */
52 	char		*password;
53 	int		age_status;
54 	krb5_timestamp	expiration;
55 } krb5_module_data_t;
56 
57 int get_pw_uid(char *, uid_t *);
58 int get_pw_gid(char *, gid_t *);
59 int get_kmd_kuser(krb5_context, const char *, char *, int);
60 int key_in_keytab(const char *, int);
61 
62 #ifdef	__cplusplus
63 }
64 #endif
65 
66 #endif /* _UTILS_H */
67