xref: /titanic_50/usr/src/lib/pam_modules/krb5/utils.h (revision 70f41fc1780388c4982cfd631297b0fe7df26d8c)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
53bfb48feSsemery  * Common Development and Distribution License (the "License").
63bfb48feSsemery  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*70f41fc1SWill Fiveash  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef _UTILS_H
277c478bd9Sstevel@tonic-gate #define	_UTILS_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
307c478bd9Sstevel@tonic-gate extern "C" {
317c478bd9Sstevel@tonic-gate #endif
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #include <security/pam_appl.h>
347c478bd9Sstevel@tonic-gate #include <security/pam_impl.h>
357c478bd9Sstevel@tonic-gate #include <krb5.h>
367c478bd9Sstevel@tonic-gate #include <netdb.h>
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #define	KRB5_DATA	"SUNW-KRB5-AUTH-DATA"
397c478bd9Sstevel@tonic-gate #define	ROOT_UNAME	"root"
407c478bd9Sstevel@tonic-gate 
41*70f41fc1SWill Fiveash enum preauth_types {
42*70f41fc1SWill Fiveash 	KRB_PASSWD,
43*70f41fc1SWill Fiveash 	KRB_PKINIT };
44*70f41fc1SWill Fiveash 
457c478bd9Sstevel@tonic-gate typedef struct {
463bfb48feSsemery 	char		*user;
477c478bd9Sstevel@tonic-gate 	int		debug;
487c478bd9Sstevel@tonic-gate 	int		warn;
497c478bd9Sstevel@tonic-gate 	int		err_on_exp;
507c478bd9Sstevel@tonic-gate 	int		auth_status;
517c478bd9Sstevel@tonic-gate 	char		*env;		/* don't free! sent to putenv... */
527c478bd9Sstevel@tonic-gate 	krb5_ccache	ccache;		/* file credential cache */
537c478bd9Sstevel@tonic-gate 	krb5_context	kcontext;
547c478bd9Sstevel@tonic-gate 	krb5_creds	initcreds;	/* initial creds from */
557c478bd9Sstevel@tonic-gate 					/* pam_authenticate() */
567c478bd9Sstevel@tonic-gate 	char		*password;
577c478bd9Sstevel@tonic-gate 	int		age_status;
583125ebfcSsemery 	krb5_timestamp	expiration;
59*70f41fc1SWill Fiveash 	int		auth_calls;
60*70f41fc1SWill Fiveash 	enum preauth_types preauth_type;
617c478bd9Sstevel@tonic-gate } krb5_module_data_t;
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate int get_pw_uid(char *, uid_t *);
647c478bd9Sstevel@tonic-gate int get_pw_gid(char *, gid_t *);
657c478bd9Sstevel@tonic-gate int get_kmd_kuser(krb5_context, const char *, char *, int);
667c478bd9Sstevel@tonic-gate int key_in_keytab(const char *, int);
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
697c478bd9Sstevel@tonic-gate }
707c478bd9Sstevel@tonic-gate #endif
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate #endif /* _UTILS_H */
73