summaryrefslogtreecommitdiff
path: root/source4/libcli/smb2/negprot.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2008-02-21 09:55:13 +1100
committerAndrew Bartlett <abartlet@samba.org>2008-02-21 09:55:13 +1100
commit774fa12ac1695600710ce9fac18024edd38161ee (patch)
tree5440d8c0f00d28656e0d8f65f3b771eb11a01842 /source4/libcli/smb2/negprot.c
parent49b3a4829325967df9d1e616ad32e5379ce6cf5d (diff)
parent910a1cafdf253255510d3aff7cc2385da43331dd (diff)
downloadsamba-774fa12ac1695600710ce9fac18024edd38161ee.tar.gz
samba-774fa12ac1695600710ce9fac18024edd38161ee.tar.bz2
samba-774fa12ac1695600710ce9fac18024edd38161ee.zip
Merge branch 'v4-0-test' of git://git.samba.org/samba into 4-0-local
(This used to be commit 5cd3310b78a85243eb436d05db3228c3495f9162)
Diffstat (limited to 'source4/libcli/smb2/negprot.c')
-rw-r--r--source4/libcli/smb2/negprot.c54
1 files changed, 35 insertions, 19 deletions
diff --git a/source4/libcli/smb2/negprot.c b/source4/libcli/smb2/negprot.c
index 38fe0e7e53..6b879e2add 100644
--- a/source4/libcli/smb2/negprot.c
+++ b/source4/libcli/smb2/negprot.c
@@ -31,16 +31,28 @@ struct smb2_request *smb2_negprot_send(struct smb2_transport *transport,
struct smb2_negprot *io)
{
struct smb2_request *req;
-
- req = smb2_request_init(transport, SMB2_OP_NEGPROT, 0x26, false, 0);
+ uint16_t size = 0x24 + io->in.dialect_count*2;
+ enum ndr_err_code ndr_err;
+ int i;
+
+ req = smb2_request_init(transport, SMB2_OP_NEGPROT, size, false, 0);
if (req == NULL) return NULL;
- /* this seems to be a bug, they use 0x24 but the length is 0x26 */
- SSVAL(req->out.body, 0x00, 0x24);
- SSVAL(req->out.body, 0x02, io->in.unknown1);
- memcpy(req->out.body+0x04, io->in.unknown2, 32);
- SSVAL(req->out.body, 0x24, io->in.unknown3);
+ SSVAL(req->out.body, 0x00, 0x24);
+ SSVAL(req->out.body, 0x02, io->in.dialect_count);
+ SSVAL(req->out.body, 0x04, io->in.security_mode);
+ SSVAL(req->out.body, 0x06, io->in.reserved);
+ SIVAL(req->out.body, 0x08, io->in.capabilities);
+ ndr_err = smbcli_push_guid(req->out.body, 0x0C, &io->in.client_guid);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ talloc_free(req);
+ return NULL;
+ }
+ smbcli_push_nttime(req->out.body, 0x1C, io->in.start_time);
+ for (i=0;i<io->in.dialect_count;i++) {
+ SSVAL(req->out.body, 0x24 + i*2, io->in.dialects[i]);
+ }
smb2_transport_send(req);
@@ -54,6 +66,7 @@ NTSTATUS smb2_negprot_recv(struct smb2_request *req, TALLOC_CTX *mem_ctx,
struct smb2_negprot *io)
{
NTSTATUS status;
+ enum ndr_err_code ndr_err;
if (!smb2_request_receive(req) ||
smb2_request_is_error(req)) {
@@ -62,24 +75,27 @@ NTSTATUS smb2_negprot_recv(struct smb2_request *req, TALLOC_CTX *mem_ctx,
SMB2_CHECK_PACKET_RECV(req, 0x40, true);
- io->out._pad = SVAL(req->in.body, 0x02);
- io->out.unknown2 = IVAL(req->in.body, 0x04);
- memcpy(io->out.sessid, req->in.body + 0x08, 16);
- io->out.unknown3 = IVAL(req->in.body, 0x18);
- io->out.unknown4 = SVAL(req->in.body, 0x1C);
- io->out.unknown5 = IVAL(req->in.body, 0x1E);
- io->out.unknown6 = IVAL(req->in.body, 0x22);
- io->out.unknown7 = SVAL(req->in.body, 0x26);
- io->out.current_time = smbcli_pull_nttime(req->in.body, 0x28);
- io->out.boot_time = smbcli_pull_nttime(req->in.body, 0x30);
+ io->out.security_mode = SVAL(req->in.body, 0x02);
+ io->out.dialect_revision = SVAL(req->in.body, 0x04);
+ io->out.reserved = SVAL(req->in.body, 0x06);
+ ndr_err = smbcli_pull_guid(req->in.body, 0x08, &io->in.client_guid);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ smb2_request_destroy(req);
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+ io->out.capabilities = IVAL(req->in.body, 0x18);
+ io->out.max_transact_size = IVAL(req->in.body, 0x1C);
+ io->out.max_read_size = IVAL(req->in.body, 0x20);
+ io->out.max_write_size = IVAL(req->in.body, 0x24);
+ io->out.system_time = smbcli_pull_nttime(req->in.body, 0x28);
+ io->out.server_start_time = smbcli_pull_nttime(req->in.body, 0x30);
+ io->out.reserved2 = IVAL(req->in.body, 0x3C);
status = smb2_pull_o16s16_blob(&req->in, mem_ctx, req->in.body+0x38, &io->out.secblob);
if (!NT_STATUS_IS_OK(status)) {
smb2_request_destroy(req);
return status;
}
-
- io->out.unknown9 = IVAL(req->in.body, 0x3C);
return smb2_request_destroy(req);
}