summaryrefslogtreecommitdiff
path: root/source4/auth
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-05-17 08:47:04 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:52:34 -0500
commitc42219d7352bd2e7a6413f7ae1cd0fd5cded1d95 (patch)
treec45f3949f0e5f434f129c6346a99d3fa0aab96df /source4/auth
parentad1cde253e5938acf2c57458b5af04f32f45edbf (diff)
downloadsamba-c42219d7352bd2e7a6413f7ae1cd0fd5cded1d95.tar.gz
samba-c42219d7352bd2e7a6413f7ae1cd0fd5cded1d95.tar.bz2
samba-c42219d7352bd2e7a6413f7ae1cd0fd5cded1d95.zip
r22969: fix some more places where we could end up with more than one event
context. We now have an event context on the torture_context, and we can also get one from the cli_credentials structure (This used to be commit c0f65eb6562e13530337c23e3447a6aa6eb8fc17)
Diffstat (limited to 'source4/auth')
-rw-r--r--source4/auth/credentials/credentials.c21
-rw-r--r--source4/auth/credentials/credentials.h3
-rw-r--r--source4/auth/credentials/credentials_krb5.c3
-rw-r--r--source4/auth/gensec/gensec_gssapi.c2
-rw-r--r--source4/auth/kerberos/krb5_init_context.c3
-rw-r--r--source4/auth/kerberos/krb5_init_context.h3
6 files changed, 31 insertions, 4 deletions
diff --git a/source4/auth/credentials/credentials.c b/source4/auth/credentials/credentials.c
index c76c170c6d..39b22df729 100644
--- a/source4/auth/credentials/credentials.c
+++ b/source4/auth/credentials/credentials.c
@@ -27,6 +27,7 @@
#include "auth/credentials/credentials.h"
#include "auth/credentials/credentials_krb5.h"
#include "libcli/auth/libcli_auth.h"
+#include "lib/events/events.h"
/**
* Create a new credentials structure
@@ -61,6 +62,7 @@ struct cli_credentials *cli_credentials_init(TALLOC_CTX *mem_ctx)
cred->tries = 3;
cred->callback_running = False;
+ cred->ev = NULL;
cli_credentials_set_kerberos_state(cred, CRED_AUTO_USE_KERBEROS);
cli_credentials_set_gensec_features(cred, 0);
@@ -747,3 +749,22 @@ BOOL cli_credentials_wrong_password(struct cli_credentials *cred)
return (cred->tries > 0);
}
+
+/*
+ set the common event context for this set of credentials
+ */
+void cli_credentials_set_event_context(struct cli_credentials *cred, struct event_context *ev)
+{
+ cred->ev = ev;
+}
+
+/*
+ set the common event context for this set of credentials
+ */
+struct event_context *cli_credentials_get_event_context(struct cli_credentials *cred)
+{
+ if (cred->ev == NULL) {
+ cred->ev = event_context_find(cred);
+ }
+ return cred->ev;
+}
diff --git a/source4/auth/credentials/credentials.h b/source4/auth/credentials/credentials.h
index ce63a55bb3..e20c6015e9 100644
--- a/source4/auth/credentials/credentials.h
+++ b/source4/auth/credentials/credentials.h
@@ -114,6 +114,9 @@ struct cli_credentials {
/* Whether any callback is currently running */
BOOL callback_running;
+
+ /* an event context for anyone wanting to use the credentials */
+ struct event_context *ev;
};
struct ldb_context;
diff --git a/source4/auth/credentials/credentials_krb5.c b/source4/auth/credentials/credentials_krb5.c
index 69fb9e7b33..58b5c1df3b 100644
--- a/source4/auth/credentials/credentials_krb5.c
+++ b/source4/auth/credentials/credentials_krb5.c
@@ -37,7 +37,8 @@ int cli_credentials_get_krb5_context(struct cli_credentials *cred,
return 0;
}
- ret = smb_krb5_init_context(cred, &cred->smb_krb5_context);
+ ret = smb_krb5_init_context(cred, cli_credentials_get_event_context(cred),
+ &cred->smb_krb5_context);
if (ret) {
return ret;
}
diff --git a/source4/auth/gensec/gensec_gssapi.c b/source4/auth/gensec/gensec_gssapi.c
index 4dd5905480..b8040df7eb 100644
--- a/source4/auth/gensec/gensec_gssapi.c
+++ b/source4/auth/gensec/gensec_gssapi.c
@@ -23,6 +23,7 @@
*/
#include "includes.h"
+#include "lib/events/events.h"
#include "system/kerberos.h"
#include "heimdal/lib/gssapi/gssapi/gssapi.h"
#include "auth/kerberos/kerberos.h"
@@ -226,6 +227,7 @@ static NTSTATUS gensec_gssapi_start(struct gensec_security *gensec_security)
}
ret = smb_krb5_init_context(gensec_gssapi_state,
+ gensec_security->event_ctx,
&gensec_gssapi_state->smb_krb5_context);
if (ret) {
DEBUG(1,("gensec_krb5_start: krb5_init_context failed (%s)\n",
diff --git a/source4/auth/kerberos/krb5_init_context.c b/source4/auth/kerberos/krb5_init_context.c
index 92de176e84..9eccd459fa 100644
--- a/source4/auth/kerberos/krb5_init_context.c
+++ b/source4/auth/kerberos/krb5_init_context.c
@@ -355,11 +355,11 @@ krb5_error_code smb_krb5_send_and_recv_func(krb5_context context,
}
krb5_error_code smb_krb5_init_context(void *parent_ctx,
+ struct event_context *ev,
struct smb_krb5_context **smb_krb5_context)
{
krb5_error_code ret;
TALLOC_CTX *tmp_ctx;
- struct event_context *ev;
char **config_files;
const char *config_file;
@@ -446,7 +446,6 @@ krb5_error_code smb_krb5_init_context(void *parent_ctx,
}
krb5_set_warn_dest((*smb_krb5_context)->krb5_context, (*smb_krb5_context)->logf);
- ev = event_context_find(*smb_krb5_context);
/* Set use of our socket lib */
ret = krb5_set_send_to_kdc_func((*smb_krb5_context)->krb5_context,
smb_krb5_send_and_recv_func,
diff --git a/source4/auth/kerberos/krb5_init_context.h b/source4/auth/kerberos/krb5_init_context.h
index 7aad97e2ca..3c012aa275 100644
--- a/source4/auth/kerberos/krb5_init_context.h
+++ b/source4/auth/kerberos/krb5_init_context.h
@@ -23,7 +23,8 @@ struct smb_krb5_context {
krb5_log_facility *logf;
};
-krb5_error_code smb_krb5_init_context(void *parent_ctx,
+struct event_context;
+krb5_error_code smb_krb5_init_context(void *parent_ctx, struct event_context *ev,
struct smb_krb5_context **smb_krb5_context);
void smb_krb5_free_context(struct smb_krb5_context *smb_krb5_context);