]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
winbindd: add and use ldap_reconnect_need_retry() in winbindd_reconnect_ads.c
authorRalph Boehme <slow@samba.org>
Mon, 12 Mar 2018 12:30:01 +0000 (13:30 +0100)
committerRalph Boehme <slow@samba.org>
Thu, 15 Mar 2018 14:46:09 +0000 (15:46 +0100)
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>
source3/winbindd/winbindd_reconnect_ads.c

index 3bb8b5ecba1d18e475b92d4b6f442457ae96f615..0a0a14f6dd02a623d954b0422de022370b860a36 100644 (file)
 
 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);
        }