svn commit: samba r5526 - in trunk/source/torture: .

jra at samba.org jra at samba.org
Wed Feb 23 23:41:15 GMT 2005


Author: jra
Date: 2005-02-23 23:41:15 +0000 (Wed, 23 Feb 2005)
New Revision: 5526

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

Log:
Add extra case to torture to test this (we currently fail with the wrong
error message but we correctly deny the open).
Jeremy.

Modified:
   trunk/source/torture/torture.c


Changeset:
Modified: trunk/source/torture/torture.c
===================================================================
--- trunk/source/torture/torture.c	2005-02-23 23:41:15 UTC (rev 5525)
+++ trunk/source/torture/torture.c	2005-02-23 23:41:15 UTC (rev 5526)
@@ -3128,7 +3128,7 @@
 				   FILE_OVERWRITE_IF, 0, 0);
 	
 	if (fnum1 == -1) {
-		printf("[8] open of %s failed (%s)\n", fname, cli_errstr(cli1));
+		printf("[8] open 1 of %s failed (%s)\n", fname, cli_errstr(cli1));
 		correct = False;
 		goto fail;
 	}
@@ -3138,7 +3138,7 @@
 				   FILE_OPEN, 0, 0);
 	
 	if (fnum2 == -1) {
-		printf("[8] open of %s failed (%s)\n", fname, cli_errstr(cli1));
+		printf("[8] open 2 of %s failed (%s)\n", fname, cli_errstr(cli2));
 		correct = False;
 		goto fail;
 	}
@@ -3205,6 +3205,49 @@
 		correct = False;
 	} else
 		printf("tenth delete on close test succeeded.\n");
+
+	cli_setatr(cli1, fname, 0, 0);
+	cli_unlink(cli1, fname);
+
+	/* What error do we get when attempting to open a read-only file with
+	   delete access ? */
+
+	/* Create a readonly file. */
+	fnum1 = cli_nt_create_full(cli1, fname, 0, FILE_READ_DATA|FILE_WRITE_DATA,
+				   FILE_ATTRIBUTE_READONLY, FILE_SHARE_NONE, FILE_OVERWRITE_IF, 0, 0);
+	if (fnum1 == -1) {
+		printf("[11] open of %s failed (%s)\n", fname, cli_errstr(cli1));
+		correct = False;
+		goto fail;
+	}
+
+	if (!cli_close(cli1, fnum1)) {
+		printf("[11] close failed (%s)\n", cli_errstr(cli1));
+		correct = False;
+		goto fail;
+	}
+
+	/* Now try open for delete access. */
+	fnum1 = cli_nt_create_full(cli1, fname, 0, FILE_READ_ATTRIBUTES|DELETE_ACCESS,
+				   0, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
+				   FILE_OVERWRITE_IF, 0, 0);
+	
+	if (fnum1 != -1) {
+		printf("[11] open of %s succeeded should have been denied with ACCESS_DENIED!\n", fname);
+		cli_close(cli1, fnum1);
+		goto fail;
+		correct = False;
+	} else {
+		NTSTATUS nterr = cli_nt_error(cli1);
+		if (!NT_STATUS_EQUAL(nterr,NT_STATUS_ACCESS_DENIED)) {
+			printf("[11] open of %s should have been denied with ACCESS_DENIED! Got error %s\n", fname, nt_errstr(nterr));
+			goto fail;
+			correct = False;
+		} else {
+			printf("eleventh delete on close test succeeded.\n");
+		}
+	}
+	
 	printf("finished delete test\n");
 
   fail:



More information about the samba-cvs mailing list