Put SMB_INFO_STANDARD back into setfileinfo, but do it right
authorJeremy Allison <jra@samba.org>
Thu, 6 Aug 2009 19:50:16 +0000 (12:50 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 6 Aug 2009 19:50:16 +0000 (12:50 -0700)
this time :-).
Jeremy.

source3/smbd/trans2.c

index 184a8580970acd3f2de4df0158457cc3d7b09246..21c5062257fd8233d32677d71197845bd906d81f 100644 (file)
@@ -6109,6 +6109,41 @@ static NTSTATUS smb_set_file_basic_info(connection_struct *conn,
                                 true);
 }
 
+/****************************************************************************
+ Deal with SMB_INFO_STANDARD.
+****************************************************************************/
+
+static NTSTATUS smb_set_info_standard(connection_struct *conn,
+                                       const char *pdata,
+                                       int total_data,
+                                       files_struct *fsp,
+                                       const struct smb_filename *smb_fname)
+{
+       struct smb_file_time ft;
+
+       ZERO_STRUCT(ft);
+
+       if (total_data < 12) {
+               return NT_STATUS_INVALID_PARAMETER;
+       }
+
+       /* create time */
+       ft.create_time = convert_time_t_to_timespec(srv_make_unix_date2(pdata));
+       /* access time */
+       ft.atime = convert_time_t_to_timespec(srv_make_unix_date2(pdata+4));
+       /* write time */
+       ft.mtime = convert_time_t_to_timespec(srv_make_unix_date2(pdata+8));
+
+       DEBUG(10,("smb_set_info_standard: file %s\n",
+               smb_fname_str_dbg(smb_fname)));
+
+        return smb_set_file_time(conn,
+                                fsp,
+                               smb_fname,
+                               &ft,
+                                true);
+}
+
 /****************************************************************************
  Deal with SMB_SET_FILE_ALLOCATION_INFO.
 ****************************************************************************/
@@ -7086,6 +7121,16 @@ NTSTATUS smbd_do_setfilepathinfo(connection_struct *conn,
 
        switch (info_level) {
 
+               case SMB_INFO_STANDARD:
+               {
+                       status = smb_set_info_standard(conn,
+                                       pdata,
+                                       total_data,
+                                       fsp,
+                                       smb_fname);
+                       break;
+               }
+
                case SMB_INFO_SET_EA:
                {
                        status = smb_info_set_ea(conn,