auth/gensec: add a gensec_update_ev() function
authorStefan Metzmacher <metze@samba.org>
Fri, 13 Dec 2013 18:18:48 +0000 (19:18 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 26 Mar 2014 23:36:31 +0000 (00:36 +0100)
This is the current gensec_update() which takes an optional
tevent_context structure and allows semi-async code.

This is just a temporary solution on the way to kill
the semi-async code completely, by using gensec_update_send/recv.

By providing a gensec_update_ev(), we can remove the explicit
tevent_context from gensec_update() and fix all the sane callers.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
auth/gensec/gensec.c
auth/gensec/gensec.h

index a95a6cc80c70796f17d1e9657e6855eda1aaf2a6..f824b90346a20d9c13a4c993da9456fd8d9abaa2 100644 (file)
@@ -203,20 +203,10 @@ _PUBLIC_ size_t gensec_max_update_size(struct gensec_security *gensec_security)
        return gensec_security->max_update_size;
 }
 
-/**
- * Next state function for the GENSEC state machine
- *
- * @param gensec_security GENSEC State
- * @param out_mem_ctx The TALLOC_CTX for *out to be allocated on
- * @param in The request, as a DATA_BLOB
- * @param out The reply, as an talloc()ed DATA_BLOB, on *out_mem_ctx
- * @return Error, MORE_PROCESSING_REQUIRED if a reply is sent,
- *                or NT_STATUS_OK if the user is authenticated.
- */
-
-_PUBLIC_ NTSTATUS gensec_update(struct gensec_security *gensec_security, TALLOC_CTX *out_mem_ctx,
-                               struct tevent_context *ev,
-                               const DATA_BLOB in, DATA_BLOB *out)
+_PUBLIC_ NTSTATUS gensec_update_ev(struct gensec_security *gensec_security,
+                                  TALLOC_CTX *out_mem_ctx,
+                                  struct tevent_context *ev,
+                                  const DATA_BLOB in, DATA_BLOB *out)
 {
        NTSTATUS status;
        const struct gensec_security_ops *ops = gensec_security->ops;
@@ -318,6 +308,25 @@ _PUBLIC_ NTSTATUS gensec_update(struct gensec_security *gensec_security, TALLOC_
        return status;
 }
 
+/**
+ * Next state function for the GENSEC state machine
+ *
+ * @param gensec_security GENSEC State
+ * @param out_mem_ctx The TALLOC_CTX for *out to be allocated on
+ * @param in The request, as a DATA_BLOB
+ * @param out The reply, as an talloc()ed DATA_BLOB, on *out_mem_ctx
+ * @return Error, MORE_PROCESSING_REQUIRED if a reply is sent,
+ *                or NT_STATUS_OK if the user is authenticated.
+ */
+
+_PUBLIC_ NTSTATUS gensec_update(struct gensec_security *gensec_security,
+                               TALLOC_CTX *out_mem_ctx,
+                               struct tevent_context *ev,
+                               const DATA_BLOB in, DATA_BLOB *out)
+{
+       return gensec_update_ev(gensec_security, out_mem_ctx, ev, in, out);
+}
+
 struct gensec_update_state {
        const struct gensec_security_ops *ops;
        struct tevent_req *subreq;
index 6974f8708b5088021b774ffd936a6797002e3ce4..e7ad040da2c06c11a3a87a1f683ac9adeb6d9b42 100644 (file)
@@ -149,6 +149,10 @@ size_t gensec_max_update_size(struct gensec_security *gensec_security);
 NTSTATUS gensec_update(struct gensec_security *gensec_security, TALLOC_CTX *out_mem_ctx,
                       struct tevent_context *ev,
                       const DATA_BLOB in, DATA_BLOB *out);
+NTSTATUS gensec_update_ev(struct gensec_security *gensec_security,
+                         TALLOC_CTX *out_mem_ctx,
+                         struct tevent_context *ev,
+                         const DATA_BLOB in, DATA_BLOB *out);
 struct tevent_req *gensec_update_send(TALLOC_CTX *mem_ctx,
                                      struct tevent_context *ev,
                                      struct gensec_security *gensec_security,