From cd62122916defbfb57468c3b82a60b766fc4652e Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 11 Nov 2007 12:49:42 +0100 Subject: [PATCH] Cosmetic fix Do directory vs file open before entering open_file_stat --- source/smbd/file_access.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/smbd/file_access.c b/source/smbd/file_access.c index 189fcbbce1f..121e7f79a9b 100644 --- a/source/smbd/file_access.c +++ b/source/smbd/file_access.c @@ -51,9 +51,7 @@ static NTSTATUS conn_get_nt_acl(TALLOC_CTX *mem_ctx, /* fake a files_struct ptr: */ - status = open_file_stat(conn, NULL, fname, psbuf, &fsp); - /* Perhaps it is a directory */ - if (NT_STATUS_EQUAL(status, NT_STATUS_FILE_IS_A_DIRECTORY)) { + if (S_ISDIR(psbuf->st_mode)) { status = open_directory(conn, NULL, fname, psbuf, READ_CONTROL_ACCESS, FILE_SHARE_READ|FILE_SHARE_WRITE, @@ -62,6 +60,10 @@ static NTSTATUS conn_get_nt_acl(TALLOC_CTX *mem_ctx, FILE_ATTRIBUTE_DIRECTORY, NULL, &fsp); } + else { + status = open_file_stat(conn, NULL, fname, psbuf, &fsp); + } + if (!NT_STATUS_IS_OK(status)) { DEBUG(3, ("Unable to open file %s: %s\n", fname, nt_errstr(status))); -- 2.34.1