diff options
author | Volker Lendecke <vlendec@samba.org> | 2006-12-24 14:29:19 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:16:42 -0500 |
commit | af1750934d12c82b87a9d1f1ab96f24474fb9768 (patch) | |
tree | 9f4dd96881c6660786cd3baca5bc8c19018551fa /source3/smbd | |
parent | d0c6f9b728936297efd002008b69a59da6bbfabc (diff) | |
download | samba-af1750934d12c82b87a9d1f1ab96f24474fb9768.tar.gz samba-af1750934d12c82b87a9d1f1ab96f24474fb9768.tar.bz2 samba-af1750934d12c82b87a9d1f1ab96f24474fb9768.zip |
r20340: Join vfs_MkDir to its only caller
(This used to be commit cce911780fc52ea56dccde1879b0891cdf9ea320)
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/open.c | 32 | ||||
-rw-r--r-- | source3/smbd/vfs.c | 31 |
2 files changed, 25 insertions, 38 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c index e8536e3335..1ca793fb80 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1851,27 +1851,45 @@ int close_file_fchmod(files_struct *fsp) return ret; } -static NTSTATUS mkdir_internal(connection_struct *conn, - const pstring directory) +static NTSTATUS mkdir_internal(connection_struct *conn, const char *name) { + SMB_STRUCT_STAT sbuf; int ret= -1; - + mode_t mode; + if(!CAN_WRITE(conn)) { DEBUG(5,("mkdir_internal: failing create on read-only share " "%s\n", lp_servicename(SNUM(conn)))); return NT_STATUS_ACCESS_DENIED; } - if (!check_name(directory, conn)) { + if (!check_name(name, conn)) { return map_nt_error_from_unix(errno); } - ret = vfs_MkDir(conn,directory,unix_mode(conn,aDIR,directory,True)); + mode = unix_mode(conn, aDIR, name, True); - if (ret == -1) { + if ((ret=SMB_VFS_MKDIR(conn, name, mode)) != 0) { return map_nt_error_from_unix(errno); } - + + if (lp_inherit_perms(SNUM(conn))) { + inherit_access_acl(conn, name, mode); + } + + /* + * Check if high bits should have been set, + * then (if bits are missing): add them. + * Consider bits automagically set by UNIX, i.e. SGID bit from parent + * dir. + */ + if (mode & ~(S_IRWXU|S_IRWXG|S_IRWXO) + && (SMB_VFS_STAT(conn, name, &sbuf) == 0) + && (mode & ~sbuf.st_mode)) { + SMB_VFS_CHMOD(conn, name, + sbuf.st_mode | (mode & ~sbuf.st_mode)); + } + return NT_STATUS_OK; } diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index b6a7d477bd..a4ecff921a 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -307,37 +307,6 @@ BOOL vfs_directory_exist(connection_struct *conn, const char *dname, SMB_STRUCT_ } /******************************************************************* - vfs mkdir wrapper -********************************************************************/ - -int vfs_MkDir(connection_struct *conn, const char *name, mode_t mode) -{ - int ret; - SMB_STRUCT_STAT sbuf; - - if ((ret=SMB_VFS_MKDIR(conn, name, mode)) != 0) { - return ret; - } - - if (lp_inherit_perms(SNUM(conn))) { - inherit_access_acl(conn, name, mode); - } - - /* - * Check if high bits should have been set, - * then (if bits are missing): add them. - * Consider bits automagically set by UNIX, i.e. SGID bit from parent - * dir. - */ - if (mode & ~(S_IRWXU|S_IRWXG|S_IRWXO) - && (SMB_VFS_STAT(conn,name,&sbuf) == 0) - && (mode & ~sbuf.st_mode)) { - SMB_VFS_CHMOD(conn,name,sbuf.st_mode | (mode & ~sbuf.st_mode)); - } - return 0; -} - -/******************************************************************* Check if an object exists in the vfs. ********************************************************************/ |