Author: jra Date: 2007-09-27 23:28:35 +0000 (Thu, 27 Sep 2007) New Revision: 25391
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25391 Log: Fix bug #4978 : Store DOS Attributes fails when copying folders. Jeremy. Modified: branches/SAMBA_3_0_MAINT/source/smbd/open.c branches/SAMBA_3_2/source/smbd/open.c branches/SAMBA_3_2_0/source/smbd/open.c Changeset: Modified: branches/SAMBA_3_0_MAINT/source/smbd/open.c =================================================================== --- branches/SAMBA_3_0_MAINT/source/smbd/open.c 2007-09-27 23:07:35 UTC (rev 25390) +++ branches/SAMBA_3_0_MAINT/source/smbd/open.c 2007-09-27 23:28:35 UTC (rev 25391) @@ -1939,6 +1939,7 @@ 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 " @@ -1957,6 +1958,7 @@ } 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); @@ -1981,6 +1983,14 @@ 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); } Modified: branches/SAMBA_3_2/source/smbd/open.c =================================================================== --- branches/SAMBA_3_2/source/smbd/open.c 2007-09-27 23:07:35 UTC (rev 25390) +++ branches/SAMBA_3_2/source/smbd/open.c 2007-09-27 23:28:35 UTC (rev 25391) @@ -1983,6 +1983,7 @@ 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 @@ } 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 @@ 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); } Modified: branches/SAMBA_3_2_0/source/smbd/open.c =================================================================== --- branches/SAMBA_3_2_0/source/smbd/open.c 2007-09-27 23:07:35 UTC (rev 25390) +++ branches/SAMBA_3_2_0/source/smbd/open.c 2007-09-27 23:28:35 UTC (rev 25391) @@ -1987,6 +1987,7 @@ 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 " @@ -2005,6 +2006,7 @@ } 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); @@ -2029,6 +2031,14 @@ 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); }