From: Ralph Boehme Date: Sat, 24 Nov 2018 09:54:06 +0000 (+0100) Subject: s3:smbd: pass down twrp from SMB2_CREATE to filename_convert() X-Git-Tag: samba-4.8.9~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d353c2ab0692a95b4e7f0d1b13cdfe34d24047e;p=thirdparty%2Fsamba.git s3:smbd: pass down twrp from SMB2_CREATE to filename_convert() Bug: https://bugzilla.samba.org/show_bug.cgi?id=13455 Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison (cherry picked from commit 9c462e1b324ebad60c51bd6e8e659b39a31ec02e) --- diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c index 799efd1d26c..9de7cef6f10 100644 --- a/source3/smbd/smb2_create.c +++ b/source3/smbd/smb2_create.c @@ -476,6 +476,8 @@ struct smbd_smb2_create_state { ssize_t lease_len; bool need_replay_cache; struct smbXsrv_open *op; + time_t twrp_time; + time_t *twrp_timep; struct smb2_create_blob *dhnc; struct smb2_create_blob *dh2c; @@ -891,7 +893,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx, smb1req->conn, state->fname, ucf_flags, - NULL, + state->twrp_timep, NULL, /* ppath_contains_wcards */ &smb_fname); if (!NT_STATUS_IS_OK(status)) { @@ -1179,9 +1181,6 @@ static void smbd_smb2_create_before_exec(struct tevent_req *req) if (state->twrp != NULL) { NTTIME nttime; - time_t t; - struct tm *tm; - char *tmpname = state->fname; if (state->twrp->data.length != 8) { tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER); @@ -1189,27 +1188,9 @@ static void smbd_smb2_create_before_exec(struct tevent_req *req) } nttime = BVAL(state->twrp->data.data, 0); - t = nt_time_to_unix(nttime); - tm = gmtime(&t); + state->twrp_time = nt_time_to_unix(nttime); + state->twrp_timep = &state->twrp_time; - state->fname = talloc_asprintf( - state, - "%s\\@GMT-%04u.%02u.%02u-%02u.%02u.%02u", - state->fname, - tm->tm_year + 1900, - tm->tm_mon + 1, - tm->tm_mday, - tm->tm_hour, - tm->tm_min, - tm->tm_sec); - if (tevent_req_nomem(state->fname, req)) { - return; - } - TALLOC_FREE(tmpname); - /* - * Tell filename_create_ucf_flags() this - * is an @GMT path. - */ smb1req->flags2 |= FLAGS2_REPARSE_PATH; }