utils.h revision 3125ebfc35130d243e775dc38a6a59be4df0b137
c3cd0366348bcd10e42bd7be9ea05d194394f389vboxsync/*
c3cd0366348bcd10e42bd7be9ea05d194394f389vboxsync * CDDL HEADER START
c3cd0366348bcd10e42bd7be9ea05d194394f389vboxsync *
c3cd0366348bcd10e42bd7be9ea05d194394f389vboxsync * The contents of this file are subject to the terms of the
c3cd0366348bcd10e42bd7be9ea05d194394f389vboxsync * Common Development and Distribution License (the "License").
c3cd0366348bcd10e42bd7be9ea05d194394f389vboxsync * You may not use this file except in compliance with the License.
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync *
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * or http://www.opensolaris.org/os/licensing.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * See the License for the specific language governing permissions
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * and limitations under the License.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync *
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * When distributing Covered Code, include this CDDL HEADER in each
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * If applicable, add the following below this CDDL HEADER, with the
63b7dd87e08344e6015d0ac93eab40a088cd08efvboxsync * fields enclosed by brackets "[]" replaced with your own identifying
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync * information: Portions Copyright [yyyy] [name of copyright owner]
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync *
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync * CDDL HEADER END
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync */
c3cd0366348bcd10e42bd7be9ea05d194394f389vboxsync/*
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync * Use is subject to license terms.
c3cd0366348bcd10e42bd7be9ea05d194394f389vboxsync */
8c5d1958147c3988a7693b5a7666f5fe21a93b7bvboxsync
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync#ifndef _UTILS_H
c3cd0366348bcd10e42bd7be9ea05d194394f389vboxsync#define _UTILS_H
c3cd0366348bcd10e42bd7be9ea05d194394f389vboxsync
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync#pragma ident "%Z%%M% %I% %E% SMI"
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync#ifdef __cplusplus
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsyncextern "C" {
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync#endif
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync#include <security/pam_appl.h>
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync#include <security/pam_impl.h>
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync#include <krb5.h>
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync#include <netdb.h>
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync#define KRB5_DATA "SUNW-KRB5-AUTH-DATA"
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync#define ROOT_UNAME "root"
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsynctypedef struct {
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync char *user;
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync int debug;
72a8fbe590676a5f18344b52234452ff57e0d192vboxsync int warn;
72a8fbe590676a5f18344b52234452ff57e0d192vboxsync int err_on_exp;
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync int auth_status;
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync char *env; /* don't free! sent to putenv... */
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync krb5_ccache ccache; /* file credential cache */
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync krb5_context kcontext;
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync krb5_creds initcreds; /* initial creds from */
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync /* pam_authenticate() */
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync char *password;
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync int age_status;
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync krb5_timestamp expiration;
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync} krb5_module_data_t;
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsyncint get_pw_uid(char *, uid_t *);
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsyncint get_pw_gid(char *, gid_t *);
c3cd0366348bcd10e42bd7be9ea05d194394f389vboxsyncint get_kmd_kuser(krb5_context, const char *, char *, int);
c3cd0366348bcd10e42bd7be9ea05d194394f389vboxsyncint key_in_keytab(const char *, int);
c3cd0366348bcd10e42bd7be9ea05d194394f389vboxsyncint set_active_user(char *, uid_t *, gid_t *);
c3cd0366348bcd10e42bd7be9ea05d194394f389vboxsync
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync#ifdef __cplusplus
c3cd0366348bcd10e42bd7be9ea05d194394f389vboxsync}
c3cd0366348bcd10e42bd7be9ea05d194394f389vboxsync#endif
c3cd0366348bcd10e42bd7be9ea05d194394f389vboxsync
a0ec2c1df51b7654b1e72b112036527d1afa0de3vboxsync#endif /* _UTILS_H */
22314508d50d958e5d860ebdd2c1d125cbcf70c8vboxsync