use talloc_tos() in share_access_check()
authorVolker Lendecke <vl@samba.org>
Sun, 6 Jan 2008 13:17:15 +0000 (14:17 +0100)
committerVolker Lendecke <vl@samba.org>
Thu, 10 Jan 2008 12:19:59 +0000 (13:19 +0100)
(This used to be commit ac2bb838d537ca563ad2fe770b3e1c2fe8b1d9e7)

source3/lib/sharesec.c

index ba025dacc15019d2e1b92f8bed56f15f5f0419b3..f6ff701d5b79ae587dcab9c19950d2dfed7ed675 100644 (file)
@@ -228,25 +228,20 @@ bool share_access_check(const NT_USER_TOKEN *token, const char *sharename,
 {
        uint32 granted;
        NTSTATUS status;
-       TALLOC_CTX *mem_ctx = NULL;
        SEC_DESC *psd = NULL;
        size_t sd_size;
        bool ret = True;
 
-       if (!(mem_ctx = talloc_init("share_access_check"))) {
-               return False;
-       }
-
-       psd = get_share_security(mem_ctx, sharename, &sd_size);
+       psd = get_share_security(talloc_tos(), sharename, &sd_size);
 
        if (!psd) {
-               TALLOC_FREE(mem_ctx);
                return True;
        }
 
        ret = se_access_check(psd, token, desired_access, &granted, &status);
 
-       talloc_destroy(mem_ctx);
+       TALLOC_FREE(psd);
+
        return ret;
 }