summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-04-06 14:45:19 +0200
committerKarolin Seeger <kseeger@samba.org>2010-05-06 14:08:37 +0200
commit57ad736c45fd5f310cef86060640d142ccfbda68 (patch)
tree0c6915b7b456002d2471c81f8c335996e1ff36ec
parent4701e4a4065513416819d3091cf25bb2ba814622 (diff)
downloadsamba-57ad736c45fd5f310cef86060640d142ccfbda68.tar.gz
s3:winbindd_reconnect: don't only reconnect on NT_STATUS_UNSUCCESSFUL
metze (cherry picked from commit 6bd5a2a3739938f95fce23ab2da652c9b5a48111) (cherry picked from commit 169628fcb656ba5987a99bd50c7f588b731eae51) Signed-off-by: Stefan Metzmacher <metze@samba.org> (cherry picked from commit 30c048c124ece9648e0ec00991780b57af90201e)
-rw-r--r--source3/winbindd/winbindd_reconnect.c73
1 files changed, 59 insertions, 14 deletions
diff --git a/source3/winbindd/winbindd_reconnect.c b/source3/winbindd/winbindd_reconnect.c
index 25debccc5a6..f76a93aa94f 100644
--- a/source3/winbindd/winbindd_reconnect.c
+++ b/source3/winbindd/winbindd_reconnect.c
@@ -27,6 +27,51 @@
extern struct winbindd_methods msrpc_methods;
+static bool reconnect_need_retry(NTSTATUS status)
+{
+ if (NT_STATUS_IS_OK(status)) {
+ return false;
+ }
+
+ if (!NT_STATUS_IS_ERR(status)) {
+ return false;
+ }
+
+ if (NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED)) {
+ return false;
+ }
+
+ if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_USER)) {
+ return false;
+ }
+
+ if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_GROUP)) {
+ return false;
+ }
+
+ if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_ALIAS)) {
+ return false;
+ }
+
+ if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_MEMBER)) {
+ return false;
+ }
+
+ if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_DOMAIN)) {
+ return false;
+ }
+
+ if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_PRIVILEGE)) {
+ return false;
+ }
+
+ if (NT_STATUS_EQUAL(status, NT_STATUS_NO_MEMORY)) {
+ return false;
+ }
+
+ return true;
+}
+
/* List all users */
static NTSTATUS query_user_list(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
@@ -38,7 +83,7 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
result = msrpc_methods.query_user_list(domain, mem_ctx,
num_entries, info);
- if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
+ if (reconnect_need_retry(result))
result = msrpc_methods.query_user_list(domain, mem_ctx,
num_entries, info);
return result;
@@ -55,7 +100,7 @@ static NTSTATUS enum_dom_groups(struct winbindd_domain *domain,
result = msrpc_methods.enum_dom_groups(domain, mem_ctx,
num_entries, info);
- if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
+ if (reconnect_need_retry(result))
result = msrpc_methods.enum_dom_groups(domain, mem_ctx,
num_entries, info);
return result;
@@ -73,7 +118,7 @@ static NTSTATUS enum_local_groups(struct winbindd_domain *domain,
result = msrpc_methods.enum_local_groups(domain, mem_ctx,
num_entries, info);
- if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
+ if (reconnect_need_retry(result))
result = msrpc_methods.enum_local_groups(domain, mem_ctx,
num_entries, info);
@@ -95,7 +140,7 @@ static NTSTATUS name_to_sid(struct winbindd_domain *domain,
domain_name, name,
sid, type);
- if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
+ if (reconnect_need_retry(result))
result = msrpc_methods.name_to_sid(domain, mem_ctx, orig_cmd,
domain_name, name,
sid, type);
@@ -118,7 +163,7 @@ static NTSTATUS sid_to_name(struct winbindd_domain *domain,
result = msrpc_methods.sid_to_name(domain, mem_ctx, sid,
domain_name, name, type);
- if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
+ if (reconnect_need_retry(result))
result = msrpc_methods.sid_to_name(domain, mem_ctx, sid,
domain_name, name, type);
@@ -139,7 +184,7 @@ static NTSTATUS rids_to_names(struct winbindd_domain *domain,
result = msrpc_methods.rids_to_names(domain, mem_ctx, sid,
rids, num_rids,
domain_name, names, types);
- if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL)) {
+ if (reconnect_need_retry(result)) {
result = msrpc_methods.rids_to_names(domain, mem_ctx, sid,
rids, num_rids,
domain_name, names,
@@ -160,7 +205,7 @@ static NTSTATUS query_user(struct winbindd_domain *domain,
result = msrpc_methods.query_user(domain, mem_ctx, user_sid,
user_info);
- if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
+ if (reconnect_need_retry(result))
result = msrpc_methods.query_user(domain, mem_ctx, user_sid,
user_info);
@@ -179,7 +224,7 @@ static NTSTATUS lookup_usergroups(struct winbindd_domain *domain,
user_sid, num_groups,
user_gids);
- if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
+ if (reconnect_need_retry(result))
result = msrpc_methods.lookup_usergroups(domain, mem_ctx,
user_sid, num_groups,
user_gids);
@@ -199,7 +244,7 @@ static NTSTATUS lookup_useraliases(struct winbindd_domain *domain,
num_aliases,
alias_rids);
- if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
+ if (reconnect_need_retry(result))
result = msrpc_methods.lookup_useraliases(domain, mem_ctx,
num_sids, sids,
num_aliases,
@@ -222,7 +267,7 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain *domain,
sid_mem, names,
name_types);
- if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
+ if (reconnect_need_retry(result))
result = msrpc_methods.lookup_groupmem(domain, mem_ctx,
group_sid, num_names,
sid_mem, names,
@@ -238,7 +283,7 @@ static NTSTATUS sequence_number(struct winbindd_domain *domain, uint32 *seq)
result = msrpc_methods.sequence_number(domain, seq);
- if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
+ if (reconnect_need_retry(result))
result = msrpc_methods.sequence_number(domain, seq);
return result;
@@ -253,7 +298,7 @@ static NTSTATUS lockout_policy(struct winbindd_domain *domain,
result = msrpc_methods.lockout_policy(domain, mem_ctx, policy);
- if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
+ if (reconnect_need_retry(result))
result = msrpc_methods.lockout_policy(domain, mem_ctx, policy);
return result;
@@ -268,7 +313,7 @@ static NTSTATUS password_policy(struct winbindd_domain *domain,
result = msrpc_methods.password_policy(domain, mem_ctx, policy);
- if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
+ if (reconnect_need_retry(result))
result = msrpc_methods.password_policy(domain, mem_ctx, policy);
return result;
@@ -288,7 +333,7 @@ static NTSTATUS trusted_domains(struct winbindd_domain *domain,
num_domains, names,
alt_names, dom_sids);
- if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
+ if (reconnect_need_retry(result))
result = msrpc_methods.trusted_domains(domain, mem_ctx,
num_domains, names,
alt_names, dom_sids);