Cosmetic fix
authorVolker Lendecke <vl@sernet.de>
Sun, 11 Nov 2007 11:49:42 +0000 (12:49 +0100)
committerMichael Adam <obnox@samba.org>
Sun, 11 Nov 2007 22:45:02 +0000 (23:45 +0100)
Do directory vs file open before entering open_file_stat

source/smbd/file_access.c

index 189fcbbce1f40a45890bc616eb7983d93c8ff190..121e7f79a9b8035c01812fc28f218c2c30f2f555 100644 (file)
@@ -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)));