svn commit: samba r16734 - in branches/SAMBA_4_0/source: libcli/smb2 smb_server/smb2

metze at samba.org metze at samba.org
Sat Jul 1 14:14:12 GMT 2006


Author: metze
Date: 2006-07-01 14:14:11 +0000 (Sat, 01 Jul 2006)
New Revision: 16734

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16734

Log:
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
Modified:
   branches/SAMBA_4_0/source/libcli/smb2/request.c
   branches/SAMBA_4_0/source/libcli/smb2/smb2.h
   branches/SAMBA_4_0/source/smb_server/smb2/negprot.c
   branches/SAMBA_4_0/source/smb_server/smb2/receive.c
   branches/SAMBA_4_0/source/smb_server/smb2/sesssetup.c


Changeset:
Modified: branches/SAMBA_4_0/source/libcli/smb2/request.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/smb2/request.c	2006-07-01 14:12:13 UTC (rev 16733)
+++ branches/SAMBA_4_0/source/libcli/smb2/request.c	2006-07-01 14:14:11 UTC (rev 16734)
@@ -78,9 +78,9 @@
 	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);

Modified: branches/SAMBA_4_0/source/libcli/smb2/smb2.h
===================================================================
--- branches/SAMBA_4_0/source/libcli/smb2/smb2.h	2006-07-01 14:12:13 UTC (rev 16733)
+++ branches/SAMBA_4_0/source/libcli/smb2/smb2.h	2006-07-01 14:14:11 UTC (rev 16734)
@@ -143,19 +143,19 @@
 #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

Modified: branches/SAMBA_4_0/source/smb_server/smb2/negprot.c
===================================================================
--- branches/SAMBA_4_0/source/smb_server/smb2/negprot.c	2006-07-01 14:12:13 UTC (rev 16733)
+++ branches/SAMBA_4_0/source/smb_server/smb2/negprot.c	2006-07-01 14:14:11 UTC (rev 16734)
@@ -204,9 +204,9 @@
 	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);

Modified: branches/SAMBA_4_0/source/smb_server/smb2/receive.c
===================================================================
--- branches/SAMBA_4_0/source/smb_server/smb2/receive.c	2006-07-01 14:12:13 UTC (rev 16733)
+++ branches/SAMBA_4_0/source/smb_server/smb2/receive.c	2006-07-01 14:14:11 UTC (rev 16734)
@@ -69,9 +69,9 @@
 	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));

Modified: branches/SAMBA_4_0/source/smb_server/smb2/sesssetup.c
===================================================================
--- branches/SAMBA_4_0/source/smb_server/smb2/sesssetup.c	2006-07-01 14:12:13 UTC (rev 16733)
+++ branches/SAMBA_4_0/source/smb_server/smb2/sesssetup.c	2006-07-01 14:14:11 UTC (rev 16734)
@@ -119,16 +119,21 @@
 
 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,9 +144,7 @@
 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 void smb2srv_logoff_send(struct smb2srv_request *req)
 {
-	NTSTATUS status;
-
 	if (NT_STATUS_IS_ERR(req->status)) {
 		smb2srv_send_error(req, req->status);
 		return;



More information about the samba-cvs mailing list