]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:smbd: parse xattr_DosInfo4 in parse_dos_attribute_blob()
authorRalph Boehme <slow@samba.org>
Tue, 25 Jun 2019 12:25:21 +0000 (14:25 +0200)
committerJeremy Allison <jra@samba.org>
Mon, 1 Jul 2019 21:43:24 +0000 (21:43 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/dosmode.c

index a4625718a56675acc1a3d60c2f80e54b96777682..8e8d791cfe9be292ca6056fa11e23c3a42def268 100644 (file)
@@ -325,6 +325,50 @@ NTSTATUS parse_dos_attribute_blob(struct smb_filename *smb_fname,
                                                      create_time)));
                }
                break;
+       case 4:
+       {
+               struct xattr_DosInfo4 *info = &dosattrib.info.info4;
+
+               dosattr = info->attrib;
+
+               if ((info->valid_flags & XATTR_DOSINFO_CREATE_TIME) &&
+                   !null_nttime(info->create_time))
+               {
+                       struct timespec creat_time;
+
+                       creat_time = nt_time_to_unix_timespec(info->create_time);
+                       update_stat_ex_create_time(&smb_fname->st, creat_time);
+
+                       DBG_DEBUG("file [%s] creation time [%s]\n",
+                               smb_fname_str_dbg(smb_fname),
+                               nt_time_string(talloc_tos(), info->create_time));
+               }
+
+               if (info->valid_flags & XATTR_DOSINFO_ITIME) {
+                       struct timespec itime;
+                       uint64_t file_id;
+
+                       itime = nt_time_to_unix_timespec(info->itime);
+                       if (smb_fname->st.st_ex_iflags &
+                           ST_EX_IFLAG_CALCULATED_ITIME)
+                       {
+                               update_stat_ex_itime(&smb_fname->st, itime);
+                       }
+
+                       file_id = make_file_id_from_itime(&smb_fname->st);
+                       if (smb_fname->st.st_ex_iflags &
+                           ST_EX_IFLAG_CALCULATED_FILE_ID)
+                       {
+                               update_stat_ex_file_id(&smb_fname->st, file_id);
+                       }
+
+                       DBG_DEBUG("file [%s] itime [%s] fileid [%"PRIx64"]\n",
+                               smb_fname_str_dbg(smb_fname),
+                               nt_time_string(talloc_tos(), info->itime),
+                               file_id);
+               }
+               break;
+       }
        default:
                DBG_WARNING("Badly formed DOSATTRIB on file %s - %s\n",
                            smb_fname_str_dbg(smb_fname), blob.data);