[PATCH] Maintain DOS attributes of externally copied file

ZINKEVICIUS,MATT (HP-Loveland,ex1) matt_zinkevicius at hp.com
Mon Aug 6 10:37:06 GMT 2001


As it stands, if you copy a file to samba it loses all DOS attributes
(read-only, etc). This changes that:

--- samba-2.2.1-orig/source/smbd/nttrans.c	Mon Jul 30 17:53:35 2001
+++ samba-2.2.1-acldb/source/smbd/nttrans.c	Thu Aug  2 04:29:17 2001
@@ -951,7 +951,12 @@
 	}
 		
 	restore_case_semantics(file_attributes);
-		
+	
+	// Maintain DOS attributes of files copied externally
+	if (smb_action == FILE_WAS_CREATED) {
+			file_chmod(conn,fname,(S_ISDIR(sbuf.st_mode) ?
smb_attr : (smb_attr|aARCH)),&sbuf);
+	}
+			
 	file_len = sbuf.st_size;
 	fmode = dos_mode(conn,fname,&sbuf);
 	if(fmode == 0)
@@ -1435,6 +1440,11 @@
 		}
       } 
   
+		// Maintain DOS attributes of files copied externally
+		if (smb_action == FILE_WAS_CREATED) {
+				file_chmod(conn,fname,(S_ISDIR(sbuf.st_mode)
? smb_attr : (smb_attr|aARCH)),&sbuf);
+		}
+		
       file_len = sbuf.st_size;
       fmode = dos_mode(conn,fname,&sbuf);
       if(fmode == 0)


Matt Zinkevicius
Modular Network Storage
Hewlett-Packard





More information about the samba-technical mailing list