xref: /onnv-gate/usr/src/lib/pam_modules/krb5/utils.h (revision 11778:00fd14fdd3d4)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
53391Ssemery  * Common Development and Distribution License (the "License").
63391Ssemery  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*11778SWill.Fiveash@Sun.COM  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef _UTILS_H
270Sstevel@tonic-gate #define	_UTILS_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #ifdef	__cplusplus
300Sstevel@tonic-gate extern "C" {
310Sstevel@tonic-gate #endif
320Sstevel@tonic-gate 
330Sstevel@tonic-gate #include <security/pam_appl.h>
340Sstevel@tonic-gate #include <security/pam_impl.h>
350Sstevel@tonic-gate #include <krb5.h>
360Sstevel@tonic-gate #include <netdb.h>
370Sstevel@tonic-gate 
380Sstevel@tonic-gate #define	KRB5_DATA	"SUNW-KRB5-AUTH-DATA"
390Sstevel@tonic-gate #define	ROOT_UNAME	"root"
400Sstevel@tonic-gate 
41*11778SWill.Fiveash@Sun.COM enum preauth_types {
42*11778SWill.Fiveash@Sun.COM 	KRB_PASSWD,
43*11778SWill.Fiveash@Sun.COM 	KRB_PKINIT };
44*11778SWill.Fiveash@Sun.COM 
450Sstevel@tonic-gate typedef struct {
463391Ssemery 	char		*user;
470Sstevel@tonic-gate 	int		debug;
480Sstevel@tonic-gate 	int		warn;
490Sstevel@tonic-gate 	int		err_on_exp;
500Sstevel@tonic-gate 	int		auth_status;
510Sstevel@tonic-gate 	char		*env;		/* don't free! sent to putenv... */
520Sstevel@tonic-gate 	krb5_ccache	ccache;		/* file credential cache */
530Sstevel@tonic-gate 	krb5_context	kcontext;
540Sstevel@tonic-gate 	krb5_creds	initcreds;	/* initial creds from */
550Sstevel@tonic-gate 					/* pam_authenticate() */
560Sstevel@tonic-gate 	char		*password;
570Sstevel@tonic-gate 	int		age_status;
583641Ssemery 	krb5_timestamp	expiration;
59*11778SWill.Fiveash@Sun.COM 	int		auth_calls;
60*11778SWill.Fiveash@Sun.COM 	enum preauth_types preauth_type;
610Sstevel@tonic-gate } krb5_module_data_t;
620Sstevel@tonic-gate 
630Sstevel@tonic-gate int get_pw_uid(char *, uid_t *);
640Sstevel@tonic-gate int get_pw_gid(char *, gid_t *);
650Sstevel@tonic-gate int get_kmd_kuser(krb5_context, const char *, char *, int);
660Sstevel@tonic-gate int key_in_keytab(const char *, int);
670Sstevel@tonic-gate 
680Sstevel@tonic-gate #ifdef	__cplusplus
690Sstevel@tonic-gate }
700Sstevel@tonic-gate #endif
710Sstevel@tonic-gate 
720Sstevel@tonic-gate #endif /* _UTILS_H */
73