[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Wed May 19 22:29:30 MDT 2010


The branch, master has been updated
       via  2c61c93... Fix bug 7442 - Samba returns incorrect SMB2 QFS device info.
       via  fad5d33... Fix connecting to [homes] share over SMB2.
       via  b7067ee... Correctly check error code return.
      from  1ad551c... After talking with Microsoft engineers, immediately replying on compound requests on open being deferred for a sharing violation is a Windows bug. Re-enable the code that simply delays the compound response if the delay time is less than 2 seconds.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 2c61c93a51a8e8c41da8a54945dc67d6dc416141
Author: Jeremy Allison <jra at samba.org>
Date:   Wed May 19 21:28:08 2010 -0700

    Fix bug 7442 - Samba returns incorrect SMB2 QFS device info.
    
    Add the correct devicetype and characteristics for this info level.
    
    Jeremy.

commit fad5d33bf880bcc137f7cb47e72cd0e07d92eec3
Author: Jeremy Allison <jra at samba.org>
Date:   Wed May 19 21:27:43 2010 -0700

    Fix connecting to [homes] share over SMB2.
    
    Jeremy.

commit b7067ee5f786dd2a06172014bbd7cd78d9129b47
Author: Jeremy Allison <jra at samba.org>
Date:   Wed May 19 21:27:17 2010 -0700

    Correctly check error code return.
    
    Jeremy.

-----------------------------------------------------------------------

Summary of changes:
 source3/include/trans2.h |   14 ++++++++++++++
 source3/libsmb/ntlmssp.c |    2 +-
 source3/smbd/smb2_tcon.c |   23 ++++++++++++++++++++---
 source3/smbd/trans2.c    |   11 +++++++++--
 4 files changed, 44 insertions(+), 6 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/trans2.h b/source3/include/trans2.h
index d425545..8152a7b 100644
--- a/source3/include/trans2.h
+++ b/source3/include/trans2.h
@@ -334,6 +334,20 @@ Byte offset   Type     name                description
 #define SMB_FS_FULL_SIZE_INFORMATION			1007
 #define SMB_FS_OBJECTID_INFORMATION			1008
 
+/* SMB_FS_DEVICE_INFORMATION device types. */
+#define FILE_DEVICE_CD_ROM		0x2
+#define FILE_DEVICE_DISK		0x7
+
+/* SMB_FS_DEVICE_INFORMATION characteristics. */
+#define FILE_REMOVABLE_MEDIA		0x001
+#define FILE_READ_ONLY_DEVICE		0x002
+#define FILE_FLOPPY_DISKETTE		0x004
+#define FILE_WRITE_ONCE_MEDIA		0x008
+#define FILE_REMOTE_DEVICE		0x010
+#define FILE_DEVICE_IS_MOUNTED		0x020
+#define FILE_VIRTUAL_VOLUME		0x040
+#define FILE_DEVICE_SECURE_OPEN		0x100
+
 /* flags on trans2 findfirst/findnext that control search */
 #define FLAG_TRANS2_FIND_CLOSE          0x1
 #define FLAG_TRANS2_FIND_CLOSE_IF_END   0x2
diff --git a/source3/libsmb/ntlmssp.c b/source3/libsmb/ntlmssp.c
index 2fc8adf..8dcd26a 100644
--- a/source3/libsmb/ntlmssp.c
+++ b/source3/libsmb/ntlmssp.c
@@ -540,7 +540,7 @@ static NTSTATUS ntlmssp_server_negotiate(struct ntlmssp_state *ntlmssp_state,
 						&vers,
 						(ndr_push_flags_fn_t)ndr_push_VERSION);
 
-			if (err) {
+			if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
 				return NT_STATUS_NO_MEMORY;
 			}
 		}
diff --git a/source3/smbd/smb2_tcon.c b/source3/smbd/smb2_tcon.c
index 084ded9..f3e3037 100644
--- a/source3/smbd/smb2_tcon.c
+++ b/source3/smbd/smb2_tcon.c
@@ -152,6 +152,7 @@ static NTSTATUS smbd_smb2_tree_connect(struct smbd_smb2_request *req,
 	int snum = -1;
 	struct smbd_smb2_tcon *tcon;
 	connection_struct *compat_conn = NULL;
+	user_struct *compat_vuser = req->session->compat_vuser;
 	int id;
 	NTSTATUS status;
 
@@ -169,15 +170,31 @@ static NTSTATUS smbd_smb2_tree_connect(struct smbd_smb2_request *req,
 
 	strlower_m(service);
 
-	snum = find_service(service);
+	/* TODO: do more things... */
+	if (strequal(service,HOMES_NAME)) {
+		if (compat_vuser->homes_snum == -1) {
+			DEBUG(2, ("[homes] share not available for "
+				"user %s because it was not found "
+				"or created at session setup "
+				"time\n",
+				compat_vuser->server_info->unix_name));
+			return NT_STATUS_BAD_NETWORK_NAME;
+		}
+		snum = compat_vuser->homes_snum;
+	} else if ((compat_vuser->homes_snum != -1)
+                   && strequal(service,
+			lp_servicename(compat_vuser->homes_snum))) {
+		snum = compat_vuser->homes_snum;
+	} else {
+		snum = find_service(service);
+	}
+
 	if (snum < 0) {
 		DEBUG(3,("smbd_smb2_tree_connect: couldn't find service %s\n",
 			 service));
 		return NT_STATUS_BAD_NETWORK_NAME;
 	}
 
-	/* TODO: do more things... */
-
 	/* create a new tcon as child of the session */
 	tcon = talloc_zero(req->session, struct smbd_smb2_tcon);
 	if (tcon == NULL) {
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index dec9d7f..6e1defa 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -3123,10 +3123,17 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
 
 		case SMB_QUERY_FS_DEVICE_INFO:
 		case SMB_FS_DEVICE_INFORMATION:
+		{
+			uint32_t characteristics = FILE_DEVICE_IS_MOUNTED;
+
+			if (!CAN_WRITE(conn)) {
+				characteristics |= FILE_READ_ONLY_DEVICE;
+			}
 			data_len = 8;
-			SIVAL(pdata,0,0); /* dev type */
-			SIVAL(pdata,4,0); /* characteristics */
+			SIVAL(pdata,0,FILE_DEVICE_DISK); /* dev type */
+			SIVAL(pdata,4,characteristics);
 			break;
+		}
 
 #ifdef HAVE_SYS_QUOTAS
 		case SMB_FS_QUOTA_INFORMATION:


-- 
Samba Shared Repository


More information about the samba-cvs mailing list