]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
winbindd: Factor out winbindd_domain_init_backend from get_cache()
authorVolker Lendecke <vl@samba.org>
Sun, 6 Aug 2017 16:11:02 +0000 (18:11 +0200)
committerKarolin Seeger <kseeger@samba.org>
Thu, 24 May 2018 10:50:13 +0000 (12:50 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13369

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/winbindd/winbindd_cache.c

index 98c69f8b231fd7e4fbecc85eb866ada3c7f4a639..8492f9075533e1c6b3fe842ef528c6ff90c03581 100644 (file)
@@ -119,12 +119,11 @@ static char *wcache_path(void)
        return state_path("winbindd_cache.tdb");
 }
 
-/* get the winbind_cache structure */
-static struct winbind_cache *get_cache(struct winbindd_domain *domain)
+static void winbindd_domain_init_backend(struct winbindd_domain *domain)
 {
-       struct winbind_cache *ret = wcache;
-
-       /* We have to know what type of domain we are dealing with first. */
+       if (domain->backend != NULL) {
+               return;
+       }
 
        if (domain->internal) {
                domain->backend = &builtin_passdb_methods;
@@ -189,6 +188,14 @@ static struct winbind_cache *get_cache(struct winbindd_domain *domain)
                DBG_INFO("Setting MS-RPC methods for domain %s\n", domain->name);
                domain->backend = &reconnect_methods;
        }
+}
+
+/* get the winbind_cache structure */
+static struct winbind_cache *get_cache(struct winbindd_domain *domain)
+{
+       struct winbind_cache *ret = wcache;
+
+       winbindd_domain_init_backend(domain);
 
        if (ret != NULL) {
                return ret;