VERSION: Bump version up to 3.6.16.
[Samba.git] / source3 / include / smb_krb5.h
blob5a55d3040d559b520d1e32c943b79b71ed725156
1 /*
2 Unix SMB/CIFS implementation.
3 simple kerberos5 routines for active directory
4 Copyright (C) Andrew Tridgell 2001
5 Copyright (C) Luke Howard 2002-2003
6 Copyright (C) Andrew Bartlett <abartlet@samba.org> 2005
7 Copyright (C) Guenther Deschner 2005-2009
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #ifndef _HEADER_smb_krb5_h
24 #define _HEADER_smb_krb5_h
26 #define KRB5_PRIVATE 1 /* this file uses PRIVATE interfaces! */
27 /* this file uses DEPRECATED interfaces! */
29 #if defined(HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER)
30 #define KRB5_DEPRECATED 1
31 #else
32 #define KRB5_DEPRECATED
33 #endif
35 #if HAVE_KRB5_H
36 #include <krb5.h>
37 #endif
39 #if HAVE_GSSAPI_GSSAPI_H
40 #include <gssapi/gssapi.h>
41 #elif HAVE_GSSAPI_GSSAPI_GENERIC_H
42 #include <gssapi/gssapi_generic.h>
43 #elif HAVE_GSSAPI_H
44 #include <gssapi.h>
45 #endif
47 #if HAVE_COM_ERR_H
48 #include <com_err.h>
49 #endif
51 #ifndef KRB5_ADDR_NETBIOS
52 #define KRB5_ADDR_NETBIOS 0x14
53 #endif
55 #ifndef KRB5KRB_ERR_RESPONSE_TOO_BIG
56 #define KRB5KRB_ERR_RESPONSE_TOO_BIG (-1765328332L)
57 #endif
59 /* Heimdal uses a slightly different name */
60 #if defined(HAVE_ENCTYPE_ARCFOUR_HMAC_MD5) && !defined(HAVE_ENCTYPE_ARCFOUR_HMAC)
61 #define ENCTYPE_ARCFOUR_HMAC ENCTYPE_ARCFOUR_HMAC_MD5
62 #endif
64 /* The older versions of heimdal that don't have this
65 define don't seem to use it anyway. I'm told they
66 always use a subkey */
67 #ifndef HAVE_AP_OPTS_USE_SUBKEY
68 #define AP_OPTS_USE_SUBKEY 0
69 #endif
71 #ifdef HAVE_KRB5
72 typedef struct {
73 #if defined(HAVE_MAGIC_IN_KRB5_ADDRESS) && defined(HAVE_ADDRTYPE_IN_KRB5_ADDRESS) /* MIT */
74 krb5_address **addrs;
75 #elif defined(HAVE_KRB5_ADDRESSES) /* Heimdal */
76 krb5_addresses *addrs;
77 #else
78 #error UNKNOWN_KRB5_ADDRESS_TYPE
79 #endif /* defined(HAVE_MAGIC_IN_KRB5_ADDRESS) && defined(HAVE_ADDRTYPE_IN_KRB5_ADDRESS) */
80 } smb_krb5_addresses;
82 #ifdef HAVE_KRB5_KEYBLOCK_KEYVALUE /* Heimdal */
83 #define KRB5_KEY_TYPE(k) ((k)->keytype)
84 #define KRB5_KEY_LENGTH(k) ((k)->keyvalue.length)
85 #define KRB5_KEY_DATA(k) ((k)->keyvalue.data)
86 #define KRB5_KEY_DATA_CAST void
87 #else /* MIT */
88 #define KRB5_KEY_TYPE(k) ((k)->enctype)
89 #define KRB5_KEY_LENGTH(k) ((k)->length)
90 #define KRB5_KEY_DATA(k) ((k)->contents)
91 #define KRB5_KEY_DATA_CAST krb5_octet
92 #endif /* HAVE_KRB5_KEYBLOCK_KEYVALUE */
94 #ifdef HAVE_KRB5_KEYTAB_ENTRY_KEY /* MIT */
95 #define KRB5_KT_KEY(k) (&(k)->key)
96 #elif HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK /* Heimdal */
97 #define KRB5_KT_KEY(k) (&(k)->keyblock)
98 #else
99 #error krb5_keytab_entry has no key or keyblock member
100 #endif /* HAVE_KRB5_KEYTAB_ENTRY_KEY */
102 #endif /* HAVE_KRB5 */
104 #include "krb5_protos.h"
106 #endif /* _HEADER_smb_krb5_h */