1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s4:libcli/smb2: move smb2_connect_negprot_done()

It should be after smb2_connect_socket_done().

metze
This commit is contained in:
Stefan Metzmacher 2011-04-28 16:07:49 +02:00
parent 1b4a167354
commit ad65cf5b6a

View File

@ -102,75 +102,6 @@ static void smb2_connect_session_done(struct composite_context *creq)
smb2req->async.private_data = req;
}
static void smb2_connect_negprot_done(struct smb2_request *smb2req)
{
struct tevent_req *req =
talloc_get_type_abort(smb2req->async.private_data,
struct tevent_req);
struct smb2_connect_state *state =
tevent_req_data(req,
struct smb2_connect_state);
struct smb2_transport *transport = smb2req->transport;
struct composite_context *creq;
NTSTATUS status;
status = smb2_negprot_recv(smb2req, state, &state->negprot);
if (tevent_req_nterror(req, status)) {
return;
}
transport->negotiate.secblob = state->negprot.out.secblob;
talloc_steal(transport, transport->negotiate.secblob.data);
transport->negotiate.system_time = state->negprot.out.system_time;
transport->negotiate.server_start_time = state->negprot.out.server_start_time;
transport->negotiate.security_mode = state->negprot.out.security_mode;
transport->negotiate.dialect_revision = state->negprot.out.dialect_revision;
switch (transport->options.signing) {
case SMB_SIGNING_OFF:
if (transport->negotiate.security_mode & SMB2_NEGOTIATE_SIGNING_REQUIRED) {
tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
return;
}
transport->signing_required = false;
break;
case SMB_SIGNING_SUPPORTED:
if (transport->negotiate.security_mode & SMB2_NEGOTIATE_SIGNING_REQUIRED) {
transport->signing_required = true;
} else {
transport->signing_required = false;
}
break;
case SMB_SIGNING_AUTO:
if (transport->negotiate.security_mode & SMB2_NEGOTIATE_SIGNING_ENABLED) {
transport->signing_required = true;
} else {
transport->signing_required = false;
}
break;
case SMB_SIGNING_REQUIRED:
if (transport->negotiate.security_mode & SMB2_NEGOTIATE_SIGNING_ENABLED) {
transport->signing_required = true;
} else {
tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
return;
}
break;
}
state->session = smb2_session_init(transport, state->gensec_settings, state, true);
if (tevent_req_nomem(state->session, req)) {
return;
}
creq = smb2_session_setup_spnego_send(state->session, state->credentials);
if (tevent_req_nomem(creq, req)) {
return;
}
creq->async.fn = smb2_connect_session_done;
creq->async.private_data = req;
}
static void smb2_connect_resolve_done(struct composite_context *creq);
/*
@ -257,6 +188,8 @@ static void smb2_connect_resolve_done(struct composite_context *creq)
creq->async.private_data = req;
}
static void smb2_connect_negprot_done(struct smb2_request *smb2req);
static void smb2_connect_socket_done(struct composite_context *creq)
{
struct tevent_req *req =
@ -312,6 +245,75 @@ static void smb2_connect_socket_done(struct composite_context *creq)
smb2req->async.private_data = req;
}
static void smb2_connect_negprot_done(struct smb2_request *smb2req)
{
struct tevent_req *req =
talloc_get_type_abort(smb2req->async.private_data,
struct tevent_req);
struct smb2_connect_state *state =
tevent_req_data(req,
struct smb2_connect_state);
struct smb2_transport *transport = smb2req->transport;
struct composite_context *creq;
NTSTATUS status;
status = smb2_negprot_recv(smb2req, state, &state->negprot);
if (tevent_req_nterror(req, status)) {
return;
}
transport->negotiate.secblob = state->negprot.out.secblob;
talloc_steal(transport, transport->negotiate.secblob.data);
transport->negotiate.system_time = state->negprot.out.system_time;
transport->negotiate.server_start_time = state->negprot.out.server_start_time;
transport->negotiate.security_mode = state->negprot.out.security_mode;
transport->negotiate.dialect_revision = state->negprot.out.dialect_revision;
switch (transport->options.signing) {
case SMB_SIGNING_OFF:
if (transport->negotiate.security_mode & SMB2_NEGOTIATE_SIGNING_REQUIRED) {
tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
return;
}
transport->signing_required = false;
break;
case SMB_SIGNING_SUPPORTED:
if (transport->negotiate.security_mode & SMB2_NEGOTIATE_SIGNING_REQUIRED) {
transport->signing_required = true;
} else {
transport->signing_required = false;
}
break;
case SMB_SIGNING_AUTO:
if (transport->negotiate.security_mode & SMB2_NEGOTIATE_SIGNING_ENABLED) {
transport->signing_required = true;
} else {
transport->signing_required = false;
}
break;
case SMB_SIGNING_REQUIRED:
if (transport->negotiate.security_mode & SMB2_NEGOTIATE_SIGNING_ENABLED) {
transport->signing_required = true;
} else {
tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
return;
}
break;
}
state->session = smb2_session_init(transport, state->gensec_settings, state, true);
if (tevent_req_nomem(state->session, req)) {
return;
}
creq = smb2_session_setup_spnego_send(state->session, state->credentials);
if (tevent_req_nomem(creq, req)) {
return;
}
creq->async.fn = smb2_connect_session_done;
creq->async.private_data = req;
}
NTSTATUS smb2_connect_recv(struct tevent_req *req,
TALLOC_CTX *mem_ctx,
struct smb2_tree **tree)