svn commit: samba r3580 - in branches/SAMBA_4_0/source: ntvfs/posix script/tests torture/basic

tridge at samba.org tridge at samba.org
Sat Nov 6 12:35:31 GMT 2004


Author: tridge
Date: 2004-11-06 12:35:31 +0000 (Sat, 06 Nov 2004)
New Revision: 3580

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

Log:
- on file overwrite in ntcreatex we need to replace the file permissions.

- pvfs now passes BASE-OPENATTR

- pvfs also passes the BASE-DEFER_OPEN test, but it is not a well
  formed test for regular running so I am removing it from the list of
  tests to run in test_posix.sh (the test is covered better by RAW-MUX
  anyway)




Modified:
   branches/SAMBA_4_0/source/ntvfs/posix/pvfs_open.c
   branches/SAMBA_4_0/source/script/tests/test_posix.sh
   branches/SAMBA_4_0/source/torture/basic/attr.c


Changeset:
Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_open.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_open.c	2004-11-06 12:14:14 UTC (rev 3579)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_open.c	2004-11-06 12:35:31 UTC (rev 3580)
@@ -787,6 +787,22 @@
 		return status;
 	}
 
+	if (io->generic.in.open_disposition == NTCREATEX_DISP_OVERWRITE ||
+	    io->generic.in.open_disposition == NTCREATEX_DISP_OVERWRITE_IF) {
+		/* for overwrite we need to replace file permissions */
+		uint32_t attrib = io->ntcreatex.in.file_attr | FILE_ATTRIBUTE_ARCHIVE;
+		mode_t mode = pvfs_fileperms(pvfs, attrib);
+		if (fchmod(fd, mode) == -1) {
+			return map_nt_error_from_unix(errno);
+		}
+		name->dos.attrib = attrib;
+		status = pvfs_dosattrib_save(pvfs, name, fd);
+		if (!NT_STATUS_IS_OK(status)) {
+			return status;
+		}
+	}
+	    
+
 	io->generic.out.oplock_level  = NO_OPLOCK;
 	io->generic.out.fnum	      = f->fnum;
 	io->generic.out.create_action = NTCREATEX_ACTION_EXISTED;

Modified: branches/SAMBA_4_0/source/script/tests/test_posix.sh
===================================================================
--- branches/SAMBA_4_0/source/script/tests/test_posix.sh	2004-11-06 12:14:14 UTC (rev 3579)
+++ branches/SAMBA_4_0/source/script/tests/test_posix.sh	2004-11-06 12:35:31 UTC (rev 3580)
@@ -35,13 +35,13 @@
 tests="$tests BASE-DENY3 BASE-XCOPY BASE-OPEN"
 tests="$tests BASE-DELETE BASE-PROPERTIES BASE-MANGLE"
 tests="$tests BASE-CHKPATH BASE-SECLEAK BASE-TRANS2"
-tests="$tests BASE-NTDENY1 BASE-NTDENY2  BASE-RENAME"
+tests="$tests BASE-NTDENY1 BASE-NTDENY2  BASE-RENAME BASE-OPENATTR"
 tests="$tests RAW-QFSINFO RAW-QFILEINFO RAW-SFILEINFO-BUG"
 tests="$tests RAW-LOCK RAW-MKDIR RAW-SEEK RAW-CONTEXT RAW-MUX RAW-OPEN"
 tests="$tests RAW-UNLINK RAW-READ RAW-CLOSE RAW-IOCTL RAW-SEARCH RAW-CHKPATH"
 tests="$tests LOCAL-ICONV LOCAL-TALLOC LOCAL-MESSAGING LOCAL-BINDING LOCAL-IDTREE"
 
-soon="BASE-DENY1 BASE-DEFER_OPEN BASE-OPENATTR BASE-CHARSET"
+soon="BASE-DENY1 BASE-CHARSET"
 soon="$soon RAW-SFILEINFO RAW-OPLOCK RAW-NOTIFY"
 soon="$soon RAW-WRITE RAW-RENAME"
 

Modified: branches/SAMBA_4_0/source/torture/basic/attr.c
===================================================================
--- branches/SAMBA_4_0/source/torture/basic/attr.c	2004-11-06 12:14:14 UTC (rev 3579)
+++ branches/SAMBA_4_0/source/torture/basic/attr.c	2004-11-06 12:35:31 UTC (rev 3580)
@@ -104,8 +104,8 @@
 		smbcli_setatr(cli1->tree, fname, 0, 0);
 		smbcli_unlink(cli1->tree, fname);
 		fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_WRITE_DATA, open_attrs_table[i],
-				   NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
-
+					      NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
+		
 		if (fnum1 == -1) {
 			printf("open %d (1) of %s failed (%s)\n", i, fname, smbcli_errstr(cli1->tree));
 			return False;
@@ -166,13 +166,13 @@
 			for (l = 0; l < ARRAY_SIZE(attr_results); l++) {
 				if (attr_results[l].num == k) {
 					if (attr != attr_results[l].result_attr ||
-							open_attrs_table[i] != attr_results[l].init_attr ||
-							open_attrs_table[j] != attr_results[l].trunc_attr) {
+					    open_attrs_table[i] != attr_results[l].init_attr ||
+					    open_attrs_table[j] != attr_results[l].trunc_attr) {
 						printf("[%d] getatr check failed. [0x%x] trunc [0x%x] got attr 0x%x, should be 0x%x\n",
-							k, open_attrs_table[i],
-							open_attrs_table[j],
-							(uint_t)attr,
-							attr_results[l].result_attr);
+						       k, open_attrs_table[i],
+						       open_attrs_table[j],
+						       (uint_t)attr,
+						       attr_results[l].result_attr);
 						correct = False;
 						CHECK_MAX_FAILURES(error_exit);
 					}



More information about the samba-cvs mailing list