diff options
author | Stefan Metzmacher <metze@samba.org> | 2013-12-13 10:00:24 +0100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2014-03-27 00:36:31 +0100 |
commit | 2ac1ca40f3d3c8892562caa9198ea64e76989146 (patch) | |
tree | e935bba1c8078073c9789c455534dbd5e9180502 | |
parent | 5b1d6e722e254522165ec512537a2efa2b979e6f (diff) | |
download | samba-2ac1ca40f3d3c8892562caa9198ea64e76989146.tar.gz samba-2ac1ca40f3d3c8892562caa9198ea64e76989146.tar.xz samba-2ac1ca40f3d3c8892562caa9198ea64e76989146.zip |
auth/gensec: fix gensec_update() with ev == NULL.
In future we should remove the tevent_context argument from
gensec_update() completely!
If we have sane backends we should also remove the
tevent_loop_allow_nesting() call again!
t
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r-- | auth/gensec/gensec.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/auth/gensec/gensec.c b/auth/gensec/gensec.c index 26e3ea5b5d6..a95a6cc80c7 100644 --- a/auth/gensec/gensec.c +++ b/auth/gensec/gensec.c @@ -22,6 +22,7 @@ #include "includes.h" #include "system/network.h" +#define TEVENT_DEPRECATED 1 #include <tevent.h> #include "lib/tsocket/tsocket.h" #include "lib/util/tevent_ntstatus.h" @@ -225,8 +226,25 @@ _PUBLIC_ NTSTATUS gensec_update(struct gensec_security *gensec_security, TALLOC_ if (ops->update_send == NULL) { + if (ev == NULL) { + frame = talloc_stackframe(); + + ev = samba_tevent_context_init(frame); + if (ev == NULL) { + status = NT_STATUS_NO_MEMORY; + goto fail; + } + + /* + * TODO: remove this hack once the backends + * are fixed. + */ + tevent_loop_allow_nesting(ev); + } + status = ops->update(gensec_security, out_mem_ctx, ev, in, out); + TALLOC_FREE(frame); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -271,6 +289,20 @@ _PUBLIC_ NTSTATUS gensec_update(struct gensec_security *gensec_security, TALLOC_ frame = talloc_stackframe(); + if (ev == NULL) { + ev = samba_tevent_context_init(frame); + if (ev == NULL) { + status = NT_STATUS_NO_MEMORY; + goto fail; + } + + /* + * TODO: remove this hack once the backends + * are fixed. + */ + tevent_loop_allow_nesting(ev); + } + subreq = ops->update_send(frame, ev, gensec_security, in); if (subreq == NULL) { status = NT_STATUS_NO_MEMORY; |