From 90024fb09d04ccf4d7068f4ab41886829f29c906 Mon Sep 17 00:00:00 2001 From: baalberith Date: Sat, 4 Oct 2008 08:51:17 +0000 Subject: [PATCH] fixed threading issues as described in ticket [ 1971514 ] --- config.h.in | 4 ++++ configure.in | 3 +++ src/mod_auth_kerb.c | 10 ++++++++++ 3 files changed, 17 insertions(+) diff --git a/config.h.in b/config.h.in index fec7ca1..8f09067 100644 --- a/config.h.in +++ b/config.h.in @@ -17,3 +17,7 @@ /* Define if your GSSAPI library supports handling SPNEGO tokens */ #undef GSSAPI_SUPPORTS_SPNEGO + +/* Define if your krb supports krb5_cc_new_unique function to deal with threading issues */ +#undef HAVE_KRB5_CC_NEW_UNIQUE + diff --git a/configure.in b/configure.in index 96f9330..95b70b1 100644 --- a/configure.in +++ b/configure.in @@ -117,6 +117,9 @@ if test "x$with_krb5" != "xno" ; then else with_krb5=yes AC_DEFINE(KRB5) + AC_CHECK_LIB(krb5, + krb5_cc_new_unique, + [ AC_DEFINE(HAVE_KRB5_CC_NEW_UNIQUE) ]) # check for Heimdal have_heimdal="" diff --git a/src/mod_auth_kerb.c b/src/mod_auth_kerb.c index 6cf8370..1f2cbae 100644 --- a/src/mod_auth_kerb.c +++ b/src/mod_auth_kerb.c @@ -568,7 +568,12 @@ verify_krb5_init_creds(request_rec *r, krb5_context context, krb5_creds *creds, } else keytab = ap_req_keytab; +#ifdef HAVE_KRB5_CC_NEW_UNIQUE + ret = krb5_cc_new_unique(context, "MEMORY", NULL, &local_ccache); +#else ret = krb5_cc_resolve(context, "MEMORY:", &local_ccache); +#endif + if (ret) { log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "krb5_cc_resolve() failed when verifying KDC"); @@ -715,7 +720,12 @@ verify_krb5_user(request_rec *r, krb5_context context, krb5_principal principal, goto end; } +#ifdef HAVE_KRB5_CC_NEW_UNIQUE + ret = krb5_cc_new_unique(context, "MEMORY", NULL, &ret_ccache); +#else ret = krb5_cc_resolve(context, "MEMORY:", &ret_ccache); +#endif + if (ret) { log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "generating new memory ccache failed: %s", -- 2.1.4