summaryrefslogtreecommitdiff
path: root/source4/heimdal/lib/krb5/context.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-11-11 11:27:33 +1100
committerAndrew Bartlett <abartlet@samba.org>2010-11-15 01:25:06 +0000
commit1342185e333cb8139b7a70b7fe43571bcc2716a7 (patch)
tree0e1cb8d3cfc437bd7cc3a97f2bdc472f54d95dbd /source4/heimdal/lib/krb5/context.c
parent13fd22f61017124d2d4964db3e32c667d119b56c (diff)
downloadsamba-1342185e333cb8139b7a70b7fe43571bcc2716a7.tar.gz
samba-1342185e333cb8139b7a70b7fe43571bcc2716a7.tar.bz2
samba-1342185e333cb8139b7a70b7fe43571bcc2716a7.zip
s4:heimdal: import lorikeet-heimdal-201011102149 (commit 5734d03c20e104c8f45533d07f2a2cbbd3224f29)
Diffstat (limited to 'source4/heimdal/lib/krb5/context.c')
-rw-r--r--source4/heimdal/lib/krb5/context.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/source4/heimdal/lib/krb5/context.c b/source4/heimdal/lib/krb5/context.c
index f68ab46cec..100eb1237d 100644
--- a/source4/heimdal/lib/krb5/context.c
+++ b/source4/heimdal/lib/krb5/context.c
@@ -317,6 +317,26 @@ kt_ops_copy(krb5_context context, const krb5_context src_context)
return 0;
}
+static const char *sysplugin_dirs[] = {
+ LIBDIR "/plugin/krb5",
+#ifdef __APPLE__
+ "/Library/KerberosPlugins/KerberosFrameworkPlugins",
+ "/System/Library/KerberosPlugins/KerberosFrameworkPlugins",
+#endif
+ NULL
+};
+
+static void
+init_context_once(void *ctx)
+{
+ krb5_context context = ctx;
+
+ _krb5_load_plugins(context, "krb5", sysplugin_dirs);
+
+ bindtextdomain(HEIMDAL_TEXTDOMAIN, HEIMDAL_LOCALEDIR);
+}
+
+
/**
* Initializes the context structure and reads the configuration file
* /etc/krb5.conf. The structure should be freed by calling
@@ -335,15 +355,13 @@ kt_ops_copy(krb5_context context, const krb5_context src_context)
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_init_context(krb5_context *context)
{
+ static heim_base_once_t init_context = HEIM_BASE_ONCE_INIT;
krb5_context p;
krb5_error_code ret;
char **files;
*context = NULL;
- /* should have a run_once */
- bindtextdomain(HEIMDAL_TEXTDOMAIN, HEIMDAL_LOCALEDIR);
-
p = calloc(1, sizeof(*p));
if(!p)
return ENOMEM;
@@ -382,6 +400,8 @@ out:
if(ret) {
krb5_free_context(p);
p = NULL;
+ } else {
+ heim_base_once_f(&init_context, p, init_context_once);
}
*context = p;
return ret;