svn commit: samba r20253 - in branches/SAMBA_3_0/source/smbd: .

vlendec at samba.org vlendec at samba.org
Tue Dec 19 16:36:54 GMT 2006


Author: vlendec
Date: 2006-12-19 16:36:54 +0000 (Tue, 19 Dec 2006)
New Revision: 20253

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

Log:
Reduce some code duplication, make reply_mkdir go through the same code paths
ncreate does. This is a bit slower (about 10-20%), because it goes touches the
share mode db, but I think not having to call change_owner_to_parent and
friends in fewer places outweighs this. And, mkdir is not the way current
Windows boxes create directories, they do it via the ncreate call.

Volker

Modified:
   branches/SAMBA_3_0/source/smbd/reply.c


Changeset:
Modified: branches/SAMBA_3_0/source/smbd/reply.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/reply.c	2006-12-19 14:01:05 UTC (rev 20252)
+++ branches/SAMBA_3_0/source/smbd/reply.c	2006-12-19 16:36:54 UTC (rev 20253)
@@ -3795,6 +3795,7 @@
 	NTSTATUS status;
 	BOOL bad_path = False;
 	SMB_STRUCT_STAT sbuf;
+	files_struct *fsp;
 
 	START_PROFILE(SMBmkdir);
  
@@ -3808,17 +3809,17 @@
 
 	unix_convert(directory,conn,0,&bad_path,&sbuf);
 
-	if( is_ntfs_stream_name(directory)) {
-		DEBUG(5,("reply_mkdir: failing create on filename %s with colon in name\n", directory));
-		END_PROFILE(SMBmkdir);
-		return ERROR_NT(NT_STATUS_NOT_A_DIRECTORY);
-	}
+	status = open_directory(conn, directory, &sbuf,
+				FILE_READ_ATTRIBUTES, /* Just a stat open */
+				FILE_SHARE_NONE, /* Ignored for stat opens */
+				FILE_CREATE, 0, NULL, &fsp);
 
-	status = mkdir_internal(conn, directory,bad_path);
+	DEBUG(1, ("open_directory returned %s\n", nt_errstr(status)));
+
 	if (!NT_STATUS_IS_OK(status)) {
 
-		if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION) &&
-		    !use_nt_status()) {
+		if (NT_STATUS_EQUAL(
+			    status, NT_STATUS_DOS(ERRDOS, ERRfilexists))) {
 			/*
 			 * Yes, in the DOS error code case we get a
 			 * ERRDOS:ERRnoaccess here. See BASE-SAMBA3ERROR
@@ -3831,24 +3832,8 @@
 		return ERROR_NT(status);
 	}
 
-	if (lp_inherit_owner(SNUM(conn))) {
-		/* Ensure we're checking for a symlink here.... */
-		/* We don't want to get caught by a symlink racer. */
+	close_file(fsp, NORMAL_CLOSE);
 
-		if(SMB_VFS_LSTAT(conn,directory, &sbuf) != 0) {
-			END_PROFILE(SMBmkdir);
-			return(UNIXERROR(ERRDOS,ERRnoaccess));
-		}
-                                                                                                                                                   
-		if(!S_ISDIR(sbuf.st_mode)) {
-			DEBUG(0,("reply_mkdir: %s is not a directory !\n", directory ));
-			END_PROFILE(SMBmkdir);
-			return(UNIXERROR(ERRDOS,ERRnoaccess));
-		}
-
-		change_owner_to_parent(conn, NULL, directory, &sbuf);
-	}
-
 	outsize = set_message(outbuf,0,0,False);
 
 	DEBUG( 3, ( "mkdir %s ret=%d\n", directory, outsize ) );



More information about the samba-cvs mailing list