DOS bits lost on Copy/Paste

Esh, Andrew AEsh at tricord.com
Fri Mar 29 07:14:02 GMT 2002


I have a patch against SAMBA_2_2 which fixes the storage of DOS bits when a
file is moved to a Samba share via Drag and Drop, or Copy/Paste. The
automatic setting of the Archive bit is not being changed. If the file has
Read-Only, Hidden, or System bits set, those bits will be preserved. Note
that the Properties dialog is already able to control these bits, and the
method used there is the same one being added here in smbd/nttrans.c, in the
function "reply_ntcreate_and_X". The base version of nttrans.c is 1.104.4.44
(current SAMBA_2_2).

# diff -Naur smbd/nttrans.c smbd/nttrans.c.new 
--- smbd/nttrans.c	Fri Mar 22 21:06:05 2002
+++ smbd/nttrans.c.new	Fri Mar 29 08:37:57 2002
@@ -859,7 +859,16 @@
 				END_PROFILE(SMBntcreateX);
 				return(UNIXERROR(ERRDOS,ERRnoaccess));
 			}
-		} 
+		}
+		else {
+			if (smb_attr != 0) {
+				if(file_chmod(conn, fname, smb_attr, &sbuf))
{
+					DEBUG(2,("reply_ntcreate_and_X:
chmod of %s failed (%s)\n", fname, strerror(errno)));
+					END_PROFILE(SMBntcreateX);
+					return
ERROR_DOS(ERRDOS,ERRnoaccess);
+				}
+			}
+		}
 	}
 		
 	restore_case_semantics(file_attributes);
 
---
Andrew C. Esh                mail:Andrew.Esh at tricord.com
Tricord Systems, Inc.
2905 Northwest Blvd., Suite 20        763-557-9005 (main)
Plymouth, MN 55441-2644 USA      763-551-6418 (direct)
http://www.tricord.com - Tricord Home Page

-------------- next part --------------
HTML attachment scrubbed and removed


More information about the samba-technical mailing list