From 7a78d2d6b083fbd408c766116693d01b57628f28 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 11 Nov 2005 07:23:45 +0000 Subject: r11668: yay! we get a successful session setup with SMB2, and get back a 64bit uid (This used to be commit 72b34a7c1b66af6be02f66639efc55a19c73e387) --- source4/torture/smb2/connect.c | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) (limited to 'source4/torture/smb2') diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index 43029dd04d..49b9582d4d 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -76,6 +76,8 @@ static struct smb2_transport *torture_smb2_negprot(TALLOC_CTX *mem_ctx, const ch printf("current_time = %s\n", nt_time_string(mem_ctx, io.out.current_time)); printf("boot_time = %s\n", nt_time_string(mem_ctx, io.out.boot_time)); + transport->negotiate.secblob = io.out.secblob; + return transport; } @@ -89,12 +91,12 @@ static struct smb2_session *torture_smb2_session(struct smb2_transport *transpor struct smb2_session_setup io; NTSTATUS status; TALLOC_CTX *tmp_ctx = talloc_new(transport); + DATA_BLOB secblob; ZERO_STRUCT(io); io.in.unknown1 = 0x11; io.in.unknown2 = 0xF; io.in.unknown3 = 0x00; - io.in.unknown4 = 0x50; session = smb2_session_init(transport, transport, True); @@ -126,21 +128,39 @@ static struct smb2_session *torture_smb2_session(struct smb2_transport *transpor return NULL; } - status = gensec_update(session->gensec, tmp_ctx, - session->transport->negotiate.secblob, - &io.in.secblob); - if (!NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED) && - !NT_STATUS_IS_OK(status)) { - DEBUG(1, ("Failed initial gensec_update : %s\n", nt_errstr(status))); - return NULL; - } + secblob = session->transport->negotiate.secblob; + + do { + NTSTATUS status1; + + status1 = gensec_update(session->gensec, tmp_ctx, secblob, &io.in.secblob); + if (!NT_STATUS_EQUAL(status1, NT_STATUS_MORE_PROCESSING_REQUIRED) && + !NT_STATUS_IS_OK(status1)) { + DEBUG(1, ("Failed initial gensec_update : %s\n", + nt_errstr(status1))); + status = status1; + break; + } + + status = smb2_session_setup(session, tmp_ctx, &io); + secblob = io.out.secblob; + + session->uid = io.out.uid; + + if (NT_STATUS_IS_OK(status) && + NT_STATUS_EQUAL(status1, NT_STATUS_MORE_PROCESSING_REQUIRED)) { + status = gensec_update(session->gensec, tmp_ctx, secblob, + &io.in.secblob); + } + } while (NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)); - status = smb2_session_setup(session, tmp_ctx, &io); if (!NT_STATUS_IS_OK(status)) { printf("session setup failed - %s\n", nt_errstr(status)); return NULL; } + printf("Session setup gave UID 0x%llx\n", session->uid); + return session; } -- cgit