From 283b74fce595642fb2e2a2fad87c2de9c3bc5403 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 17 Jul 2006 19:50:59 +0000 Subject: r17096: Simplify share_access_check a bit: It takes the sharename instead of the snum, and the decision which token to use (conn or vuser) does not really belong here, it is better done in the two places where this is called. Volker (This used to be commit 0a138888adf7a0f04a38cd911e797e1a379e908b) --- source3/rpc_server/srv_srvsvc_nt.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c index 50df99901b..19099b931e 100644 --- a/source3/rpc_server/srv_srvsvc_nt.c +++ b/source3/rpc_server/srv_srvsvc_nt.c @@ -320,36 +320,30 @@ static void map_generic_share_sd_bits(SEC_DESC *psd) Can this user access with share with the required permissions ? ********************************************************************/ -BOOL share_access_check(connection_struct *conn, int snum, user_struct *vuser, uint32 desired_access) +BOOL share_access_check(const NT_USER_TOKEN *token, const char *sharename, + uint32 desired_access) { uint32 granted; NTSTATUS status; TALLOC_CTX *mem_ctx = NULL; SEC_DESC *psd = NULL; size_t sd_size; - NT_USER_TOKEN *token = NULL; BOOL ret = True; - mem_ctx = talloc_init("share_access_check"); - if (mem_ctx == NULL) + if (!(mem_ctx = talloc_init("share_access_check"))) { return False; + } - psd = get_share_security(mem_ctx, lp_servicename(snum), &sd_size); - - if (!psd) - goto out; + psd = get_share_security(mem_ctx, sharename, &sd_size); - if (conn->nt_user_token) - token = conn->nt_user_token; - else - token = vuser->nt_user_token; + if (!psd) { + TALLOC_FREE(mem_ctx); + return True; + } ret = se_access_check(psd, token, desired_access, &granted, &status); -out: - talloc_destroy(mem_ctx); - return ret; } -- cgit