krb5-config doesn't provide -I flag (in CFLAGS) for directory containing comm_err...
[freeradius.git] / src / modules / rlm_krb5 / krb5.h
1 /*
2  *   This program is free software; you can redistribute it and/or modify
3  *   it under the terms of the GNU General Public License as published by
4  *   the Free Software Foundation; either version 2 of the License, or
5  *   (at your option) any later version.
6  *
7  *   This program is distributed in the hope that it will be useful,
8  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
9  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  *   GNU General Public License for more details.
11  *
12  *   You should have received a copy of the GNU General Public License
13  *   along with this program; if not, write to the Free Software
14  *   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
15  */
16
17 /**
18  * $Id$
19  * @file krb5.h
20  * @brief types and function signatures for rlm_krb5.
21  *
22  * @copyright 2013  The FreeRADIUS server project
23  * @copyright 2013  Arran Cudbard-Bell <a.cudbardb@freeradius.org>
24  */
25 RCSIDH(krb5_h, "$Id$")
26
27 #if defined(KRB5_IS_THREAD_SAFE) && !defined(HAVE_PTHREAD_H)
28 #  undef KRB5_IS_THREAD_SAFE
29 #endif
30
31 /* krb5 includes */
32 #include <krb5.h>
33
34 typedef struct rlm_krb5_handle {
35         krb5_context    context;
36         krb5_keytab     keytab;
37
38 #ifdef HEIMDAL_KRB5
39         krb5_ccache     ccache;
40         krb5_verify_opt options;
41 #endif
42 } rlm_krb5_handle_t;
43
44 /** Instance configuration for rlm_krb5
45  *
46  * Holds the configuration and preparsed data for a instance of rlm_krb5.
47  */
48 typedef struct rlm_krb5_t {
49 #ifdef KRB5_IS_THREAD_SAFE
50         fr_connection_pool_t    *pool;          //!< Connection pool instance.
51 #else
52         rlm_krb5_handle_t       *conn;
53 #endif
54
55         char const              *xlat_name;     //!< This module's instance name.
56         char const              *keytabname;    //!< The keytab to resolve the service in.
57         char const              *service_princ; //!< The service name provided by the
58                                                 //!< config parser.
59
60         char                    *hostname;      //!< The hostname component of
61                                                 //!< service_princ, or NULL.
62         char                    *service;       //!< The service component of service_princ, or NULL.
63
64         krb5_context context;                   //!< The kerberos context (cloned once per request).
65
66 #ifndef HEIMDAL_KRB5
67         krb5_get_init_creds_opt         *gic_options;   //!< Options to pass to the get_initial_credentials
68                                                         //!< function.
69         krb5_verify_init_creds_opt      *vic_options;   //!< Options to pass to the validate_initial_creds
70                                                         //!< function.
71
72         krb5_principal server;                  //!< A structure representing the parsed
73                                                 //!< service_princ.
74 #endif
75 } rlm_krb5_t;
76
77 /*
78  *      MIT Kerberos uses comm_err, so the macro just expands to a call
79  *      to error_message.
80  */
81 #ifndef HEIMDAL_KRB5
82 #  ifdef ET_COMM_ERR
83 #    include <et/com_err.h>
84 #  else
85 #    include <com_err.h>
86 #  endif
87 #  define rlm_krb5_error(_x, _y) error_message(_y)
88 #else
89 char const *rlm_krb5_error(krb5_context context, krb5_error_code code);
90 #endif
91
92 void *mod_conn_create(void *instance);
93
94 int mod_conn_delete(UNUSED void *instance, void *handle);