svn commit: samba r16736 - in branches/SAMBA_4_0/source/torture/smb2: .

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


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

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

Log:
- convert unix times to nttime before sending it to the wire...
- return an error code if an error happens

metze
Modified:
   branches/SAMBA_4_0/source/torture/smb2/util.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/smb2/util.c
===================================================================
--- branches/SAMBA_4_0/source/torture/smb2/util.c	2006-07-01 14:18:20 UTC (rev 16735)
+++ branches/SAMBA_4_0/source/torture/smb2/util.c	2006-07-01 14:20:14 UTC (rev 16736)
@@ -147,15 +147,16 @@
 	setfile.generic.level = RAW_SFILEINFO_BASIC_INFORMATION;
 	setfile.generic.in.file.handle = *handle;
 
-	setfile.basic_info.in.create_time = t +  9*30*24*60*60;
-	setfile.basic_info.in.access_time = t +  6*30*24*60*60;
-	setfile.basic_info.in.write_time  = t +  3*30*24*60*60;
-	setfile.basic_info.in.change_time = t +  1*30*24*60*60;
+	unix_to_nt_time(&setfile.basic_info.in.create_time, t + 9*30*24*60*60);
+	unix_to_nt_time(&setfile.basic_info.in.access_time, t + 6*30*24*60*60);
+	unix_to_nt_time(&setfile.basic_info.in.write_time,  t + 3*30*24*60*60);
+	unix_to_nt_time(&setfile.basic_info.in.change_time, t + 1*30*24*60*60);
 	setfile.basic_info.in.attrib      = FILE_ATTRIBUTE_NORMAL;
 
 	status = smb2_setinfo_file(tree, &setfile);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("Failed to setup file times - %s\n", nt_errstr(status));
+		return status;
 	}
 
 	/* make sure all the timestamps aren't the same */
@@ -165,19 +166,28 @@
 	status = smb2_getinfo_file(tree, tree, &fileinfo);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("Failed to query file times - %s\n", nt_errstr(status));
+		return status;
+		
 	}
 
-	if (setfile.basic_info.in.create_time != fileinfo.basic_info.out.create_time) {
-		printf("create_time not setup correctly\n");
-	}
-	if (setfile.basic_info.in.access_time != fileinfo.basic_info.out.access_time) {
-		printf("access_time not setup correctly\n");
-	}
-	if (setfile.basic_info.in.write_time != fileinfo.basic_info.out.write_time) {
-		printf("write_time not setup correctly\n");
-	}
-	
-	return NT_STATUS_OK;
+#define CHECK_TIME(field) do {\
+	if (setfile.basic_info.in.field != fileinfo.basic_info.out.field) { \
+		printf("(%s) " #field " not setup correctly: %s(%llu) => %s(%llu)\n", \
+			__location__, \
+			nt_time_string(tree, setfile.basic_info.in.field), \
+			setfile.basic_info.in.field, \
+			nt_time_string(tree, fileinfo.basic_info.out.field), \
+			fileinfo.basic_info.out.field); \
+		status = NT_STATUS_INVALID_PARAMETER; \
+	} \
+} while (0)
+
+	CHECK_TIME(create_time);
+	CHECK_TIME(access_time);
+	CHECK_TIME(write_time);
+	CHECK_TIME(change_time);
+
+	return status;
 }
 
 /*



More information about the samba-cvs mailing list