*/
#include "includes.h"
+#include "system/filesys.h"
#include "../libcli/security/security.h"
#include "../librpc/gen_ndr/ndr_security.h"
#include "dbwrap.h"
+#include "util_tdb.h"
/*******************************************************************
Create the share security tdb.
Can this user access with share with the required permissions ?
********************************************************************/
-bool share_access_check(const struct security_token *token, const char *sharename,
- uint32 desired_access)
+bool share_access_check(const struct security_token *token,
+ const char *sharename,
+ uint32 desired_access,
+ uint32_t *pgranted)
{
uint32 granted;
NTSTATUS status;
psd = get_share_security(talloc_tos(), sharename, &sd_size);
if (!psd) {
- return True;
+ if (pgranted != NULL) {
+ *pgranted = desired_access;
+ }
+ return false;
}
status = se_access_check(psd, token, desired_access, &granted);
TALLOC_FREE(psd);
+ if (pgranted != NULL) {
+ *pgranted = granted;
+ }
+
return NT_STATUS_IS_OK(status);
}
/* Add the number of ',' characters to get the number of aces. */
num_aces += count_chars(pacl,',');
- ace_list = TALLOC_ARRAY(ctx, struct security_ace, num_aces);
+ ace_list = talloc_array(ctx, struct security_ace, num_aces);
if (!ace_list) {
return False;
}