summaryrefslogtreecommitdiff
path: root/source3/nsswitch/winbindd_cm.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-10-17 17:10:24 +0000
committerJeremy Allison <jra@samba.org>2002-10-17 17:10:24 +0000
commitc53eb2ed540e79d6deae5f41e17febc5bf5dbf57 (patch)
treee8de6cd8f4ced70b70d6ca553c0b99b01cb0dfbb /source3/nsswitch/winbindd_cm.c
parent788ca8b1185e3624ca623baade05e86f9114e69f (diff)
downloadsamba-c53eb2ed540e79d6deae5f41e17febc5bf5dbf57.tar.gz
samba-c53eb2ed540e79d6deae5f41e17febc5bf5dbf57.tar.bz2
samba-c53eb2ed540e79d6deae5f41e17febc5bf5dbf57.zip
Added new error codes. Fix up connection code to retry in the same way
that app-head does. Jeremy. (This used to be commit ec7953f20145799f6286a295472df4826bfdfb8f)
Diffstat (limited to 'source3/nsswitch/winbindd_cm.c')
-rw-r--r--source3/nsswitch/winbindd_cm.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/source3/nsswitch/winbindd_cm.c b/source3/nsswitch/winbindd_cm.c
index cb1779f590..5f477c78f7 100644
--- a/source3/nsswitch/winbindd_cm.c
+++ b/source3/nsswitch/winbindd_cm.c
@@ -392,6 +392,8 @@ static NTSTATUS cm_open_connection(const char *domain, const int pipe_index,
NTSTATUS result;
char *ipc_username, *ipc_domain, *ipc_password;
struct in_addr dc_ip;
+ int i;
+ BOOL retry = True;
ZERO_STRUCT(dc_ip);
@@ -446,10 +448,22 @@ static NTSTATUS cm_open_connection(const char *domain, const int pipe_index,
DEBUG(5, ("connecting to %s from %s with username [%s]\\[%s]\n",
new_conn->controller, global_myname, ipc_domain, ipc_username));
- result = cli_full_connection(&(new_conn->cli), global_myname, new_conn->controller,
- &dc_ip, 0, "IPC$",
- "IPC", ipc_username, ipc_domain,
- ipc_password, 0);
+ for (i = 0; retry && (i < 3); i++) {
+
+ if (!secrets_named_mutex(new_conn->controller, 10)) {
+ DEBUG(0,("cm_open_connection: mutex grab failed for %s\n", new_conn->controller));
+ continue;
+ }
+
+ result = cli_full_connection(&(new_conn->cli), global_myname, new_conn->controller,
+ &dc_ip, 0, "IPC$", "IPC", ipc_username, ipc_domain,
+ ipc_password, 0, &retry);
+
+ secrets_named_mutex_release(new_conn->controller);
+
+ if (NT_STATUS_IS_OK(result))
+ break;
+ }
SAFE_FREE(ipc_username);
SAFE_FREE(ipc_domain);