svn commit: samba r8182 - in branches/SAMBA_4_0/source/torture/basic: .

vlendec at samba.org vlendec at samba.org
Wed Jul 6 13:24:38 GMT 2005


Author: vlendec
Date: 2005-07-06 13:24:38 +0000 (Wed, 06 Jul 2005)
New Revision: 8182

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

Log:
Little more testing delete-on-close: Check flag with qfileinfo.

Volker

Modified:
   branches/SAMBA_4_0/source/torture/basic/delete.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/basic/delete.c
===================================================================
--- branches/SAMBA_4_0/source/torture/basic/delete.c	2005-07-06 12:33:52 UTC (rev 8181)
+++ branches/SAMBA_4_0/source/torture/basic/delete.c	2005-07-06 13:24:38 UTC (rev 8182)
@@ -24,8 +24,8 @@
 #include "system/filesys.h"
 #include "librpc/gen_ndr/ndr_security.h"
 
-static BOOL check_delete_on_close(struct smbcli_state *cli, const char *fname,
-				  BOOL expect_it)
+static BOOL check_delete_on_close(struct smbcli_state *cli, int fnum,
+				  const char *fname, BOOL expect_it)
 {
 	TALLOC_CTX *mem_ctx = talloc_init("single_search");
 	union smb_search_data data;
@@ -35,15 +35,74 @@
 	size_t size;
 	uint16_t mode;
 
+	BOOL res = True;
+
 	status = torture_single_search(cli, mem_ctx,
 				       fname, RAW_SEARCH_FULL_DIRECTORY_INFO,
 				       &data);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("(%s) single_search failed (%s)\n", 
 		       __location__, nt_errstr(status));
-		return False;
+		res = False;
+		goto done;
 	}
 
+	if (fnum != -1) {
+		union smb_fileinfo io;
+		int nlink = expect_it ? 0 : 1;
+
+		io.all_info.level = RAW_FILEINFO_ALL_INFO;
+		io.all_info.in.fnum = fnum;
+
+		status = smb_raw_fileinfo(cli->tree, mem_ctx, &io);
+		if (!NT_STATUS_IS_OK(status)) {
+			printf("(%s) qpathinfo failed (%s)\n", __location__,
+			       nt_errstr(status));
+			res = False;
+			goto done;
+		}
+
+		if (expect_it != io.all_info.out.delete_pending) {
+			printf("Expected del_on_close flag %d, qfileinfo gave %d\n",
+			       expect_it, io.all_info.out.delete_pending);
+			res = False;
+			goto done;
+		}
+
+		if (nlink != io.all_info.out.nlink) {
+			printf("Expected nlink %d, qfileinfo gave %d\n",
+			       nlink, io.all_info.out.nlink);
+			res = False;
+			goto done;
+		}
+
+		io.standard_info.level = RAW_FILEINFO_STANDARD_INFO;
+		io.standard_info.in.fnum = fnum;
+
+		status = smb_raw_fileinfo(cli->tree, mem_ctx, &io);
+		if (!NT_STATUS_IS_OK(status)) {
+			printf("(%s) qpathinfo failed (%s)\n", __location__,
+			       nt_errstr(status));
+			res = False;
+			goto done;
+		}
+
+		if (expect_it != io.standard_info.out.delete_pending) {
+			printf("Expected del_on_close flag %d, qfileinfo gave %d\n",
+			       expect_it, io.standard_info.out.delete_pending);
+			res = False;
+			goto done;
+		}
+
+		if (nlink != io.standard_info.out.nlink) {
+			printf("Expected nlink %d, qfileinfo gave %d\n",
+			       nlink, io.all_info.out.nlink);
+			res = False;
+			goto done;
+		}
+
+	}
+
 	status = smbcli_qpathinfo(cli->tree, fname,
 				  &c_time, &a_time, &m_time,
 				  &size, &mode);
@@ -54,17 +113,21 @@
 			       "code (%s) -- NT_STATUS_DELETE_PENDING "
 			       "expected\n", __location__,
 			       nt_errstr(status));
-			return False;
+			res = False;
+			goto done;
 		}
 	} else {
 		if (!NT_STATUS_IS_OK(status)) {
 			printf("(%s) qpathinfo failed (%s)\n", __location__,
 			       nt_errstr(status));
-			return False;
+			res = False;
+			goto done;
 		}
 	}
 
-	return True;
+ done:
+	talloc_free(mem_ctx);
+	return res;
 }
 
 /*
@@ -417,7 +480,7 @@
 		goto fail;
 	}
 
-	correct &= check_delete_on_close(cli1, fname, True);
+	correct &= check_delete_on_close(cli1, fnum1, fname, True);
 	
 	if (NT_STATUS_IS_ERR(smbcli_nt_delete_on_close(cli1->tree, fnum1, False))) {
 		printf("(%s) unsetting delete_on_close on file failed !\n",
@@ -426,7 +489,7 @@
 		goto fail;
 	}
 
-	correct &= check_delete_on_close(cli1, fname, False);
+	correct &= check_delete_on_close(cli1, fnum1, fname, False);
 	
 	if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
 		printf("(%s) close - 2 failed (%s)\n", 
@@ -502,8 +565,8 @@
 		goto fail;
 	}
 
-	correct &= check_delete_on_close(cli1, fname, True);
-	correct &= check_delete_on_close(cli2, fname, True);
+	correct &= check_delete_on_close(cli1, fnum1, fname, True);
+	correct &= check_delete_on_close(cli2, fnum2, fname, True);
 
 	if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
 		printf("(%s) close - 1 failed (%s)\n", 
@@ -512,8 +575,8 @@
 		goto fail;
 	}
 
-	correct &= check_delete_on_close(cli1, fname, True);
-	correct &= check_delete_on_close(cli2, fname, True);
+	correct &= check_delete_on_close(cli1, -1, fname, True);
+	correct &= check_delete_on_close(cli2, fnum2, fname, True);
 	
 	if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) {
 		printf("(%s) close - 2 failed (%s)\n", 
@@ -692,8 +755,8 @@
 		goto fail;
 	}
 
-	correct &= check_delete_on_close(cli1, fname, True);
-	correct &= check_delete_on_close(cli2, fname, True);
+	correct &= check_delete_on_close(cli1, fnum1, fname, True);
+	correct &= check_delete_on_close(cli2, fnum2, fname, True);
 
 	if (NT_STATUS_IS_ERR(smbcli_nt_delete_on_close(cli2->tree, fnum2,
 						       False))) {
@@ -703,8 +766,8 @@
 		goto fail;
 	}
 
-	correct &= check_delete_on_close(cli1, fname, False);
-	correct &= check_delete_on_close(cli2, fname, False);
+	correct &= check_delete_on_close(cli1, fnum1, fname, False);
+	correct &= check_delete_on_close(cli2, fnum2, fname, False);
 	
 	if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
 		printf("(%s) close - 1 failed (%s)\n", 



More information about the samba-cvs mailing list