set_ea_dos_attribute always called now

Richard Sharpe realrichardsharpe at gmail.com
Fri Mar 22 14:24:24 MDT 2013


Hi folks,

Somewhere between 3.4.5 and 3.6.6 the following unfortunate change was made:

@@ -615,39 +750,37 @@ int file_set_dosmode(connection_struct *
        dosmode  &= ~FILE_ATTRIBUTE_OFFLINE;
        old_mode &= ~FILE_ATTRIBUTE_OFFLINE;

-       if (old_mode == dosmode) {
-               st->st_mode = unixmode;
-               return(0);
-       }
+       smb_fname->st.st_ex_btime = new_create_timespec;

 #ifdef HAVE_STAT_DOS_FLAGS
        {
                bool attributes_changed;

-               if (set_stat_dos_flags(conn, fname, st, dosmode,
+               if (set_stat_dos_flags(conn, smb_fname, dosmode,
                                       &attributes_changed))
                {
                        if (!newfile && attributes_changed) {
                                notify_fname(conn, NOTIFY_ACTION_MODIFIED,
-                                   FILE_NOTIFY_CHANGE_ATTRIBUTES, fname);
+                                   FILE_NOTIFY_CHANGE_ATTRIBUTES,
+                                   smb_fname->base_name);
                        }
-                       st->st_mode = unixmode;
+                       smb_fname->st.st_ex_mode = unixmode;
                        return 0;
                }
        }
 #endif
-
        /* Store the DOS attributes in an EA by preference. */
-       if (set_ea_dos_attribute(conn, fname, st, dosmode)) {
+       if (set_ea_dos_attribute(conn, smb_fname, dosmode)) {
                if (!newfile) {
                        notify_fname(conn, NOTIFY_ACTION_MODIFIED,
-                               FILE_NOTIFY_CHANGE_ATTRIBUTES, fname);
+                                    FILE_NOTIFY_CHANGE_ATTRIBUTES,
+                                    smb_fname->base_name);
                }
-               st->st_mode = unixmode;
+               smb_fname->st.st_ex_mode = unixmode;
                return 0;
        }

It results in set_ea_dos_attribute always being called. For those who
do not store dos attributes, it does not matter, but for those of us
who do, it does matter.

-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)


More information about the samba-technical mailing list