summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2006-07-17 19:53:15 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:38:11 -0500
commit4c713703d046f756989e7eb901e884829825593c (patch)
treef1ac625f3086f86a81c1e1c2025b9a428e06e2ae
parent283b74fce595642fb2e2a2fad87c2de9c3bc5403 (diff)
downloadsamba-4c713703d046f756989e7eb901e884829825593c.tar.gz
samba-4c713703d046f756989e7eb901e884829825593c.tar.bz2
samba-4c713703d046f756989e7eb901e884829825593c.zip
r17097: Move share_access_check from rpc_server/srv_srvsvc_nt.c to lib/sharesec.c
(This used to be commit 220dd4333032aea238066e3fbec9fca51ed16ddf)
-rw-r--r--source3/lib/sharesec.c31
-rw-r--r--source3/rpc_server/srv_srvsvc_nt.c31
2 files changed, 31 insertions, 31 deletions
diff --git a/source3/lib/sharesec.c b/source3/lib/sharesec.c
index 9c40eb0ac7..0c8035e3dc 100644
--- a/source3/lib/sharesec.c
+++ b/source3/lib/sharesec.c
@@ -206,6 +206,37 @@ BOOL delete_share_security(int snum)
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.
***************************************************************************/
diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c
index 19099b931e..be4c51c0d2 100644
--- a/source3/rpc_server/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srv_srvsvc_nt.c
@@ -317,37 +317,6 @@ static void map_generic_share_sd_bits(SEC_DESC *psd)
}
/*******************************************************************
- 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.
********************************************************************/