summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-04-28 16:06:05 +0200
committerStefan Metzmacher <metze@samba.org>2011-04-28 20:35:54 +0200
commit1b4a1673544d70928f15a78e4ef70fcc6846daba (patch)
tree8b148cebbe7ae07983f146353a550ad1db7cd74c
parent87d2537b485470ca0f0be882084d46deb682d5b8 (diff)
downloadsamba-1b4a1673544d70928f15a78e4ef70fcc6846daba.tar.gz
samba-1b4a1673544d70928f15a78e4ef70fcc6846daba.tar.bz2
samba-1b4a1673544d70928f15a78e4ef70fcc6846daba.zip
s4:libcli/smb2: move smb2_connect_socket_done()
It should be after smb2_connect_resolve_done(). metze
-rw-r--r--source4/libcli/smb2/connect.c112
1 files changed, 57 insertions, 55 deletions
diff --git a/source4/libcli/smb2/connect.c b/source4/libcli/smb2/connect.c
index 0d29577a32..5c47ca7c29 100644
--- a/source4/libcli/smb2/connect.c
+++ b/source4/libcli/smb2/connect.c
@@ -171,61 +171,6 @@ static void smb2_connect_negprot_done(struct smb2_request *smb2req)
creq->async.private_data = req;
}
-static void smb2_connect_socket_done(struct composite_context *creq)
-{
- struct tevent_req *req =
- talloc_get_type_abort(creq->async.private_data,
- struct tevent_req);
- struct smb2_connect_state *state =
- tevent_req_data(req,
- struct smb2_connect_state);
- struct smbcli_socket *sock;
- struct smb2_transport *transport;
- struct smb2_request *smb2req;
- NTSTATUS status;
- uint16_t dialects[3] = {
- SMB2_DIALECT_REVISION_000,
- SMB2_DIALECT_REVISION_202,
- SMB2_DIALECT_REVISION_210
- };
-
- status = smbcli_sock_connect_recv(creq, state, &sock);
- if (tevent_req_nterror(req, status)) {
- return;
- }
-
- transport = smb2_transport_init(sock, state, &state->options);
- if (tevent_req_nomem(transport, req)) {
- return;
- }
-
- ZERO_STRUCT(state->negprot);
- state->negprot.in.dialect_count = ARRAY_SIZE(dialects);
- switch (transport->options.signing) {
- case SMB_SIGNING_OFF:
- state->negprot.in.security_mode = 0;
- break;
- case SMB_SIGNING_SUPPORTED:
- case SMB_SIGNING_AUTO:
- state->negprot.in.security_mode = SMB2_NEGOTIATE_SIGNING_ENABLED;
- break;
- case SMB_SIGNING_REQUIRED:
- state->negprot.in.security_mode =
- SMB2_NEGOTIATE_SIGNING_ENABLED | SMB2_NEGOTIATE_SIGNING_REQUIRED;
- break;
- }
- state->negprot.in.capabilities = 0;
- unix_to_nt_time(&state->negprot.in.start_time, time(NULL));
- state->negprot.in.dialects = dialects;
-
- smb2req = smb2_negprot_send(transport, &state->negprot);
- if (tevent_req_nomem(smb2req, req)) {
- return;
- }
- smb2req->async.fn = smb2_connect_negprot_done;
- smb2req->async.private_data = req;
-}
-
static void smb2_connect_resolve_done(struct composite_context *creq);
/*
@@ -276,6 +221,8 @@ struct tevent_req *smb2_connect_send(TALLOC_CTX *mem_ctx,
return req;
}
+static void smb2_connect_socket_done(struct composite_context *creq);
+
static void smb2_connect_resolve_done(struct composite_context *creq)
{
struct tevent_req *req =
@@ -310,6 +257,61 @@ static void smb2_connect_resolve_done(struct composite_context *creq)
creq->async.private_data = req;
}
+static void smb2_connect_socket_done(struct composite_context *creq)
+{
+ struct tevent_req *req =
+ talloc_get_type_abort(creq->async.private_data,
+ struct tevent_req);
+ struct smb2_connect_state *state =
+ tevent_req_data(req,
+ struct smb2_connect_state);
+ struct smbcli_socket *sock;
+ struct smb2_transport *transport;
+ struct smb2_request *smb2req;
+ NTSTATUS status;
+ uint16_t dialects[3] = {
+ SMB2_DIALECT_REVISION_000,
+ SMB2_DIALECT_REVISION_202,
+ SMB2_DIALECT_REVISION_210
+ };
+
+ status = smbcli_sock_connect_recv(creq, state, &sock);
+ if (tevent_req_nterror(req, status)) {
+ return;
+ }
+
+ transport = smb2_transport_init(sock, state, &state->options);
+ if (tevent_req_nomem(transport, req)) {
+ return;
+ }
+
+ ZERO_STRUCT(state->negprot);
+ state->negprot.in.dialect_count = ARRAY_SIZE(dialects);
+ switch (transport->options.signing) {
+ case SMB_SIGNING_OFF:
+ state->negprot.in.security_mode = 0;
+ break;
+ case SMB_SIGNING_SUPPORTED:
+ case SMB_SIGNING_AUTO:
+ state->negprot.in.security_mode = SMB2_NEGOTIATE_SIGNING_ENABLED;
+ break;
+ case SMB_SIGNING_REQUIRED:
+ state->negprot.in.security_mode =
+ SMB2_NEGOTIATE_SIGNING_ENABLED | SMB2_NEGOTIATE_SIGNING_REQUIRED;
+ break;
+ }
+ state->negprot.in.capabilities = 0;
+ unix_to_nt_time(&state->negprot.in.start_time, time(NULL));
+ state->negprot.in.dialects = dialects;
+
+ smb2req = smb2_negprot_send(transport, &state->negprot);
+ if (tevent_req_nomem(smb2req, req)) {
+ return;
+ }
+ smb2req->async.fn = smb2_connect_negprot_done;
+ smb2req->async.private_data = req;
+}
+
NTSTATUS smb2_connect_recv(struct tevent_req *req,
TALLOC_CTX *mem_ctx,
struct smb2_tree **tree)