]> git.ipfire.org Git - thirdparty/squid.git/blame - acinclude/krb5.m4
Factored some kerberos checks into own macros and m4 file.
[thirdparty/squid.git] / acinclude / krb5.m4
CommitLineData
c8093f05
FC
1dnl
2dnl AUTHOR: Squid Web Cache team
3dnl
4dnl SQUID Web Proxy Cache http://www.squid-cache.org/
5dnl ----------------------------------------------------------
6dnl Squid is the result of efforts by numerous individuals from
7dnl the Internet community; see the CONTRIBUTORS file for full
8dnl details. Many organizations have provided support for Squid's
9dnl development; see the SPONSORS file for full details. Squid is
10dnl Copyrighted (C) 2001 by the Regents of the University of
11dnl California; see the COPYRIGHT file for full details. Squid
12dnl incorporates software developed and/or copyrighted by other
13dnl sources; see the CREDITS file for full details.
14dnl
15dnl This program is free software; you can redistribute it and/or modify
16dnl it under the terms of the GNU General Public License as published by
17dnl the Free Software Foundation; either version 2 of the License, or
18dnl (at your option) any later version.
19dnl
20dnl This program is distributed in the hope that it will be useful,
21dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
22dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23dnl GNU General Public License for more details.
24dnl
25dnl You should have received a copy of the GNU General Public License
26dnl along with this program; if not, write to the Free Software
27dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
28
29dnl these checks must be performed in the same order as here defined,
30dnl and have mostly been lifted out of an inlined configure.in.
31
32dnl checks for a broken solaris header file, and sets squid_cv_broken_krb5_h
33dnl to yes if that's the case
34AC_DEFUN([SQUID_CHECK_KRB5_SOLARIS_BROKEN_KRB5_H], [
35 AC_CACHE_CHECK([for broken Solaris krb5.h],squid_cv_broken_krb5_h, [
36 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
37#include <krb5.h>
38int i;
39]])], [ squid_cv_broken_krb5_h=no ], [
40 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
41#if defined(__cplusplus)
42#define KRB5INT_BEGIN_DECLS extern "C" {
43#define KRB5INT_END_DECLS
44KRB5INT_BEGIN_DECLS
45#endif
46#include <krb5.h>
47int i;
48]])], [ squid_cv_broken_krb5_h=yes ], [ squid_cv_broken_krb5_h=no ])
49 ])
50 ])
51]) dnl SQUID_CHECK_KRB5_BROKEN_SOLARIS_KRB5_H
52
53
54dnl check the max skew in the krb5 context, and sets squid_cv_max_skew_context
55AC_DEFUN([SQUID_CHECK_MAX_SKEW_IN_KRB5_CONTEXT],[
56 AC_CACHE_CHECK([for max_skew in struct krb5_context],
57 squid_cv_max_skew_context, [
58 AC_COMPILE_IFELSE([
59 AC_LANG_PROGRAM([[
60#if HAVE_BROKEN_SOLARIS_KRB5_H
61#if defined(__cplusplus)
62#define KRB5INT_BEGIN_DECLS extern "C" {
63#define KRB5INT_END_DECLS
64KRB5INT_BEGIN_DECLS
65#endif
66#endif
67#include <krb5.h>
68krb5_context kc; kc->max_skew = 1;
69 ]])
70 ],[ squid_cv_max_skew_context=yes ],
71 [ squid_cv_max_skew_context=no ])
72 ])
73])
74
75dnl check whether the kerberos context has a memory cache. Sets
76dnl squid_cv_memory_cache if that's the case.
77AC_DEFUN([SQUID_CHECK_KRB5_CONTEXT_MEMORY_CACHE],[
78 AC_CACHE_CHECK([for memory cache], squid_cv_memory_cache, [
79 AC_RUN_IFELSE([
80 AC_LANG_SOURCE([[
81#if HAVE_BROKEN_SOLARIS_KRB5_H
82#if defined(__cplusplus)
83#define KRB5INT_BEGIN_DECLS extern "C" {
84#define KRB5INT_END_DECLS
85KRB5INT_BEGIN_DECLS
86#endif
87#endif
88#include <krb5.h>
89main()
90{
91 krb5_context context;
92 krb5_ccache cc;
93
94 krb5_init_context(&context);
95 return krb5_cc_resolve(context, "MEMORY:test_cache", &cc);
96}
97 ]])
98 ], [ squid_cv_memory_cache=yes ], [ squid_cv_memory_cache=no ])
99 ])
100])
101
102
103dnl checks that gssapi is ok, and sets squid_cv_working_gssapi accordingly
104AC_DEFUN([SQUID_CHECK_WORKING_GSSAPI], [
105 AC_CACHE_CHECK([for working gssapi], squid_cv_working_gssapi, [
106 AC_RUN_IFELSE([AC_LANG_SOURCE([[
107#ifdef HAVE_GSSAPI_GSSAPI_H
108#include <gssapi/gssapi.h>
109#elif HAVE_GSSAPI_H
110#include <gssapi.h>
111#endif
112
113#ifdef HAVE_GSSAPI_GSSAPI_EXT_H
114#include <gssapi/gssapi_ext.h>
115#endif
116
117#ifdef HAVE_GSSAPI_GSSAPI_KRB5_H
118#include <gssapi/gssapi_krb5.h>
119#endif
120
121#ifdef HAVE_GSSAPI_GSSAPI_GENERIC_H
122#include <gssapi/gssapi_generic.h>
123#endif
124int
125main(void)
126{
127 OM_uint32 val;
128 gss_OID_set set;
129
130 gss_create_empty_oid_set(&val, &set);
131
132 return 0;
133}
134 ]])], [ squid_cv_working_gssapi=yes ], [ squid_cv_working_gssapi=no ])])
135])
136
137
138dnl check for a working spnego, and set squid_cv_have_spnego
139AC_DEFUN([SQUID_CHECK_SPNEGO_SUPPORT], [
140 AC_CACHE_CHECK([for spnego support], squid_cv_have_spnego, [
141 AC_RUN_IFELSE([AC_LANG_SOURCE([[
142#ifdef HAVE_HEIMDAL_KERBEROS
143#ifdef HAVE_GSSAPI_GSSAPI_H
144#include <gssapi/gssapi.h>
145#elif defined(HAVE_GSSAPI_H)
146#include <gssapi.h>
147#endif
148#else
149#ifdef HAVE_GSSAPI_GSSAPI_H
150#include <gssapi/gssapi.h>
151#elif defined(HAVE_GSSAPI_H)
152#include <gssapi.h>
153#endif
154#ifdef HAVE_GSSAPI_GSSAPI_KRB5_H
155#include <gssapi/gssapi_krb5.h>
156#endif
157#ifdef HAVE_GSSAPI_GSSAPI_GENERIC_H
158#include <gssapi/gssapi_generic.h>
159#endif
160#endif
161#include <string.h>
162int main(int argc, char *argv[]) {
163 OM_uint32 major_status,minor_status;
164 gss_OID_set gss_mech_set;
165 int i;
166
167static gss_OID_desc _gss_mech_spnego = {6, (void *)"\x2b\x06\x01\x05\x05\x02"};
168gss_OID gss_mech_spnego = &_gss_mech_spnego;
169
170 major_status = gss_indicate_mechs( &minor_status, &gss_mech_set);
171
172 for (i=0;i<gss_mech_set->count;i++) {
173 if (!memcmp(gss_mech_set->elements[i].elements,gss_mech_spnego->elements,gss_mech_set->elements[i].length)) {
174 return 0;
175 }
176 }
177
178 return 1;
179}
180 ]])],
181 [ squid_cv_have_spnego=yes ], [ squid_cv_have_spnego=no ])])
182])