svn commit: samba r20496 - in branches: SAMBA_3_0/source/smbd SAMBA_3_0_24/source/smbd

vlendec at samba.org vlendec at samba.org
Wed Jan 3 06:19:13 GMT 2007


Author: vlendec
Date: 2007-01-03 06:19:11 +0000 (Wed, 03 Jan 2007)
New Revision: 20496

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

Log:
Some changes to make Samba3 the RAW-OPEN test. Checking in to both 3_0 and
3_0_24 because I was explicitly asked to, although this needs close
review. Jeremy, I'm sure you will check this thoroughly :-)

In reply_open_and_X the separate "size" variable kills the calculation of the
SPARSE flag returned to the client in the attrib field. In getpathinfo we do
it correctly, and RAW-OPEN (correctly) complains about the difference.

Add the "set the write time" to mknew and create.

For trans2open we were missing the "ofun == 0" ->
NT_STATUS_OBJECT_NAME_COLLISION case, and we dropped the status returned in
favor of ACCESS_DENIED once too many.

Last change is a fix to trans2open: We were returning the attributes given by
the client, not the attributes of the new file.

Volker
Modified:
   branches/SAMBA_3_0/source/smbd/reply.c
   branches/SAMBA_3_0/source/smbd/trans2.c
   branches/SAMBA_3_0_24/source/smbd/reply.c
   branches/SAMBA_3_0_24/source/smbd/trans2.c


Changeset:
Modified: branches/SAMBA_3_0/source/smbd/reply.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/reply.c	2007-01-03 05:31:50 UTC (rev 20495)
+++ branches/SAMBA_3_0/source/smbd/reply.c	2007-01-03 06:19:11 UTC (rev 20496)
@@ -1475,7 +1475,6 @@
 	uint32 smb_time = make_unix_date3(inbuf+smb_vwv6);
 #endif
 	int smb_ofun = SVAL(inbuf,smb_vwv8);
-	SMB_OFF_T size=0;
 	uint32 fattr=0;
 	int mtime=0;
 	SMB_STRUCT_STAT sbuf;
@@ -1545,8 +1544,6 @@
 		return ERROR_NT(status);
 	}
 
-	size = sbuf.st_size;
-
 	/* Setting the "size" field in vwv9 and vwv10 causes the file to be set to this size,
 	   if the file is truncated or created. */
 	if (((smb_action == FILE_WAS_CREATED) || (smb_action == FILE_WAS_OVERWRITTEN)) && allocation_size) {
@@ -1562,7 +1559,7 @@
 			END_PROFILE(SMBopenX);
 			return ERROR_NT(NT_STATUS_DISK_FULL);
 		}
-		size = get_allocation_size(conn,fsp,&sbuf);
+		sbuf.st_size = get_allocation_size(conn,fsp,&sbuf);
 	}
 
 	fattr = dos_mode(conn,fname,&sbuf);
@@ -1611,7 +1608,7 @@
 	} else {
 		srv_put_dos_date3(outbuf,smb_vwv4,mtime);
 	}
-	SIVAL(outbuf,smb_vwv6,(uint32)size);
+	SIVAL(outbuf,smb_vwv6,(uint32)sbuf.st_size);
 	SSVAL(outbuf,smb_vwv8,GET_OPENX_MODE(deny_mode));
 	SSVAL(outbuf,smb_vwv11,smb_action);
 
@@ -1662,6 +1659,7 @@
 	int com;
 	int outsize = 0;
 	uint32 fattr = SVAL(inbuf,smb_vwv0);
+	struct utimbuf times;
 	BOOL bad_path = False;
 	files_struct *fsp;
 	int oplock_request = CORE_OPLOCK_REQUEST(inbuf);
@@ -1676,6 +1674,8 @@
  
 	com = SVAL(inbuf,smb_com);
 
+	times.modtime = srv_make_unix_date3(inbuf + smb_vwv1);
+
 	srvstr_get_path(inbuf, fname, smb_buf(inbuf) + 1, sizeof(fname), 0, STR_TERMINATE, &status);
 	if (!NT_STATUS_IS_OK(status)) {
 		END_PROFILE(SMBcreate);
@@ -1721,6 +1721,9 @@
 		return ERROR_NT(status);
 	}
  
+	times.actime = sbuf.st_atime;
+	file_utime(conn, fname, &times);
+
 	outsize = set_message(outbuf,1,0,True);
 	SSVAL(outbuf,smb_vwv0,fsp->fnum);
 

Modified: branches/SAMBA_3_0/source/smbd/trans2.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/trans2.c	2007-01-03 05:31:50 UTC (rev 20495)
+++ branches/SAMBA_3_0/source/smbd/trans2.c	2007-01-03 06:19:11 UTC (rev 20496)
@@ -810,6 +810,10 @@
 		return set_bad_path_error(errno, bad_path, outbuf, ERRDOS,ERRnoaccess);
 	}
 
+	if (open_ofun == 0) {
+		return ERROR_NT(NT_STATUS_OBJECT_NAME_COLLISION);
+	}
+
 	if (!map_open_params_to_ntcreate(fname, deny_mode, open_ofun,
 				&access_mask,
 				&share_mode,
@@ -857,7 +861,7 @@
 			/* We have re-scheduled this call. */
 			return -1;
 		}
-		return set_bad_path_error(errno, bad_path, outbuf, ERRDOS,ERRnoaccess);
+		return ERROR_NT(status);
 	}
 
 	size = get_file_size(sbuf);
@@ -909,7 +913,7 @@
 	params = *pparams;
 
 	SSVAL(params,0,fsp->fnum);
-	SSVAL(params,2,open_attr);
+	SSVAL(params,2,fattr);
 	srv_put_dos_date2(params,4, mtime);
 	SIVAL(params,8, (uint32)size);
 	SSVAL(params,12,deny_mode);

Modified: branches/SAMBA_3_0_24/source/smbd/reply.c
===================================================================
--- branches/SAMBA_3_0_24/source/smbd/reply.c	2007-01-03 05:31:50 UTC (rev 20495)
+++ branches/SAMBA_3_0_24/source/smbd/reply.c	2007-01-03 06:19:11 UTC (rev 20496)
@@ -1475,7 +1475,6 @@
 	uint32 smb_time = make_unix_date3(inbuf+smb_vwv6);
 #endif
 	int smb_ofun = SVAL(inbuf,smb_vwv8);
-	SMB_OFF_T size=0;
 	uint32 fattr=0;
 	int mtime=0;
 	SMB_STRUCT_STAT sbuf;
@@ -1545,8 +1544,6 @@
 		return ERROR_NT(status);
 	}
 
-	size = sbuf.st_size;
-
 	/* Setting the "size" field in vwv9 and vwv10 causes the file to be set to this size,
 	   if the file is truncated or created. */
 	if (((smb_action == FILE_WAS_CREATED) || (smb_action == FILE_WAS_OVERWRITTEN)) && allocation_size) {
@@ -1562,7 +1559,7 @@
 			END_PROFILE(SMBopenX);
 			return ERROR_NT(NT_STATUS_DISK_FULL);
 		}
-		size = get_allocation_size(conn,fsp,&sbuf);
+		sbuf.st_size = get_allocation_size(conn,fsp,&sbuf);
 	}
 
 	fattr = dos_mode(conn,fname,&sbuf);
@@ -1611,7 +1608,7 @@
 	} else {
 		srv_put_dos_date3(outbuf,smb_vwv4,mtime);
 	}
-	SIVAL(outbuf,smb_vwv6,(uint32)size);
+	SIVAL(outbuf,smb_vwv6,(uint32)sbuf.st_size);
 	SSVAL(outbuf,smb_vwv8,GET_OPENX_MODE(deny_mode));
 	SSVAL(outbuf,smb_vwv11,smb_action);
 
@@ -1662,6 +1659,7 @@
 	int com;
 	int outsize = 0;
 	uint32 fattr = SVAL(inbuf,smb_vwv0);
+	struct utimbuf times;
 	BOOL bad_path = False;
 	files_struct *fsp;
 	int oplock_request = CORE_OPLOCK_REQUEST(inbuf);
@@ -1676,6 +1674,8 @@
  
 	com = SVAL(inbuf,smb_com);
 
+	times.modtime = srv_make_unix_date3(inbuf + smb_vwv1);
+
 	srvstr_get_path(inbuf, fname, smb_buf(inbuf) + 1, sizeof(fname), 0, STR_TERMINATE, &status);
 	if (!NT_STATUS_IS_OK(status)) {
 		END_PROFILE(SMBcreate);
@@ -1721,6 +1721,9 @@
 		return ERROR_NT(status);
 	}
  
+	times.actime = sbuf.st_atime;
+	file_utime(conn, fname, &times);
+
 	outsize = set_message(outbuf,1,0,True);
 	SSVAL(outbuf,smb_vwv0,fsp->fnum);
 

Modified: branches/SAMBA_3_0_24/source/smbd/trans2.c
===================================================================
--- branches/SAMBA_3_0_24/source/smbd/trans2.c	2007-01-03 05:31:50 UTC (rev 20495)
+++ branches/SAMBA_3_0_24/source/smbd/trans2.c	2007-01-03 06:19:11 UTC (rev 20496)
@@ -810,6 +810,10 @@
 		return set_bad_path_error(errno, bad_path, outbuf, ERRDOS,ERRnoaccess);
 	}
 
+	if (open_ofun == 0) {
+		return ERROR_NT(NT_STATUS_OBJECT_NAME_COLLISION);
+	}
+
 	if (!map_open_params_to_ntcreate(fname, deny_mode, open_ofun,
 				&access_mask,
 				&share_mode,
@@ -857,7 +861,7 @@
 			/* We have re-scheduled this call. */
 			return -1;
 		}
-		return set_bad_path_error(errno, bad_path, outbuf, ERRDOS,ERRnoaccess);
+		return ERROR_NT(status);
 	}
 
 	size = get_file_size(sbuf);
@@ -909,7 +913,7 @@
 	params = *pparams;
 
 	SSVAL(params,0,fsp->fnum);
-	SSVAL(params,2,open_attr);
+	SSVAL(params,2,fattr);
 	srv_put_dos_date2(params,4, mtime);
 	SIVAL(params,8, (uint32)size);
 	SSVAL(params,12,deny_mode);



More information about the samba-cvs mailing list