From 583b7ed6595e85e8366632dd0ab5dbfcdc1838e6 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Tue, 31 May 2005 18:36:38 +0000 Subject: r7148: Fix #2736: winbind race condition with detecting idle clients winbind idle connection closing logic is getting invoked under high loads for clients which may already have commands in the pipe. This race condition causes clients to fail with NSS_STATUS_UNAVAIL sometimes. We now retry several times hoping (still not guaranteed, though) it will work. (This used to be commit 05c04cfd2526b8b9a82916b5dffc18bf27c3f198) --- source3/nsswitch/wb_common.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/source3/nsswitch/wb_common.c b/source3/nsswitch/wb_common.c index 40cf534c41..d2e8b9cc6a 100644 --- a/source3/nsswitch/wb_common.c +++ b/source3/nsswitch/wb_common.c @@ -588,12 +588,18 @@ NSS_STATUS winbindd_request(int req_type, struct winbindd_request *request, struct winbindd_response *response) { - NSS_STATUS status; + NSS_STATUS status = NSS_STATUS_UNAVAIL; + int count = 0; - status = winbindd_send_request(req_type, request); - if (status != NSS_STATUS_SUCCESS) - return(status); - return winbindd_get_response(response); + while ((status == NSS_STATUS_UNAVAIL) && (count < 10)) { + status = winbindd_send_request(req_type, request); + if (status != NSS_STATUS_SUCCESS) + return(status); + status = winbindd_get_response(response); + count += 1; + } + + return status; } /************************************************************************* @@ -606,7 +612,7 @@ NSS_STATUS winbindd_request(int req_type, BOOL winbind_off( void ) { - static char *s = CONST_DISCARD(char *, WINBINDD_DONT_ENV "=1"); + static char *s = CONST_DISCARD(char *, WINBINDD_DONT_ENV "=1"); return putenv(s) != -1; } -- cgit