summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-10-03 02:12:14 +0000
committerJeremy Allison <jra@samba.org>2000-10-03 02:12:14 +0000
commit3ad2ee22bb4ecee24d069bb7efadff18c25044d1 (patch)
tree833839953637fd990b712717df13efffa5b6ae10 /source3/smbd
parent2679fa315da579fbdc7dd35d3ee1cb364b85a1d9 (diff)
downloadsamba-3ad2ee22bb4ecee24d069bb7efadff18c25044d1.tar.gz
samba-3ad2ee22bb4ecee24d069bb7efadff18c25044d1.tar.bz2
samba-3ad2ee22bb4ecee24d069bb7efadff18c25044d1.zip
utf-8 and EUC3 patch from Hiroshi Miura Samba User Group Japan staff.
mkdir high bits patch from Robert Dahlem" <Robert.Dahlem@gmx.net>. jeremy. (This used to be commit b40191d27180ab1e59935086073c4d312552f717)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/open.c3
-rw-r--r--source3/smbd/reply.c3
-rw-r--r--source3/smbd/trans2.c3
-rw-r--r--source3/smbd/vfs.c24
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.
********************************************************************/