r17097: Move share_access_check from rpc_server/srv_srvsvc_nt.c to lib/sharesec.c
authorVolker Lendecke <vlendec@samba.org>
Mon, 17 Jul 2006 19:53:15 +0000 (19:53 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:38:11 +0000 (11:38 -0500)
source/lib/sharesec.c
source/rpc_server/srv_srvsvc_nt.c

index 9c40eb0ac7b73202b31fca76126f0784b0ec78dd..0c8035e3dc643403adea4abf71805aa150d6d352 100644 (file)
@@ -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.
 ***************************************************************************/
index 19099b931ea3a4e2e65fa1f5418e07f0a0fde2a6..be4c51c0d2d97ce6a2eea1c636253e17b7f5a781 100644 (file)
@@ -316,37 +316,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.
 ********************************************************************/