mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
auth/gensec: convert external.c to provide update_send/recv
Signed-off-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
parent
ac6083eb72
commit
99ffef3de2
auth/gensec
@ -20,6 +20,8 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
#include <tevent.h>
|
||||
#include "lib/util/tevent_ntstatus.h"
|
||||
#include "auth/credentials/credentials.h"
|
||||
#include "auth/gensec/gensec.h"
|
||||
#include "auth/gensec/gensec_internal.h"
|
||||
@ -42,12 +44,51 @@ static NTSTATUS gensec_external_start(struct gensec_security *gensec_security)
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
static NTSTATUS gensec_external_update(struct gensec_security *gensec_security,
|
||||
TALLOC_CTX *out_mem_ctx,
|
||||
struct tevent_context *ev,
|
||||
const DATA_BLOB in, DATA_BLOB *out)
|
||||
struct gensec_external_update_state {
|
||||
DATA_BLOB out;
|
||||
};
|
||||
|
||||
static struct tevent_req *gensec_external_update_send(TALLOC_CTX *mem_ctx,
|
||||
struct tevent_context *ev,
|
||||
struct gensec_security *gensec_security,
|
||||
const DATA_BLOB in)
|
||||
{
|
||||
*out = data_blob_talloc(out_mem_ctx, "", 0);
|
||||
struct tevent_req *req;
|
||||
struct gensec_external_update_state *state = NULL;
|
||||
|
||||
req = tevent_req_create(mem_ctx, &state,
|
||||
struct gensec_external_update_state);
|
||||
if (req == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
state->out = data_blob_talloc(state, "", 0);
|
||||
if (tevent_req_nomem(state->out.data, req)) {
|
||||
return tevent_req_post(req, ev);
|
||||
}
|
||||
|
||||
tevent_req_done(req);
|
||||
return tevent_req_post(req, ev);
|
||||
}
|
||||
|
||||
static NTSTATUS gensec_external_update_recv(struct tevent_req *req,
|
||||
TALLOC_CTX *out_mem_ctx,
|
||||
DATA_BLOB *out)
|
||||
{
|
||||
struct gensec_external_update_state *state =
|
||||
tevent_req_data(req,
|
||||
struct gensec_external_update_state);
|
||||
NTSTATUS status;
|
||||
|
||||
*out = data_blob_null;
|
||||
|
||||
if (tevent_req_is_nterror(req, &status)) {
|
||||
tevent_req_received(req);
|
||||
return status;
|
||||
}
|
||||
|
||||
*out = state->out;
|
||||
tevent_req_received(req);
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
@ -62,7 +103,8 @@ static const struct gensec_security_ops gensec_external_ops = {
|
||||
.name = "sasl-EXTERNAL",
|
||||
.sasl_name = "EXTERNAL",
|
||||
.client_start = gensec_external_start,
|
||||
.update = gensec_external_update,
|
||||
.update_send = gensec_external_update_send,
|
||||
.update_recv = gensec_external_update_recv,
|
||||
.have_feature = gensec_external_have_feature,
|
||||
.enabled = true,
|
||||
.priority = GENSEC_EXTERNAL
|
||||
|
@ -32,6 +32,6 @@ bld.SAMBA_MODULE('gensec_ncalrpc',
|
||||
bld.SAMBA_MODULE('gensec_external',
|
||||
source='external.c',
|
||||
subsystem='gensec',
|
||||
deps='samba-debug talloc',
|
||||
deps='samba-debug talloc tevent tevent-util',
|
||||
init_function='gensec_external_init'
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user