From bcfc830c284e4eaa76e1a562bf60d8ecdf8d11ab Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Thu, 15 Mar 2018 18:57:50 +0100 Subject: [PATCH] smbd: rework error exit in smbd_dirptr_lanman2_entry() The next commit will add code that must be run if status is NT_STATUS_OK or STATUS_MORE_ENTRIES. Signed-off-by: Ralph Boehme Reviewed-by: Stefan Metzmacher --- source3/smbd/trans2.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 238cd9f1cef..005f55f77b7 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -2550,11 +2550,15 @@ NTSTATUS smbd_dirptr_lanman2_entry(TALLOC_CTX *ctx, TALLOC_FREE(fname); TALLOC_FREE(smb_fname); - if (NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)) { - dptr_SeekDir(dirptr, prev_dirpos); + + if (!NT_STATUS_IS_OK(status) && + !NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)) + { return status; } - if (!NT_STATUS_IS_OK(status)) { + + if (NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)) { + dptr_SeekDir(dirptr, prev_dirpos); return status; } -- 2.47.3