auth/kerberos: Move gse_get_session_key() to common code and use in gensec_gssapi
[samba.git] / source3 / include / smb_krb5.h
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
8
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.
13
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.
18
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/>.
21 */
22
23 #ifndef _HEADER_smb_krb5_h
24 #define _HEADER_smb_krb5_h
25
26 #ifdef HAVE_KRB5
27
28 #define KRB5_PRIVATE    1       /* this file uses PRIVATE interfaces! */
29 /* this file uses DEPRECATED interfaces! */
30
31 #if defined(HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER)
32 #define KRB5_DEPRECATED 1
33 #else
34 #define KRB5_DEPRECATED
35 #endif
36
37 #include "libcli/auth/krb5_wrap.h"
38
39 #ifndef KRB5_ADDR_NETBIOS
40 #define KRB5_ADDR_NETBIOS 0x14
41 #endif
42
43 #ifndef KRB5KRB_ERR_RESPONSE_TOO_BIG
44 #define KRB5KRB_ERR_RESPONSE_TOO_BIG (-1765328332L)
45 #endif
46
47 /* Heimdal uses a slightly different name */
48 #if defined(HAVE_ENCTYPE_ARCFOUR_HMAC_MD5) && !defined(HAVE_ENCTYPE_ARCFOUR_HMAC)
49 #define ENCTYPE_ARCFOUR_HMAC ENCTYPE_ARCFOUR_HMAC_MD5
50 #endif
51
52 /* The older versions of heimdal that don't have this
53    define don't seem to use it anyway.  I'm told they
54    always use a subkey */
55 #ifndef HAVE_AP_OPTS_USE_SUBKEY
56 #define AP_OPTS_USE_SUBKEY 0
57 #endif
58
59 typedef struct {
60 #if defined(HAVE_MAGIC_IN_KRB5_ADDRESS) && defined(HAVE_ADDRTYPE_IN_KRB5_ADDRESS) /* MIT */
61         krb5_address **addrs;
62 #elif defined(HAVE_KRB5_ADDRESSES) /* Heimdal */
63         krb5_addresses *addrs;
64 #else
65 #error UNKNOWN_KRB5_ADDRESS_TYPE
66 #endif /* defined(HAVE_MAGIC_IN_KRB5_ADDRESS) && defined(HAVE_ADDRTYPE_IN_KRB5_ADDRESS) */
67 } smb_krb5_addresses;
68
69 #ifdef HAVE_KRB5_KEYTAB_ENTRY_KEY               /* MIT */
70 #define KRB5_KT_KEY(k)          (&(k)->key)
71 #elif HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK          /* Heimdal */
72 #define KRB5_KT_KEY(k)          (&(k)->keyblock)
73 #else
74 #error krb5_keytab_entry has no key or keyblock member
75 #endif /* HAVE_KRB5_KEYTAB_ENTRY_KEY */
76
77 #endif /* HAVE_KRB5 */
78
79 #include "krb5_protos.h"
80
81 #endif /* _HEADER_smb_krb5_h */