summaryrefslogtreecommitdiff
path: root/source4/heimdal
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2005-10-27 05:33:49 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:45:19 -0500
commit1244a97dbe900551b978b63cd07afe6cf4a61c60 (patch)
tree296c8362dc8630d074dbf8884fd9205a92b1f959 /source4/heimdal
parente5445967bc2c33b17060b465ac218c2427ceb761 (diff)
downloadsamba-1244a97dbe900551b978b63cd07afe6cf4a61c60.tar.gz
samba-1244a97dbe900551b978b63cd07afe6cf4a61c60.tar.bz2
samba-1244a97dbe900551b978b63cd07afe6cf4a61c60.zip
r11317: An ugly hack to setup the global gssapi_krb5_context early, when we
have easy access to the event context. This stops Samba dead-locking against itself when the winbindd client tries to contact the KDC. Andrew Bartlett (This used to be commit 57f811115ed768ea1f170dcd71038398bf2ab6e9)
Diffstat (limited to 'source4/heimdal')
-rw-r--r--source4/heimdal/lib/gssapi/gssapi_locl.h1
-rw-r--r--source4/heimdal/lib/gssapi/init.c22
2 files changed, 18 insertions, 5 deletions
diff --git a/source4/heimdal/lib/gssapi/gssapi_locl.h b/source4/heimdal/lib/gssapi/gssapi_locl.h
index a25e2fdcc9..1d22099877 100644
--- a/source4/heimdal/lib/gssapi/gssapi_locl.h
+++ b/source4/heimdal/lib/gssapi/gssapi_locl.h
@@ -108,6 +108,7 @@ struct gssapi_thr_context {
*/
krb5_error_code gssapi_krb5_init (void);
+krb5_error_code gssapi_krb5_init_ev (void *event_context);
#define GSSAPI_KRB5_INIT() do { \
krb5_error_code kret_gss_init; \
diff --git a/source4/heimdal/lib/gssapi/init.c b/source4/heimdal/lib/gssapi/init.c
index a642b629f4..11d7c9bb9f 100644
--- a/source4/heimdal/lib/gssapi/init.c
+++ b/source4/heimdal/lib/gssapi/init.c
@@ -89,17 +89,19 @@ gssapi_get_thread_context(int createp)
return NULL;
}
-krb5_error_code
-gssapi_krb5_init (void)
-{
- krb5_error_code ret = 0;
#ifdef _SAMBA_BUILD_
+/* Init krb5 with an event context. Disgusting Samba-specific hack */
+
+krb5_error_code
+gssapi_krb5_init_ev (void *event_context)
+{
static struct smb_krb5_context *smb_krb5_context;
+ krb5_error_code ret = 0;
HEIMDAL_MUTEX_lock(&gssapi_krb5_context_mutex);
if(smb_krb5_context == NULL) {
- ret = smb_krb5_init_context(NULL, &smb_krb5_context);
+ ret = smb_krb5_init_context(event_context, &smb_krb5_context);
}
if (ret == 0 && !created_key) {
HEIMDAL_key_create(&gssapi_context_key,
@@ -116,6 +118,16 @@ gssapi_krb5_init (void)
}
HEIMDAL_MUTEX_unlock(&gssapi_krb5_context_mutex);
+ return ret;
+}
+#endif
+
+krb5_error_code
+gssapi_krb5_init (void)
+{
+ krb5_error_code ret = 0;
+#ifdef _SAMBA_BUILD_
+ ret = gssapi_krb5_init_ev(NULL);
#else
HEIMDAL_MUTEX_lock(&gssapi_krb5_context_mutex);