1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

winbind: cleanup winbindd_cli_state->grent_state if winbindd_getgrent_recv() returns an error

A client may skip the explicit endgrent() if getgrent() fails.

This allows client_is_idle() return true in more cases.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13293

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
This commit is contained in:
Stefan Metzmacher 2018-02-16 16:13:16 +01:00
parent 6548b82b5c
commit b7789da846

View File

@ -141,6 +141,7 @@ NTSTATUS winbindd_getgrent_recv(struct tevent_req *req,
int i; int i;
if (tevent_req_is_nterror(req, &status)) { if (tevent_req_is_nterror(req, &status)) {
TALLOC_FREE(state->cli->grent_state);
DEBUG(5, ("getgrent failed: %s\n", nt_errstr(status))); DEBUG(5, ("getgrent failed: %s\n", nt_errstr(status)));
return status; return status;
} }
@ -151,6 +152,7 @@ NTSTATUS winbindd_getgrent_recv(struct tevent_req *req,
memberstrings = talloc_array(talloc_tos(), char *, state->num_groups); memberstrings = talloc_array(talloc_tos(), char *, state->num_groups);
if (memberstrings == NULL) { if (memberstrings == NULL) {
TALLOC_FREE(state->cli->grent_state);
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;
} }
@ -165,6 +167,7 @@ NTSTATUS winbindd_getgrent_recv(struct tevent_req *req,
if (!NT_STATUS_IS_OK(status)) { if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(memberstrings); TALLOC_FREE(memberstrings);
TALLOC_FREE(state->cli->grent_state);
return status; return status;
} }
TALLOC_FREE(state->members[i]); TALLOC_FREE(state->members[i]);
@ -180,6 +183,7 @@ NTSTATUS winbindd_getgrent_recv(struct tevent_req *req,
result = talloc_realloc(state, state->groups, char, result = talloc_realloc(state, state->groups, char,
base_memberofs + total_memberlen); base_memberofs + total_memberlen);
if (result == NULL) { if (result == NULL) {
TALLOC_FREE(state->cli->grent_state);
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;
} }
state->groups = (struct winbindd_gr *)result; state->groups = (struct winbindd_gr *)result;