Fix bug #4978 : Store DOS Attributes fails when copying folders.
authorjra <jra@0c0555d6-39d7-0310-84fc-f1cc0bd64818>
Thu, 27 Sep 2007 23:28:35 +0000 (23:28 +0000)
committerjra <jra@0c0555d6-39d7-0310-84fc-f1cc0bd64818>
Thu, 27 Sep 2007 23:28:35 +0000 (23:28 +0000)
Jeremy.

git-svn-id: svn+ssh://svn.samba.org/data/svn/samba/branches/SAMBA_3_2@25391 0c0555d6-39d7-0310-84fc-f1cc0bd64818

source/smbd/open.c

index 8e1068e..6c2b5a4 100644 (file)
@@ -1983,6 +1983,7 @@ static NTSTATUS mkdir_internal(connection_struct *conn,
        char *parent_dir;
        const char *dirname;
        NTSTATUS status;
+       bool posix_open = false;
 
        if(!CAN_WRITE(conn)) {
                DEBUG(5,("mkdir_internal: failing create on read-only share "
@@ -2001,6 +2002,7 @@ static NTSTATUS mkdir_internal(connection_struct *conn,
        }
 
        if (file_attributes & FILE_FLAG_POSIX_SEMANTICS) {
+               posix_open = true;
                mode = (mode_t)(file_attributes & ~FILE_FLAG_POSIX_SEMANTICS);
        } else {
                mode = unix_mode(conn, aDIR, name, parent_dir);
@@ -2025,6 +2027,14 @@ static NTSTATUS mkdir_internal(connection_struct *conn,
                return NT_STATUS_ACCESS_DENIED;
        }
 
+       if (lp_store_dos_attributes(SNUM(conn))) {
+               if (!posix_open) {
+                       file_set_dosmode(conn, name,
+                                file_attributes | aDIR, NULL,
+                                parent_dir);
+               }
+       }
+
        if (lp_inherit_perms(SNUM(conn))) {
                inherit_access_acl(conn, parent_dir, name, mode);
        }