svn commit: samba r21949 - in branches/SAMBA_4_0/source: libcli/raw torture/unix

jpeach at samba.org jpeach at samba.org
Fri Mar 23 19:24:21 GMT 2007


Author: jpeach
Date: 2007-03-23 19:24:21 +0000 (Fri, 23 Mar 2007)
New Revision: 21949

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

Log:
After discussion with the Apple and Linux client maintainers,
changing the FindFirst response for the UNIX_INFO2 level to include
a length field before the name. The name is not required to be null
terminated. the lenght field does not count any null.

Modified:
   branches/SAMBA_4_0/source/libcli/raw/interfaces.h
   branches/SAMBA_4_0/source/libcli/raw/rawsearch.c
   branches/SAMBA_4_0/source/torture/unix/unix_info2.c


Changeset:
Modified: branches/SAMBA_4_0/source/libcli/raw/interfaces.h
===================================================================
--- branches/SAMBA_4_0/source/libcli/raw/interfaces.h	2007-03-23 19:12:08 UTC (rev 21948)
+++ branches/SAMBA_4_0/source/libcli/raw/interfaces.h	2007-03-23 19:24:21 UTC (rev 21949)
@@ -2576,7 +2576,7 @@
 		NTTIME create_time;
 		uint32_t file_flags;
 		uint32_t flags_mask;
-		const char *name;
+		struct smb_wire_string name;
 	} unix_info2;
 };
 

Modified: branches/SAMBA_4_0/source/libcli/raw/rawsearch.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/raw/rawsearch.c	2007-03-23 19:12:08 UTC (rev 21948)
+++ branches/SAMBA_4_0/source/libcli/raw/rawsearch.c	2007-03-23 19:24:21 UTC (rev 21949)
@@ -607,7 +607,12 @@
 		return ofs;
 
 	case RAW_SEARCH_DATA_UNIX_INFO2:
-		if (blob->length < (116 + 8 + 1)) {
+		/*   8 - size of ofs + file_index
+		 * 116 - size of unix_info2
+		 *   4 - size of name length
+		 *   2 - "." is the shortest name
+		 */
+		if (blob->length < (116 + 8 + 4 + 2)) {
 			return -1;
 		}
 
@@ -630,11 +635,16 @@
 		data->unix_info2.file_flags	    = IVAL(blob->data, 116);
 		data->unix_info2.flags_mask	    = IVAL(blob->data, 120);
 
-		/* There is no length field for this name but we know it's null terminated. */
-		len = smbcli_blob_pull_unix_string(tree->session, mem_ctx, blob,
-					   &data->unix_info2.name, 116 + 8, 0);
+		/* There is a 4 byte length field for this name. The length
+		 * does not include the NULL terminator.
+		 */
+		len = smbcli_blob_pull_string(tree->session, mem_ctx, blob,
+				       &data->unix_info2.name,
+				       8 + 116, /* offset to length */
+				       8 + 116 + 4, /* offset to string */
+				       0);
 
-		if (ofs != 0 && ofs < (116 + 8 + len)) {
+		if (ofs != 0 && ofs < (8 + 116 + 4 + len)) {
 			return -1;
 		}
 

Modified: branches/SAMBA_4_0/source/torture/unix/unix_info2.c
===================================================================
--- branches/SAMBA_4_0/source/torture/unix/unix_info2.c	2007-03-23 19:12:08 UTC (rev 21948)
+++ branches/SAMBA_4_0/source/torture/unix/unix_info2.c	2007-03-23 19:24:21 UTC (rev 21949)
@@ -298,7 +298,7 @@
 		if (info2.file_flags & smb_fmask) {
 			torture_assert_ntstatus_equal(torture,
 					status, NT_STATUS_OK,
-					"setting UNIX_INFO2 flags");
+					"setting valid UNIX_INFO2 flag");
 
 			if (!query_path_info2(mem_ctx, torture, cli,
 						fname, &info2)) {
@@ -314,7 +314,7 @@
 			 */
 			torture_assert_ntstatus_equal(torture,
 					status, NT_STATUS_INVALID_PARAMETER,
-					"setting UNIX_INFO2 flags");
+					"setting invalid UNIX_INFO2 flag");
 		}
 	}
 



More information about the samba-cvs mailing list