summaryrefslogtreecommitdiff
path: root/source4/heimdal/lib/gssapi
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2005-09-17 01:11:50 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:38:13 -0500
commitf3bce652c8c33712ffbb6c0a731f61b05f9d4be0 (patch)
treeb57b78a83e15e65d15ecb0ffa37efa1bab079708 /source4/heimdal/lib/gssapi
parent3a4da8c0dbe1d50ca4de013fdb7c860a5196f4ca (diff)
downloadsamba-f3bce652c8c33712ffbb6c0a731f61b05f9d4be0.tar.gz
samba-f3bce652c8c33712ffbb6c0a731f61b05f9d4be0.tar.bz2
samba-f3bce652c8c33712ffbb6c0a731f61b05f9d4be0.zip
r10286: This patch is ugly and disgusting, but for now it works better than the other
ideas I have had. When I get a full list of things I want to do to a krb5_context I'll either add gsskrb5_ wrappers, or a way of speicfying the krb5 context per gssapi context. (I want to ensure that the only krb5_context variables created while executing Samba4 are via our wrapper). Andrew Bartlett (This used to be commit 8a22d46e70e9f863831aba0c9913d195f833d625)
Diffstat (limited to 'source4/heimdal/lib/gssapi')
-rw-r--r--source4/heimdal/lib/gssapi/init.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/source4/heimdal/lib/gssapi/init.c b/source4/heimdal/lib/gssapi/init.c
index 37f46624ae..a642b629f4 100644
--- a/source4/heimdal/lib/gssapi/init.c
+++ b/source4/heimdal/lib/gssapi/init.c
@@ -35,6 +35,10 @@
RCSID("$Id: init.c,v 1.7 2003/07/22 19:50:11 lha Exp $");
+#ifdef _SAMBA_BUILD_
+#include "auth/kerberos/krb5_init_context.h"
+#endif
+
static HEIMDAL_MUTEX gssapi_krb5_context_mutex = HEIMDAL_MUTEX_INITIALIZER;
static int created_key;
static HEIMDAL_thread_key gssapi_context_key;
@@ -89,11 +93,35 @@ krb5_error_code
gssapi_krb5_init (void)
{
krb5_error_code ret = 0;
+#ifdef _SAMBA_BUILD_
+ static struct smb_krb5_context *smb_krb5_context;
HEIMDAL_MUTEX_lock(&gssapi_krb5_context_mutex);
- if(gssapi_krb5_context == NULL)
+ if(smb_krb5_context == NULL) {
+ ret = smb_krb5_init_context(NULL, &smb_krb5_context);
+ }
+ if (ret == 0 && !created_key) {
+ HEIMDAL_key_create(&gssapi_context_key,
+ gssapi_destroy_thread_context,
+ ret);
+ if (ret) {
+ smb_krb5_free_context(smb_krb5_context);
+ smb_krb5_context = NULL;
+ } else
+ created_key = 1;
+ }
+ if (ret == 0) {
+ gssapi_krb5_context = smb_krb5_context->krb5_context;
+ }
+
+ HEIMDAL_MUTEX_unlock(&gssapi_krb5_context_mutex);
+#else
+ HEIMDAL_MUTEX_lock(&gssapi_krb5_context_mutex);
+
+ if(gssapi_krb5_context == NULL) {
ret = krb5_init_context (&gssapi_krb5_context);
+ }
if (ret == 0 && !created_key) {
HEIMDAL_key_create(&gssapi_context_key,
gssapi_destroy_thread_context,
@@ -106,6 +134,6 @@ gssapi_krb5_init (void)
}
HEIMDAL_MUTEX_unlock(&gssapi_krb5_context_mutex);
-
+#endif
return ret;
}