Ignore:
Timestamp:
May 23, 2008, 6:56:41 AM (17 years ago)
Author:
Paul Smedley
Message:

Update source to 3.0.29

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.0/source/nsswitch/idmap.c

    r124 r134  
    510510
    511511                talloc_free(config_option);
     512        }
     513
     514        /* on DCs we need to add idmap_tdb as the default backend if compat is
     515         * defined (when the old implicit configuration is used)
     516         * This is not done in the previous loop a on member server we exclude
     517         * the local domain. But on a DC the local domain is the only domain
     518         * available therefore we are left with no default domain */
     519        if (((lp_server_role() == ROLE_DOMAIN_PDC) ||
     520             (lp_server_role() == ROLE_DOMAIN_BDC)) &&
     521            ((num_domains == 0) && (compat == 1))) {
     522
     523                dom = TALLOC_ZERO_P(idmap_ctx, struct idmap_domain);
     524                IDMAP_CHECK_ALLOC(dom);
     525
     526                dom->name = talloc_strdup(dom, "__default__");
     527                IDMAP_CHECK_ALLOC(dom->name);
     528
     529                dom->default_domain = True;
     530                dom->readonly = False;
     531
     532                /* get the backend methods for this domain */
     533                dom->methods = get_methods(backends, compat_backend);
     534
     535                if ( ! dom->methods) {
     536                        ret = smb_probe_module("idmap", compat_backend);
     537                        if (NT_STATUS_IS_OK(ret)) {
     538                                dom->methods = get_methods(backends,
     539                                                           compat_backend);
     540                        }
     541                }
     542                if ( ! dom->methods) {
     543                        DEBUG(0, ("ERROR: Could not get methods for "
     544                                  "backend %s\n", compat_backend));
     545                        ret = NT_STATUS_UNSUCCESSFUL;
     546                        goto done;
     547                }
     548
     549                /* now that we have methods,
     550                 * set the destructor for this domain */
     551                talloc_set_destructor(dom, close_domain_destructor);
     552
     553                dom->params = talloc_strdup(dom, compat_params);
     554                IDMAP_CHECK_ALLOC(dom->params);
     555
     556                /* Finally instance a backend copy for this domain */
     557                ret = dom->methods->init(dom);
     558                if ( ! NT_STATUS_IS_OK(ret)) {
     559                        DEBUG(0, ("ERROR: Initialization failed for backend "
     560                                  "%s (domain %s), deferred!\n",
     561                                  compat_backend, dom->name));
     562                }
     563                idmap_domains = talloc_realloc(idmap_ctx, idmap_domains,
     564                                                struct idmap_domain *, 2);
     565                if ( ! idmap_domains) {
     566                        DEBUG(0, ("Out of memory!\n"));
     567                        ret = NT_STATUS_NO_MEMORY;
     568                        goto done;
     569                }
     570                idmap_domains[num_domains] = dom;
     571
     572                def_dom_num = num_domains;
     573
     574                /* Bump counter to next available slot */
     575
     576                num_domains++;
     577
     578                DEBUG(10, ("Domain %s - Backend %s - %sdefault - %sreadonly\n",
     579                                dom->name, compat_backend,
     580                                dom->default_domain?"":"not ",
     581                                dom->readonly?"":"not "));
    512582        }
    513583
Note: See TracChangeset for help on using the changeset viewer.