Fix potential orphaned open files.
authorMichael Adam <obnox@samba.org>
Tue, 13 Nov 2007 22:26:38 +0000 (23:26 +0100)
committerMichael Adam <obnox@samba.org>
Tue, 13 Nov 2007 22:26:38 +0000 (23:26 +0100)
Calling can_access_file could lead to orphaned open files
when SMB_VFS_GET_NT_ACL returned ENOSYS (not implemented).

Michael

source/smbd/file_access.c

index 46472665e5fec5683838b478f4640efb9e074a83..a58bcdd8915c361210e1d2f595090998b304a5ac 100644 (file)
@@ -76,12 +76,14 @@ static NTSTATUS conn_get_nt_acl(TALLOC_CTX *mem_ctx,
                                    &secdesc);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(5, ("Unable to get NT ACL for file %s\n", fname));
-               return status;
+               goto done;
        }
 
        *psd = talloc_move(mem_ctx, &secdesc);
+
+done:
        close_file(fsp, NORMAL_CLOSE);
-       return NT_STATUS_OK;
+       return status;
 }
 
 static bool can_access_file_acl(struct connection_struct *conn,