static struct idmap_domain *idmap_init_passdb_domain(TALLOC_CTX *mem_ctx) { idmap_init(); /* * Always init the default domain, we can't go without one */ if (default_idmap_domain == NULL) { default_idmap_domain = idmap_init_default_domain(NULL); } if (default_idmap_domain == NULL) { return NULL; } if (passdb_idmap_domain != NULL) { return passdb_idmap_domain; } passdb_idmap_domain = idmap_init_domain(NULL, get_global_sam_name(), "passdb", false); if (passdb_idmap_domain == NULL) { DEBUG(1, ("Could not init passdb idmap domain\n")); } return passdb_idmap_domain; }
static struct idmap_domain *idmap_find_domain(const char *domname) { struct idmap_domain *result; int i; DEBUG(10, ("idmap_find_domain called for domain '%s'\n", domname?domname:"NULL")); /* * Always init the default domain, we can't go without one */ if (default_idmap_domain == NULL) { default_idmap_domain = idmap_init_default_domain(NULL); } if (default_idmap_domain == NULL) { return NULL; } if ((domname == NULL) || (domname[0] == '\0')) { return default_idmap_domain; } for (i=0; i<num_domains; i++) { if (strequal(idmap_domains[i]->name, domname)) { return idmap_domains[i]; } } if (idmap_domains == NULL) { /* * talloc context for all idmap domains */ idmap_domains = TALLOC_ARRAY(NULL, struct idmap_domain *, 1); }