mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
sharesec: Return NTSTATUS from delete_share_security
Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
1f304fc16c
commit
6bf6e5364a
@ -144,7 +144,7 @@ struct security_descriptor *get_share_security( TALLOC_CTX *ctx, const char *ser
|
||||
size_t *psize);
|
||||
NTSTATUS set_share_security(const char *share_name,
|
||||
struct security_descriptor *psd);
|
||||
bool delete_share_security(const char *servicename);
|
||||
NTSTATUS delete_share_security(const char *servicename);
|
||||
bool share_access_check(const struct security_token *token,
|
||||
const char *sharename,
|
||||
uint32_t desired_access,
|
||||
|
@ -410,27 +410,27 @@ NTSTATUS set_share_security(const char *share_name,
|
||||
Delete a security descriptor.
|
||||
********************************************************************/
|
||||
|
||||
bool delete_share_security(const char *servicename)
|
||||
NTSTATUS delete_share_security(const char *servicename)
|
||||
{
|
||||
TDB_DATA kbuf;
|
||||
char *key;
|
||||
NTSTATUS status;
|
||||
char *c_servicename = canonicalize_servicename(talloc_tos(), servicename);
|
||||
|
||||
if (!c_servicename) {
|
||||
return NULL;
|
||||
if (c_servicename == NULL) {
|
||||
return NT_STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
status = share_info_db_init();
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
TALLOC_FREE(c_servicename);
|
||||
return False;
|
||||
return status;
|
||||
}
|
||||
|
||||
if (!(key = talloc_asprintf(talloc_tos(), SHARE_SECURITY_DB_KEY_PREFIX_STR "%s",
|
||||
c_servicename))) {
|
||||
TALLOC_FREE(c_servicename);
|
||||
return False;
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
kbuf = string_term_tdb_data(key);
|
||||
|
||||
@ -439,11 +439,11 @@ bool delete_share_security(const char *servicename)
|
||||
DEBUG(0, ("delete_share_security: Failed to delete entry for "
|
||||
"share %s: %s\n", c_servicename, nt_errstr(status)));
|
||||
TALLOC_FREE(c_servicename);
|
||||
return False;
|
||||
return status;
|
||||
}
|
||||
|
||||
TALLOC_FREE(c_servicename);
|
||||
return True;
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
|
@ -246,7 +246,8 @@ static int change_share_sec(TALLOC_CTX *mem_ctx, const char *sharename, char *th
|
||||
old = sd;
|
||||
break;
|
||||
case SMB_SD_DELETE:
|
||||
if (!delete_share_security(sharename)) {
|
||||
status = delete_share_security(sharename);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
fprintf( stderr, "Failed to delete security descriptor for "
|
||||
"share [%s]\n", sharename );
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user