diff options
author | Stefan Metzmacher <metze@samba.org> | 2006-07-01 14:14:11 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:09:42 -0500 |
commit | 6acd9aed93b09b74e53a3b854085c6c8fab41819 (patch) | |
tree | fcb31756c3b73737c81b391b62314417d883ede5 /source4 | |
parent | a18fc61d4f6140ed6081d779dbad223cdd6df0cf (diff) | |
download | samba-6acd9aed93b09b74e53a3b854085c6c8fab41819.tar.gz samba-6acd9aed93b09b74e53a3b854085c6c8fab41819.tar.bz2 samba-6acd9aed93b09b74e53a3b854085c6c8fab41819.zip |
r16734: the 2 bytes after the opcode and before the flags,
is no padding...
the following patch is needed for vista beta2 to connect to samba4
metze
(This used to be commit 58baae8fc463cd2c4e4ce532c153ad80313b03eb)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/libcli/smb2/request.c | 4 | ||||
-rw-r--r-- | source4/libcli/smb2/smb2.h | 26 | ||||
-rw-r--r-- | source4/smb_server/smb2/negprot.c | 4 | ||||
-rw-r--r-- | source4/smb_server/smb2/receive.c | 4 | ||||
-rw-r--r-- | source4/smb_server/smb2/sesssetup.c | 15 |
5 files changed, 27 insertions, 26 deletions
diff --git a/source4/libcli/smb2/request.c b/source4/libcli/smb2/request.c index 60fd6ca3ae..016c885675 100644 --- a/source4/libcli/smb2/request.c +++ b/source4/libcli/smb2/request.c @@ -78,9 +78,9 @@ struct smb2_request *smb2_request_init(struct smb2_transport *transport, uint16_ SSVAL(req->out.hdr, SMB2_HDR_PAD1, 0); SIVAL(req->out.hdr, SMB2_HDR_STATUS, 0); SSVAL(req->out.hdr, SMB2_HDR_OPCODE, opcode); - SSVAL(req->out.hdr, SMB2_HDR_PAD2, 0); + SSVAL(req->out.hdr, SMB2_HDR_UNKNOWN1,0); SIVAL(req->out.hdr, SMB2_HDR_FLAGS, 0); - SIVAL(req->out.hdr, SMB2_HDR_UNKNOWN, 0); + SIVAL(req->out.hdr, SMB2_HDR_UNKNOWN2,0); SBVAL(req->out.hdr, SMB2_HDR_SEQNUM, req->seqnum); SIVAL(req->out.hdr, SMB2_HDR_PID, 0); SIVAL(req->out.hdr, SMB2_HDR_TID, 0); diff --git a/source4/libcli/smb2/smb2.h b/source4/libcli/smb2/smb2.h index 14e6e8d835..2c1892cafc 100644 --- a/source4/libcli/smb2/smb2.h +++ b/source4/libcli/smb2/smb2.h @@ -143,19 +143,19 @@ struct smb2_request { #define SMB2_MIN_SIZE 0x42 /* offsets into header elements */ -#define SMB2_HDR_LENGTH 0x04 -#define SMB2_HDR_PAD1 0x06 -#define SMB2_HDR_STATUS 0x08 -#define SMB2_HDR_OPCODE 0x0c -#define SMB2_HDR_PAD2 0x0e -#define SMB2_HDR_FLAGS 0x10 -#define SMB2_HDR_UNKNOWN 0x14 -#define SMB2_HDR_SEQNUM 0x18 -#define SMB2_HDR_PID 0x20 -#define SMB2_HDR_TID 0x24 -#define SMB2_HDR_UID 0x28 /* 64 bit */ -#define SMB2_HDR_SIG 0x30 /* guess ... */ -#define SMB2_HDR_BODY 0x40 +#define SMB2_HDR_LENGTH 0x04 +#define SMB2_HDR_PAD1 0x06 +#define SMB2_HDR_STATUS 0x08 +#define SMB2_HDR_OPCODE 0x0c +#define SMB2_HDR_UNKNOWN1 0x0e +#define SMB2_HDR_FLAGS 0x10 +#define SMB2_HDR_UNKNOWN2 0x14 +#define SMB2_HDR_SEQNUM 0x18 +#define SMB2_HDR_PID 0x20 +#define SMB2_HDR_TID 0x24 +#define SMB2_HDR_UID 0x28 /* 64 bit */ +#define SMB2_HDR_SIG 0x30 /* guess ... */ +#define SMB2_HDR_BODY 0x40 /* SMB2 opcodes */ #define SMB2_OP_NEGPROT 0x00 diff --git a/source4/smb_server/smb2/negprot.c b/source4/smb_server/smb2/negprot.c index 6d180eb1d6..66ba902746 100644 --- a/source4/smb_server/smb2/negprot.c +++ b/source4/smb_server/smb2/negprot.c @@ -204,9 +204,9 @@ void smb2srv_reply_smb_negprot(struct smbsrv_request *smb_req) SSVAL(req->in.hdr, SMB2_HDR_PAD1, 0); SIVAL(req->in.hdr, SMB2_HDR_STATUS, 0); SSVAL(req->in.hdr, SMB2_HDR_OPCODE, SMB2_OP_NEGPROT); - SSVAL(req->in.hdr, SMB2_HDR_PAD2, 0); + SSVAL(req->in.hdr, SMB2_HDR_UNKNOWN1,0); SIVAL(req->in.hdr, SMB2_HDR_FLAGS, 0); - SIVAL(req->in.hdr, SMB2_HDR_UNKNOWN, 0); + SIVAL(req->in.hdr, SMB2_HDR_UNKNOWN2,0); SBVAL(req->in.hdr, SMB2_HDR_SEQNUM, 0); SIVAL(req->in.hdr, SMB2_HDR_PID, 0); SIVAL(req->in.hdr, SMB2_HDR_TID, 0); diff --git a/source4/smb_server/smb2/receive.c b/source4/smb_server/smb2/receive.c index 8ac90b89f9..80b626a78a 100644 --- a/source4/smb_server/smb2/receive.c +++ b/source4/smb_server/smb2/receive.c @@ -69,9 +69,9 @@ NTSTATUS smb2srv_setup_reply(struct smb2srv_request *req, uint16_t body_fixed_si SSVAL(req->out.hdr, SMB2_HDR_PAD1, 0); SIVAL(req->out.hdr, SMB2_HDR_STATUS, NT_STATUS_V(req->status)); SSVAL(req->out.hdr, SMB2_HDR_OPCODE, SVAL(req->in.hdr, SMB2_HDR_OPCODE)); - SSVAL(req->out.hdr, SMB2_HDR_PAD2, 0); + SSVAL(req->out.hdr, SMB2_HDR_UNKNOWN1,0x0001); SIVAL(req->out.hdr, SMB2_HDR_FLAGS, 0x00000001); - SIVAL(req->out.hdr, SMB2_HDR_UNKNOWN, 0); + SIVAL(req->out.hdr, SMB2_HDR_UNKNOWN2,0); SBVAL(req->out.hdr, SMB2_HDR_SEQNUM, req->seqnum); SIVAL(req->out.hdr, SMB2_HDR_PID, IVAL(req->in.hdr, SMB2_HDR_PID)); SIVAL(req->out.hdr, SMB2_HDR_TID, IVAL(req->in.hdr, SMB2_HDR_TID)); diff --git a/source4/smb_server/smb2/sesssetup.c b/source4/smb_server/smb2/sesssetup.c index 6d472c26d4..e1c326bb9d 100644 --- a/source4/smb_server/smb2/sesssetup.c +++ b/source4/smb_server/smb2/sesssetup.c @@ -119,16 +119,21 @@ failed: static void smb2srv_sesssetup_send(struct smb2srv_request *req, union smb_sesssetup *io) { - NTSTATUS status; + uint16_t unknown1; - if (NT_STATUS_IS_ERR(req->status) && !NT_STATUS_EQUAL(req->status, NT_STATUS_MORE_PROCESSING_REQUIRED)) { + if (NT_STATUS_IS_OK(req->status)) { + unknown1 = 0x0003; + } else if (NT_STATUS_EQUAL(req->status, NT_STATUS_MORE_PROCESSING_REQUIRED)) { + unknown1 = 0x0002; + } else { smb2srv_send_error(req, req->status); return; } SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x08, True, io->smb2.out.secblob.length)); - SBVAL(req->out.hdr, SMB2_HDR_UID, io->smb2.out.uid); + SSVAL(req->out.hdr, SMB2_HDR_UNKNOWN1, unknown1); + SBVAL(req->out.hdr, SMB2_HDR_UID, io->smb2.out.uid); SSVAL(req->out.body, 0x02, io->smb2.out._pad); SMB2SRV_CHECK(smb2_push_o16s16_blob(&req->out, 0x04, io->smb2.out.secblob)); @@ -139,8 +144,6 @@ static void smb2srv_sesssetup_send(struct smb2srv_request *req, union smb_sessse void smb2srv_sesssetup_recv(struct smb2srv_request *req) { union smb_sesssetup *io; - NTSTATUS status; - SMB2SRV_CHECK_BODY_SIZE(req, 0x18, True); SMB2SRV_TALLOC_IO_PTR(io, union smb_sesssetup); @@ -170,8 +173,6 @@ static NTSTATUS smb2srv_logoff_backend(struct smb2srv_request *req) static void smb2srv_logoff_send(struct smb2srv_request *req) { - NTSTATUS status; - if (NT_STATUS_IS_ERR(req->status)) { smb2srv_send_error(req, req->status); return; |