svn commit: samba r20256 - in branches/SAMBA_3_0_24/source:
script/tests smbd
vlendec at samba.org
vlendec at samba.org
Tue Dec 19 18:05:26 GMT 2006
Author: vlendec
Date: 2006-12-19 18:05:23 +0000 (Tue, 19 Dec 2006)
New Revision: 20256
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20256
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_24/source/script/tests/test_posix_s3.sh
branches/SAMBA_3_0_24/source/smbd/reply.c
Changeset:
Modified: branches/SAMBA_3_0_24/source/script/tests/test_posix_s3.sh
===================================================================
--- branches/SAMBA_3_0_24/source/script/tests/test_posix_s3.sh 2006-12-19 18:02:24 UTC (rev 20255)
+++ branches/SAMBA_3_0_24/source/script/tests/test_posix_s3.sh 2006-12-19 18:05:23 UTC (rev 20256)
@@ -25,7 +25,7 @@
base="$base BASE-MANGLE BASE-NEGNOWAIT BASE-NTDENY1"
base="$base BASE-NTDENY2 BASE-OPEN BASE-OPENATTR BASE-PROPERTIES BASE-RENAME BASE-RW1"
base="$base BASE-SECLEAK BASE-TCON BASE-TCONDEV BASE-TRANS2 BASE-UNLINK BASE-VUID"
-base="$base BASE-XCOPY"
+base="$base BASE-XCOPY BASE-SAMBA3ERROR"
raw="RAW-ACLS RAW-CHKPATH RAW-CLOSE RAW-COMPOSITE RAW-CONTEXT RAW-EAS"
raw="$raw RAW-IOCTL RAW-LOCK RAW-MKDIR RAW-MUX RAW-NOTIFY RAW-OPEN RAW-OPLOCK"
Modified: branches/SAMBA_3_0_24/source/smbd/reply.c
===================================================================
--- branches/SAMBA_3_0_24/source/smbd/reply.c 2006-12-19 18:02:24 UTC (rev 20255)
+++ branches/SAMBA_3_0_24/source/smbd/reply.c 2006-12-19 18:05:23 UTC (rev 20256)
@@ -3796,6 +3796,7 @@
NTSTATUS status;
BOOL bad_path = False;
SMB_STRUCT_STAT sbuf;
+ files_struct *fsp;
START_PROFILE(SMBmkdir);
@@ -3809,17 +3810,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
@@ -3832,24 +3833,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