xref: /titanic_41/usr/src/lib/pam_modules/krb5/utils.h (revision 3125ebfc35130d243e775dc38a6a59be4df0b137)
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 2007 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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 #include <security/pam_appl.h>
36 #include <security/pam_impl.h>
37 #include <krb5.h>
38 #include <netdb.h>
39 
40 #define	KRB5_DATA	"SUNW-KRB5-AUTH-DATA"
41 #define	ROOT_UNAME	"root"
42 
43 typedef struct {
44 	char		*user;
45 	int		debug;
46 	int		warn;
47 	int		err_on_exp;
48 	int		auth_status;
49 	char		*env;		/* don't free! sent to putenv... */
50 	krb5_ccache	ccache;		/* file credential cache */
51 	krb5_context	kcontext;
52 	krb5_creds	initcreds;	/* initial creds from */
53 					/* pam_authenticate() */
54 	char		*password;
55 	int		age_status;
56 	krb5_timestamp	expiration;
57 } krb5_module_data_t;
58 
59 int get_pw_uid(char *, uid_t *);
60 int get_pw_gid(char *, gid_t *);
61 int get_kmd_kuser(krb5_context, const char *, char *, int);
62 int key_in_keytab(const char *, int);
63 int set_active_user(char *, uid_t *, gid_t *);
64 
65 #ifdef	__cplusplus
66 }
67 #endif
68 
69 #endif /* _UTILS_H */
70