Mask off the aDIR on setfileinfo.
authorJeremy Allison <jra@samba.org>
Tue, 5 Mar 2002 01:43:50 +0000 (01:43 +0000)
committerJeremy Allison <jra@samba.org>
Tue, 5 Mar 2002 01:43:50 +0000 (01:43 +0000)
Jeremy.
(This used to be commit d9cb1bf20ac8a739102b03d9a70e34fe5cb2f0f7)

source3/smbd/dosmode.c
source3/smbd/reply.c
source3/smbd/trans2.c

index 6750649effd5831ef4e2789c56f9cd964eb5261a..dcffe3aa90a4b98051a95f3e5697149336b28692 100644 (file)
@@ -195,6 +195,8 @@ int file_chmod(connection_struct *conn,char *fname,int dosmode,SMB_STRUCT_STAT *
 
        if (S_ISDIR(st->st_mode))
                dosmode |= aDIR;
+       else
+               dosmode &= ~aDIR;
 
        if (dos_mode(conn,fname,st) == dosmode)
                return(0);
index 0a349a9c8a7af539985df66099005dc098466b42..0de0e15274c32d46da74541fe812c07fdc24af3e 100644 (file)
@@ -517,6 +517,9 @@ int reply_setatr(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
   
   if (VALID_STAT_OF_DIR(sbuf))
     mode |= aDIR;
+  else
+    mode &= ~aDIR;
+
   if (check_name(fname,conn))
     ok =  (file_chmod(conn,fname,mode,NULL) == 0);
   if (ok)
index 501057830adddbfa3b54fbbb07a317a23a64d271..d08e3419f97b3dc355ffd54b642a72b1faee4131 100644 (file)
@@ -2225,6 +2225,11 @@ static int call_trans2setfilepathinfo(connection_struct *conn,
        DEBUG(6,("size: %.0f ", (double)size));
        DEBUG(6,("mode: %x\n"  , mode));
 
+       if (S_ISDIR(sbuf.st_mode))
+               mode |= aDIR;
+       else
+               mode &= ~aDIR;
+
        if(!((info_level == SMB_SET_FILE_END_OF_FILE_INFO) ||
                (info_level == SMB_SET_FILE_ALLOCATION_INFO) ||
                (info_level == SMB_FILE_ALLOCATION_INFORMATION) ||