Author: vlendec Date: 2006-07-17 19:53:15 +0000 (Mon, 17 Jul 2006) New Revision: 17097
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17097 Log: Move share_access_check from rpc_server/srv_srvsvc_nt.c to lib/sharesec.c Modified: branches/SAMBA_3_0/source/lib/sharesec.c branches/SAMBA_3_0/source/rpc_server/srv_srvsvc_nt.c Changeset: Modified: branches/SAMBA_3_0/source/lib/sharesec.c =================================================================== --- branches/SAMBA_3_0/source/lib/sharesec.c 2006-07-17 19:50:59 UTC (rev 17096) +++ branches/SAMBA_3_0/source/lib/sharesec.c 2006-07-17 19:53:15 UTC (rev 17097) @@ -206,6 +206,37 @@ return True; } +/******************************************************************* + Can this user access with share with the required permissions ? +********************************************************************/ + +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; + BOOL ret = True; + + if (!(mem_ctx = talloc_init("share_access_check"))) { + return False; + } + + psd = get_share_security(mem_ctx, 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); + return ret; +} + /*************************************************************************** Parse the contents of an acl string from a usershare file. ***************************************************************************/ Modified: branches/SAMBA_3_0/source/rpc_server/srv_srvsvc_nt.c =================================================================== --- branches/SAMBA_3_0/source/rpc_server/srv_srvsvc_nt.c 2006-07-17 19:50:59 UTC (rev 17096) +++ branches/SAMBA_3_0/source/rpc_server/srv_srvsvc_nt.c 2006-07-17 19:53:15 UTC (rev 17097) @@ -317,37 +317,6 @@ } /******************************************************************* - Can this user access with share with the required permissions ? -********************************************************************/ - -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; - BOOL ret = True; - - if (!(mem_ctx = talloc_init("share_access_check"))) { - return False; - } - - psd = get_share_security(mem_ctx, 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); - return ret; -} - -/******************************************************************* Fill in a share info level 501 structure. ********************************************************************/