num_create=$(echo "$out_sorted" | grep -c 'create_time:')
num_access=$(echo "$out_sorted" | grep -c 'access_time:')
num_write=$(echo "$out_sorted" | grep -c 'write_time:')
- num_change=$(echo "$out_sorted" | grep -c 'change_time:')
if [ "$num_create" != "2" ]; then
echo "failed - should get two create_time $out"
false
false
return
fi
- if [ "$num_change" != "1" ]; then
- echo "failed - should only get one change_time $out"
- false
- return
- fi
# This could be: Sun Jan 1 05:10:20 AM 2017
# or : Sun Jan 1 05:10:20 2017 CET
echo "smbclient allinfo on $file returned: \"$out\""
# Ignore create_time as that is synthesized
- for time in access_time write_time change_time; do
+ for time in access_time write_time ; do
echo "$out" | grep "$time" | grep "$expected" || {
echo "Expected \"$expected\", got: \"$(echo $out | grep $time)\""
return 1
}
return smb_fname->st.st_ex_btime;
}
-
-/******************************************************************
- Return a change time (may look at EA in future).
-******************************************************************/
-
-struct timespec get_change_timespec(connection_struct *conn,
- struct files_struct *fsp,
- const struct smb_filename *smb_fname)
-{
- return smb_fname->st.st_ex_mtime;
-}
struct files_struct *fsp,
const struct smb_filename *smb_fname);
-struct timespec get_change_timespec(connection_struct *conn,
- struct files_struct *fsp,
- const struct smb_filename *smb_fname);
-
NTSTATUS parse_dos_attribute_blob(struct smb_filename *smb_fname,
DATA_BLOB blob,
uint32_t *pattr);
create_timespec = get_create_timespec(conn, fsp, smb_fname);
a_timespec = smb_fname->st.st_ex_atime;
m_timespec = smb_fname->st.st_ex_mtime;
- c_timespec = get_change_timespec(conn, fsp, smb_fname);
+ c_timespec = smb_fname->st.st_ex_ctime;
if (lp_dos_filetime_resolution(SNUM(conn))) {
dos_filetime_timespec(&create_timespec);
create_timespec = get_create_timespec(conn, fsp, smb_fname);
a_timespec = smb_fname->st.st_ex_atime;
m_timespec = smb_fname->st.st_ex_mtime;
- c_timespec = get_change_timespec(conn, fsp, smb_fname);
+ c_timespec = smb_fname->st.st_ex_ctime;
if (lp_dos_filetime_resolution(SNUM(conn))) {
dos_filetime_timespec(&create_timespec);
*out_last_write_ts = smb_fname->st.st_ex_mtime;
*out_last_access_ts = smb_fname->st.st_ex_atime;
*out_creation_ts = get_create_timespec(conn, NULL, smb_fname);
- *out_change_ts = get_change_timespec(conn, NULL, smb_fname);
+ *out_change_ts = smb_fname->st.st_ex_ctime;
if (lp_dos_filetime_resolution(SNUM(conn))) {
dos_filetime_timespec(out_creation_ts);
result, result->fsp_name);
state->out_last_access_ts = result->fsp_name->st.st_ex_atime;
state->out_last_write_ts = result->fsp_name->st.st_ex_mtime;
- state->out_change_ts = get_change_timespec(smb1req->conn,
- result, result->fsp_name);
+ state->out_change_ts = result->fsp_name->st.st_ex_ctime;
if (lp_dos_filetime_resolution(SNUM(smb2req->tcon->compat))) {
dos_filetime_timespec(&state->out_creation_ts);
mdate_ts = smb_fname->st.st_ex_mtime;
adate_ts = smb_fname->st.st_ex_atime;
create_date_ts = get_create_timespec(conn, NULL, smb_fname);
- cdate_ts = get_change_timespec(conn, NULL, smb_fname);
+ cdate_ts = smb_fname->st.st_ex_ctime;
if (lp_dos_filetime_resolution(SNUM(conn))) {
dos_filetime_timespec(&create_date_ts);
create_time_ts = get_create_timespec(conn, fsp, smb_fname);
mtime_ts = psbuf->st_ex_mtime;
atime_ts = psbuf->st_ex_atime;
- ctime_ts = get_change_timespec(conn, fsp, smb_fname);
+ ctime_ts = psbuf->st_ex_ctime;
if (lp_dos_filetime_resolution(SNUM(conn))) {
dos_filetime_timespec(&create_time_ts);
torture_assert_nttime_equal(
torture, c1.out.write_time, gi.all_info.out.write_time,
"Bad timestamp\n");
- torture_assert_nttime_equal(
- torture, c1.out.change_time, gi.all_info.out.change_time,
- "Bad timestamp\n");
torture_comment(torture, "Renaming file2.txt --> file1.txt\n");
torture_assert_nttime_equal(
torture, c2.out.write_time, gi.all_info.out.write_time,
"Bad timestamp\n");
- torture_assert_nttime_equal(
- torture, c2.out.change_time, gi.all_info.out.change_time,
- "Bad timestamp\n");
done:
if (!smb2_util_handle_empty(h1)) {
ret, done, "Unexpected access time\n");
torture_assert_u64_equal_goto(tctx, c.out.write_time, NTTIME_OMIT,
ret, done, "Unexpected write time\n");
- torture_assert_u64_equal_goto(tctx, c.out.change_time, NTTIME_OMIT,
- ret, done, "Unexpected change time\n");
torture_assert_u64_equal_goto(tctx, c.out.size, 0,
ret, done, "Unexpected size\n");
torture_assert_u64_equal_goto(tctx, c.out.file_attr, 0,
nttime = full_timespec_to_nt_time(&ts);
si.basic_info.in.create_time = nttime;
si.basic_info.in.write_time = nttime;
- si.basic_info.in.change_time = nttime;
status = smb2_setinfo_file(tree, &si);
torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
nttime,
ret, done,
"Wrong write time\n");
- torture_assert_u64_equal_goto(tctx,
- gi.basic_info.out.change_time,
- nttime,
- ret, done,
- "Wrong change time\n");
find = (struct smb2_find) {
.in.file.handle = testdirh,
nttime,
ret, done,
"Wrong write time\n");
- torture_assert_u64_equal_goto(tctx,
- d[0].id_both_directory_info.change_time,
- nttime,
- ret, done,
- "Wrong change time\n");
status = smb2_util_close(tree, handle);
torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
nttime,
ret, done,
"Wrong write time\n");
- torture_assert_u64_equal_goto(tctx,
- gi.basic_info.out.change_time,
- nttime,
- ret, done,
- "Wrong change time\n");
find = (struct smb2_find) {
.in.continue_flags = SMB2_CONTINUE_FLAG_RESTART,
nttime,
ret, done,
"Wrong write time\n");
- torture_assert_u64_equal_goto(tctx,
- d[0].id_both_directory_info.change_time,
- nttime,
- ret, done,
- "Wrong change time\n");
status = smb2_util_close(tree, handle);
torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
nttime = full_timespec_to_nt_time(&ts);
si.basic_info.in.create_time = nttime;
si.basic_info.in.write_time = nttime;
- si.basic_info.in.change_time = nttime;
status = smb2_setinfo_file(tree, &si);
torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
nttime,
ret, done,
"Wrong write time\n");
- torture_assert_u64_equal_goto(tctx,
- gi.basic_info.out.change_time,
- nttime,
- ret, done,
- "Wrong change time\n");
/*
* Step 3:
si.basic_info.in.create_time = NTTIME_FREEZE;
si.basic_info.in.write_time = NTTIME_FREEZE;
- si.basic_info.in.change_time = NTTIME_FREEZE;
status = smb2_setinfo_file(tree, &si);
torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
nttime,
ret, done,
"Wrong write time\n");
- torture_assert_u64_equal_goto(tctx,
- gi.basic_info.out.change_time,
- nttime,
- ret, done,
- "Wrong change time\n");
/*
* Step 5:
si.basic_info.in.create_time = NTTIME_THAW;
si.basic_info.in.write_time = NTTIME_THAW;
- si.basic_info.in.change_time = NTTIME_THAW;
status = smb2_setinfo_file(tree, &si);
torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
nttime,
ret, done,
"Wrong write time\n");
- torture_assert_u64_equal_goto(tctx,
- gi.basic_info.out.change_time,
- nttime,
- ret, done,
- "Wrong change time\n");
done:
if (!smb2_util_handle_empty(handle)) {