From: Jeremy Allison Date: Wed, 14 Jul 2021 22:00:13 +0000 (-0700) Subject: s3: smbd: Allow "smbd async dosmode = yes" to return valid DOS attributes again. X-Git-Tag: samba-4.15.0rc1~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1ffcc8064294060d05d2b657385f69a75df49cf;p=thirdparty%2Fsamba.git s3: smbd: Allow "smbd async dosmode = yes" to return valid DOS attributes again. We already have a valid smb_fname->fsp, don't drop it when returning from smbd_dirptr_lanman2_entry() to allow it to be reused inside dos_mode_at_send(). Remove knownfail. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14758 Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/selftest/knownfail.d/smb2_list_dir_async b/selftest/knownfail.d/smb2_list_dir_async deleted file mode 100644 index bc3858276f7..00000000000 --- a/selftest/knownfail.d/smb2_list_dir_async +++ /dev/null @@ -1 +0,0 @@ -^samba3.smbtorture_s3.plain.SMB2-LIST-DIR-ASYNC.smbtorture\(simpleserver\) diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index c69e48a4a56..b9e2786eda6 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -2551,23 +2551,27 @@ NTSTATUS smbd_dirptr_lanman2_entry(TALLOC_CTX *ctx, } if (_smb_fname != NULL) { - struct smb_filename *name = NULL; - - name = synthetic_smb_fname(ctx, - fname, - NULL, - &smb_fname->st, - smb_fname->twrp, - 0); - if (name == NULL) { + /* + * smb_fname is already talloc'ed off ctx. + * We just need to make sure we don't return + * any stream_name, and replace base_name + * with fname in case base_name got mangled. + * This allows us to preserve any smb_fname->fsp + * for asynchronous handle lookups. + */ + TALLOC_FREE(smb_fname->stream_name); + TALLOC_FREE(smb_fname->base_name); + smb_fname->base_name = talloc_strdup(smb_fname, fname); + + if (smb_fname->base_name == NULL) { TALLOC_FREE(smb_fname); TALLOC_FREE(fname); return NT_STATUS_NO_MEMORY; } - *_smb_fname = name; + *_smb_fname = smb_fname; + } else { + TALLOC_FREE(smb_fname); } - - TALLOC_FREE(smb_fname); TALLOC_FREE(fname); if (NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)) {