summaryrefslogtreecommitdiffstats
path: root/source/nsswitch/wb_common.c
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2005-05-31 18:36:38 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:57:03 -0500
commit05c04cfd2526b8b9a82916b5dffc18bf27c3f198 (patch)
tree0b58ffd2a0fed5633d91b4e130e7bac3105061f1 /source/nsswitch/wb_common.c
parentef80a49a858d7d81d427c7bac71fdac4fc0d1bd6 (diff)
downloadsamba-05c04cfd2526b8b9a82916b5dffc18bf27c3f198.tar.gz
samba-05c04cfd2526b8b9a82916b5dffc18bf27c3f198.tar.xz
samba-05c04cfd2526b8b9a82916b5dffc18bf27c3f198.zip
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.
Diffstat (limited to 'source/nsswitch/wb_common.c')
-rw-r--r--source/nsswitch/wb_common.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/source/nsswitch/wb_common.c b/source/nsswitch/wb_common.c
index 40cf534c41d..d2e8b9cc6ac 100644
--- a/source/nsswitch/wb_common.c
+++ b/source/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;
}