diff options
author | Jeremy Allison <jra@samba.org> | 2009-08-10 15:07:53 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2009-08-10 15:07:53 -0700 |
commit | c9dca82ed7757f4745edf6ee6048bd94d86c4dbc (patch) | |
tree | 39022ef781029f7de9e9948f644e071f11347e3b /source3/smbd/nttrans.c | |
parent | 303e49b2f1d3cc437c399fb8d59b8eb60e86f86c (diff) | |
download | samba-c9dca82ed7757f4745edf6ee6048bd94d86c4dbc.tar.gz samba-c9dca82ed7757f4745edf6ee6048bd94d86c4dbc.tar.bz2 samba-c9dca82ed7757f4745edf6ee6048bd94d86c4dbc.zip |
Refactor the use of create_time and change time to go
through functions. Will aid in making us pass RAW-SETFILEINFO.
Jeremy.
Diffstat (limited to 'source3/smbd/nttrans.c')
-rw-r--r-- | source3/smbd/nttrans.c | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index b7b2634963..9f4074c865 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -399,6 +399,7 @@ void reply_ntcreate_and_X(struct smb_request *req) int info = 0; files_struct *fsp = NULL; char *p = NULL; + struct timespec create_timespec; struct timespec c_timespec; struct timespec a_timespec; struct timespec m_timespec; @@ -524,6 +525,10 @@ void reply_ntcreate_and_X(struct smb_request *req) goto out; } + /* Ensure we're pointing at the correct stat struct. */ + TALLOC_FREE(smb_fname); + smb_fname = fsp->fsp_name; + /* * If the caller set the extended oplock request bit * and we granted one (by whatever means) - set the @@ -591,23 +596,25 @@ void reply_ntcreate_and_X(struct smb_request *req) } /* Create time. */ - c_timespec = smb_fname->st.st_ex_btime; + create_timespec = get_create_timespec(fsp, smb_fname); a_timespec = smb_fname->st.st_ex_atime; m_timespec = smb_fname->st.st_ex_mtime; + c_timespec = get_change_timespec(fsp, smb_fname); if (lp_dos_filetime_resolution(SNUM(conn))) { - dos_filetime_timespec(&c_timespec); + dos_filetime_timespec(&create_timespec); dos_filetime_timespec(&a_timespec); dos_filetime_timespec(&m_timespec); + dos_filetime_timespec(&c_timespec); } - put_long_date_timespec(p, c_timespec); /* create time. */ + put_long_date_timespec(p, create_timespec); /* create time. */ p += 8; put_long_date_timespec(p, a_timespec); /* access time */ p += 8; put_long_date_timespec(p, m_timespec); /* write time */ p += 8; - put_long_date_timespec(p, m_timespec); /* change time */ + put_long_date_timespec(p, c_timespec); /* change time */ p += 8; SIVAL(p,0,fattr); /* File Attributes. */ p += 4; @@ -638,7 +645,6 @@ void reply_ntcreate_and_X(struct smb_request *req) chain_reply(req); out: - TALLOC_FREE(smb_fname); END_PROFILE(SMBntcreateX); return; } @@ -844,6 +850,7 @@ static void call_nt_transact_create(connection_struct *conn, struct security_descriptor *sd = NULL; uint32 ea_len; uint16 root_dir_fid; + struct timespec create_timespec; struct timespec c_timespec; struct timespec a_timespec; struct timespec m_timespec; @@ -1016,6 +1023,10 @@ static void call_nt_transact_create(connection_struct *conn, goto out; } + /* Ensure we're pointing at the correct stat struct. */ + TALLOC_FREE(smb_fname); + smb_fname = fsp->fsp_name; + /* * If the caller set the extended oplock request bit * and we granted one (by whatever means) - set the @@ -1083,23 +1094,25 @@ static void call_nt_transact_create(connection_struct *conn, } /* Create time. */ - c_timespec = smb_fname->st.st_ex_btime; + create_timespec = get_create_timespec(fsp, smb_fname); a_timespec = smb_fname->st.st_ex_atime; m_timespec = smb_fname->st.st_ex_mtime; + c_timespec = get_change_timespec(fsp, smb_fname); if (lp_dos_filetime_resolution(SNUM(conn))) { - dos_filetime_timespec(&c_timespec); + dos_filetime_timespec(&create_timespec); dos_filetime_timespec(&a_timespec); dos_filetime_timespec(&m_timespec); + dos_filetime_timespec(&c_timespec); } - put_long_date_timespec(p, c_timespec); /* create time. */ + put_long_date_timespec(p, create_timespec); /* create time. */ p += 8; put_long_date_timespec(p, a_timespec); /* access time */ p += 8; put_long_date_timespec(p, m_timespec); /* write time */ p += 8; - put_long_date_timespec(p, m_timespec); /* change time */ + put_long_date_timespec(p, c_timespec); /* change time */ p += 8; SIVAL(p,0,fattr); /* File Attributes. */ p += 4; @@ -1131,7 +1144,6 @@ static void call_nt_transact_create(connection_struct *conn, /* Send the required number of replies */ send_nt_replies(conn, req, NT_STATUS_OK, params, param_len, *ppdata, 0); out: - TALLOC_FREE(smb_fname); return; } |