summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorRalph Boehme <slow@samba.org>2018-03-12 13:30:01 +0100
committerKarolin Seeger <kseeger@samba.org>2018-05-07 09:57:25 +0200
commit4f793f6935b3ff9f776ec74da6659fc2cbdf7844 (patch)
treec6faacb303de8ef3f17a0f7a53b0f1bf63163e57 /source3
parentbc655b6616875961b39d6a2871dfe48ee146c7aa (diff)
downloadsamba-4f793f6935b3ff9f776ec74da6659fc2cbdf7844.tar.gz
winbindd: add and use ldap_reconnect_need_retry() in winbindd_reconnect_ads.c
ldap_reconnect_need_retry() is a copy of reconnect_need_retry() minus the RPC connection invalidation. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13332 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> (cherry picked from commit a8d5e4d36768bc199c631626488b2d0acbd6e91a)
Diffstat (limited to 'source3')
-rw-r--r--source3/winbindd/winbindd_reconnect_ads.c58
1 files changed, 52 insertions, 6 deletions
diff --git a/source3/winbindd/winbindd_reconnect_ads.c b/source3/winbindd/winbindd_reconnect_ads.c
index 3bb8b5ecba1..0a0a14f6dd0 100644
--- a/source3/winbindd/winbindd_reconnect_ads.c
+++ b/source3/winbindd/winbindd_reconnect_ads.c
@@ -31,6 +31,52 @@
extern struct winbindd_methods ads_methods;
+static bool ldap_reconnect_need_retry(NTSTATUS status,
+ struct winbindd_domain *domain)
+{
+ 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,
@@ -40,7 +86,7 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
result = ads_methods.query_user_list(domain, mem_ctx, rids);
- if (reconnect_need_retry(result, domain)) {
+ if (ldap_reconnect_need_retry(result, domain)) {
result = ads_methods.query_user_list(domain, mem_ctx, rids);
}
@@ -58,7 +104,7 @@ static NTSTATUS enum_dom_groups(struct winbindd_domain *domain,
result = ads_methods.enum_dom_groups(domain, mem_ctx,
num_entries, info);
- if (reconnect_need_retry(result, domain)) {
+ if (ldap_reconnect_need_retry(result, domain)) {
result = ads_methods.enum_dom_groups(domain, mem_ctx,
num_entries, info);
}
@@ -77,7 +123,7 @@ static NTSTATUS enum_local_groups(struct winbindd_domain *domain,
result = ads_methods.enum_local_groups(domain, mem_ctx,
num_entries, info);
- if (reconnect_need_retry(result, domain)) {
+ if (ldap_reconnect_need_retry(result, domain)) {
result = ads_methods.enum_local_groups(domain, mem_ctx,
num_entries, info);
}
@@ -165,7 +211,7 @@ static NTSTATUS lookup_usergroups(struct winbindd_domain *domain,
result = ads_methods.lookup_usergroups(domain, mem_ctx, user_sid,
num_groups, user_gids);
- if (reconnect_need_retry(result, domain)) {
+ if (ldap_reconnect_need_retry(result, domain)) {
result = ads_methods.lookup_usergroups(domain, mem_ctx,
user_sid, num_groups,
user_gids);
@@ -210,7 +256,7 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain *domain,
num_names, sid_mem, names,
name_types);
- if (reconnect_need_retry(result, domain)) {
+ if (ldap_reconnect_need_retry(result, domain)) {
result = ads_methods.lookup_groupmem(domain, mem_ctx, group_sid,
type, num_names, sid_mem,
names, name_types);
@@ -226,7 +272,7 @@ static NTSTATUS sequence_number(struct winbindd_domain *domain, uint32_t *seq)
result = ads_methods.sequence_number(domain, seq);
- if (reconnect_need_retry(result, domain)) {
+ if (ldap_reconnect_need_retry(result, domain)) {
result = ads_methods.sequence_number(domain, seq);
}