From: Stefan Metzmacher Date: Fri, 16 Feb 2018 15:09:58 +0000 (+0100) Subject: winbind: call lp_winbind_enum_{users,groups}() already in set{pw,gr}ent() X-Git-Tag: ldb-1.3.2~53 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6548b82b5c1ed30ce14e17e4ba9d4bc24ab49c42;p=thirdparty%2Fsamba.git winbind: call lp_winbind_enum_{users,groups}() already in set{pw,gr}ent() This way we don't keep winbindd_cli_state->{pw,gr}ent_state arround forever, if the client forgets an explicit end{pw,gr}ent(). 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 Reviewed-by: Volker Lendecke --- diff --git a/source3/winbindd/winbindd_getgrent.c b/source3/winbindd/winbindd_getgrent.c index 2c8cbac083a..1056555dc23 100644 --- a/source3/winbindd/winbindd_getgrent.c +++ b/source3/winbindd/winbindd_getgrent.c @@ -50,11 +50,6 @@ struct tevent_req *winbindd_getgrent_send(TALLOC_CTX *mem_ctx, DEBUG(3, ("[%5lu]: getgrent\n", (unsigned long)cli->pid)); - if (!lp_winbind_enum_groups()) { - tevent_req_nterror(req, NT_STATUS_NO_MORE_ENTRIES); - return tevent_req_post(req, ev); - } - if (cli->grent_state == NULL) { tevent_req_nterror(req, NT_STATUS_NO_MORE_ENTRIES); return tevent_req_post(req, ev); diff --git a/source3/winbindd/winbindd_getpwent.c b/source3/winbindd/winbindd_getpwent.c index 3c035eac8a6..d33f5f9864f 100644 --- a/source3/winbindd/winbindd_getpwent.c +++ b/source3/winbindd/winbindd_getpwent.c @@ -49,11 +49,6 @@ struct tevent_req *winbindd_getpwent_send(TALLOC_CTX *mem_ctx, DEBUG(3, ("[%5lu]: getpwent\n", (unsigned long)cli->pid)); - if (!lp_winbind_enum_users()) { - tevent_req_nterror(req, NT_STATUS_NO_MORE_ENTRIES); - return tevent_req_post(req, ev); - } - if (cli->pwent_state == NULL) { tevent_req_nterror(req, NT_STATUS_NO_MORE_ENTRIES); return tevent_req_post(req, ev); diff --git a/source3/winbindd/winbindd_setgrent.c b/source3/winbindd/winbindd_setgrent.c index 79aa8c35962..ab7fa98425b 100644 --- a/source3/winbindd/winbindd_setgrent.c +++ b/source3/winbindd/winbindd_setgrent.c @@ -39,6 +39,11 @@ struct tevent_req *winbindd_setgrent_send(TALLOC_CTX *mem_ctx, } TALLOC_FREE(cli->grent_state); + if (!lp_winbind_enum_groups()) { + tevent_req_done(req); + return tevent_req_post(req, ev); + } + cli->grent_state = talloc_zero(cli, struct getgrent_state); if (tevent_req_nomem(cli->grent_state, req)) { return tevent_req_post(req, ev); diff --git a/source3/winbindd/winbindd_setpwent.c b/source3/winbindd/winbindd_setpwent.c index af287584757..4591731923a 100644 --- a/source3/winbindd/winbindd_setpwent.c +++ b/source3/winbindd/winbindd_setpwent.c @@ -39,6 +39,11 @@ struct tevent_req *winbindd_setpwent_send(TALLOC_CTX *mem_ctx, } TALLOC_FREE(cli->pwent_state); + if (!lp_winbind_enum_users()) { + tevent_req_done(req); + return tevent_req_post(req, ev); + } + cli->pwent_state = talloc_zero(cli, struct getpwent_state); if (tevent_req_nomem(cli->pwent_state, req)) { return tevent_req_post(req, ev);