diff options
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/open.c | 3 | ||||
-rw-r--r-- | source3/smbd/reply.c | 3 | ||||
-rw-r--r-- | source3/smbd/trans2.c | 3 | ||||
-rw-r--r-- | source3/smbd/vfs.c | 24 |
4 files changed, 27 insertions, 6 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c index e9d2f01e10..4964e15e01 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -897,8 +897,7 @@ files_struct *open_directory(connection_struct *conn, return NULL; } - if(conn->vfs_ops.mkdir(dos_to_unix(fname, False), - unix_mode(conn,aDIR, fname)) < 0) { + if(vfs_mkdir(conn,fname, unix_mode(conn,aDIR, fname)) < 0) { DEBUG(0,("open_directory: unable to create %s. Error was %s\n", fname, strerror(errno) )); file_free(fsp); diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 96a43b48c8..b98ae441ac 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -3099,8 +3099,7 @@ int mkdir_internal(connection_struct *conn, char *inbuf, char *outbuf, pstring d unix_convert(directory,conn,0,&bad_path,NULL); if (check_name(directory, conn)) - ret = conn->vfs_ops.mkdir(dos_to_unix(directory,False), - unix_mode(conn,aDIR,directory)); + ret = vfs_mkdir(conn,directory,unix_mode(conn,aDIR,directory)); if (ret < 0) { diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 900a87e32b..9d1aa5dcfe 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -2014,8 +2014,7 @@ static int call_trans2mkdir(connection_struct *conn, unix_convert(directory,conn,0,&bad_path,NULL); if (check_name(directory,conn)) - ret = conn->vfs_ops.mkdir(dos_to_unix(directory,False), - unix_mode(conn,aDIR,directory)); + ret = vfs_mkdir(conn,directory,unix_mode(conn,aDIR,directory)); if(ret < 0) { diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 631d4bedbe..097f51d217 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -267,6 +267,30 @@ BOOL vfs_directory_exist(connection_struct *conn, char *dname, SMB_STRUCT_STAT * } /******************************************************************* + vfs mkdir wrapper that calls dos_to_unix. +********************************************************************/ + +int vfs_mkdir(connection_struct *conn, char *fname, mode_t mode) +{ + int ret; + pstring name; + SMB_STRUCT_STAT sbuf; + + pstrcpy(name,dos_to_unix(fname,False)); /* paranoia copy */ + if(!(ret=conn->vfs_ops.mkdir(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) && + !vfs_stat(conn,name,&sbuf) && (mode & ~sbuf.st_mode)) + vfs_chmod(conn,name,sbuf.st_mode | (mode & ~sbuf.st_mode)); + } + return ret; +} + +/******************************************************************* vfs Unlink wrapper that calls dos_to_unix. ********************************************************************/ |