1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

netlogon_creds_cli: Simplify netlogon_creds_cli_delete

Don't implicitly TALLOC_FREE(creds) in the pure delete routine

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Volker Lendecke 2017-09-10 14:55:13 +02:00
parent 154b28b686
commit fa53617542
3 changed files with 18 additions and 16 deletions

View File

@ -715,18 +715,14 @@ NTSTATUS netlogon_creds_cli_store(struct netlogon_creds_cli_context *context,
} }
NTSTATUS netlogon_creds_cli_delete(struct netlogon_creds_cli_context *context, NTSTATUS netlogon_creds_cli_delete(struct netlogon_creds_cli_context *context,
struct netlogon_creds_CredentialState **_creds) struct netlogon_creds_CredentialState *creds)
{ {
struct netlogon_creds_CredentialState *creds = *_creds;
NTSTATUS status; NTSTATUS status;
*_creds = NULL;
if (context->db.locked_state == NULL) { if (context->db.locked_state == NULL) {
/* /*
* this was not the result of netlogon_creds_cli_lock*() * this was not the result of netlogon_creds_cli_lock*()
*/ */
TALLOC_FREE(creds);
return NT_STATUS_INVALID_PAGE_PROTECTION; return NT_STATUS_INVALID_PAGE_PROTECTION;
} }
@ -734,13 +730,11 @@ NTSTATUS netlogon_creds_cli_delete(struct netlogon_creds_cli_context *context,
/* /*
* this was not the result of netlogon_creds_cli_lock*() * this was not the result of netlogon_creds_cli_lock*()
*/ */
TALLOC_FREE(creds);
return NT_STATUS_INVALID_PAGE_PROTECTION; return NT_STATUS_INVALID_PAGE_PROTECTION;
} }
status = dbwrap_delete(context->db.ctx, status = dbwrap_delete(context->db.ctx,
context->db.key_data); context->db.key_data);
TALLOC_FREE(creds);
if (!NT_STATUS_IS_OK(status)) { if (!NT_STATUS_IS_OK(status)) {
return status; return status;
} }
@ -1470,7 +1464,8 @@ static void netlogon_creds_cli_check_cleanup(struct tevent_req *req,
return; return;
} }
netlogon_creds_cli_delete(state->context, &state->creds); netlogon_creds_cli_delete(state->context, state->creds);
TALLOC_FREE(state->creds);
} }
static void netlogon_creds_cli_check_caps(struct tevent_req *subreq); static void netlogon_creds_cli_check_caps(struct tevent_req *subreq);
@ -1843,7 +1838,8 @@ static void netlogon_creds_cli_ServerPasswordSet_cleanup(struct tevent_req *req,
return; return;
} }
netlogon_creds_cli_delete(state->context, &state->creds); netlogon_creds_cli_delete(state->context, state->creds);
TALLOC_FREE(state->creds);
} }
static void netlogon_creds_cli_ServerPasswordSet_done(struct tevent_req *subreq); static void netlogon_creds_cli_ServerPasswordSet_done(struct tevent_req *subreq);
@ -2225,7 +2221,8 @@ static void netlogon_creds_cli_LogonSamLogon_cleanup(struct tevent_req *req,
return; return;
} }
netlogon_creds_cli_delete(state->context, &state->lk_creds); netlogon_creds_cli_delete(state->context, state->lk_creds);
TALLOC_FREE(state->lk_creds);
} }
static void netlogon_creds_cli_LogonSamLogon_done(struct tevent_req *subreq); static void netlogon_creds_cli_LogonSamLogon_done(struct tevent_req *subreq);
@ -2689,7 +2686,8 @@ static void netlogon_creds_cli_DsrUpdateReadOnlyServerDnsRecords_cleanup(struct
return; return;
} }
netlogon_creds_cli_delete(state->context, &state->creds); netlogon_creds_cli_delete(state->context, state->creds);
TALLOC_FREE(state->creds);
} }
static void netlogon_creds_cli_DsrUpdateReadOnlyServerDnsRecords_done(struct tevent_req *subreq); static void netlogon_creds_cli_DsrUpdateReadOnlyServerDnsRecords_done(struct tevent_req *subreq);
@ -2955,7 +2953,8 @@ static void netlogon_creds_cli_ServerGetTrustInfo_cleanup(struct tevent_req *req
return; return;
} }
netlogon_creds_cli_delete(state->context, &state->creds); netlogon_creds_cli_delete(state->context, state->creds);
TALLOC_FREE(state->creds);
} }
static void netlogon_creds_cli_ServerGetTrustInfo_done(struct tevent_req *subreq); static void netlogon_creds_cli_ServerGetTrustInfo_done(struct tevent_req *subreq);
@ -3241,7 +3240,8 @@ static void netlogon_creds_cli_GetForestTrustInformation_cleanup(struct tevent_r
return; return;
} }
netlogon_creds_cli_delete(state->context, &state->creds); netlogon_creds_cli_delete(state->context, state->creds);
TALLOC_FREE(state->creds);
} }
static void netlogon_creds_cli_GetForestTrustInformation_done(struct tevent_req *subreq); static void netlogon_creds_cli_GetForestTrustInformation_done(struct tevent_req *subreq);
@ -3518,7 +3518,8 @@ static void netlogon_creds_cli_SendToSam_cleanup(struct tevent_req *req,
return; return;
} }
netlogon_creds_cli_delete(state->context, &state->creds); netlogon_creds_cli_delete(state->context, state->creds);
TALLOC_FREE(state->creds);
} }
static void netlogon_creds_cli_SendToSam_done(struct tevent_req *subreq); static void netlogon_creds_cli_SendToSam_done(struct tevent_req *subreq);

View File

@ -70,7 +70,7 @@ bool netlogon_creds_cli_validate(struct netlogon_creds_cli_context *context,
NTSTATUS netlogon_creds_cli_store(struct netlogon_creds_cli_context *context, NTSTATUS netlogon_creds_cli_store(struct netlogon_creds_cli_context *context,
struct netlogon_creds_CredentialState *creds); struct netlogon_creds_CredentialState *creds);
NTSTATUS netlogon_creds_cli_delete(struct netlogon_creds_cli_context *context, NTSTATUS netlogon_creds_cli_delete(struct netlogon_creds_cli_context *context,
struct netlogon_creds_CredentialState **_creds); struct netlogon_creds_CredentialState *creds);
struct tevent_req *netlogon_creds_cli_lock_send(TALLOC_CTX *mem_ctx, struct tevent_req *netlogon_creds_cli_lock_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev, struct tevent_context *ev,

View File

@ -3322,7 +3322,8 @@ NTSTATUS cli_rpc_pipe_open_schannel_with_creds(struct cli_state *cli,
cli_credentials_set_netlogon_creds(cli_creds, NULL); cli_credentials_set_netlogon_creds(cli_creds, NULL);
if (NT_STATUS_EQUAL(status, NT_STATUS_NETWORK_ACCESS_DENIED)) { if (NT_STATUS_EQUAL(status, NT_STATUS_NETWORK_ACCESS_DENIED)) {
rpc_pipe_bind_dbglvl = 1; rpc_pipe_bind_dbglvl = 1;
netlogon_creds_cli_delete(netlogon_creds, &ncreds); netlogon_creds_cli_delete(netlogon_creds, ncreds);
TALLOC_FREE(ncreds);
} }
if (!NT_STATUS_IS_OK(status)) { if (!NT_STATUS_IS_OK(status)) {
DEBUG(rpc_pipe_bind_dbglvl, DEBUG(rpc_pipe_bind_dbglvl,