sysdb_subdomains.c revision 5ff7a765434ed0b4d37564ade26d7761d06f81c3
f90884915ff10ae83f59e709c68824de834e64f5Dominik Luecke System Database - Sub-domain related calls
f90884915ff10ae83f59e709c68824de834e64f5Dominik Luecke Copyright (C) 2012 Jan Zeleny <jzeleny@redhat.com>
2eeec5240b424984e3ee26296da1eeab6c6d739eChristian Maeder Copyright (C) 2012 Sumit Bose <sbose@redhat.com>
b72a390042c19e630cf221494b60c9df2a60d187Dominik Luecke This program is free software; you can redistribute it and/or modify
f90884915ff10ae83f59e709c68824de834e64f5Dominik Luecke it under the terms of the GNU General Public License as published by
f90884915ff10ae83f59e709c68824de834e64f5Dominik Luecke the Free Software Foundation; either version 3 of the License, or
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder (at your option) any later version.
2af38fde95f93562f2124ec615fba0e509c8202eDominik Luecke This program is distributed in the hope that it will be useful,
2af38fde95f93562f2124ec615fba0e509c8202eDominik Luecke but WITHOUT ANY WARRANTY; without even the implied warranty of
cf04ba46b9eb495d334466e24e082e391055ca7bDominik Luecke MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2af38fde95f93562f2124ec615fba0e509c8202eDominik Luecke GNU General Public License for more details.
926b3c5491f1c608f5b79e2d8014d7a1385558c3Dominik Luecke You should have received a copy of the GNU General Public License
2af38fde95f93562f2124ec615fba0e509c8202eDominik Luecke along with this program. If not, see <http://www.gnu.org/licenses/>.
16e124196c6b204769042028c74f533509c9b5d3Christian Maederstruct sss_domain_info *new_subdomain(TALLOC_CTX *mem_ctx,
2ea0ce749d2525f96d5d2f285f519ab07b005b8dDominik Luecke "Creating [%s] as subdomain of [%s]!\n", name, parent->name);
08056875f5f633ef432598d5245ea41c112d2178Dominik Luecke dom = talloc_zero(mem_ctx, struct sss_domain_info);
fcac596b16bb10f475066c323b9b1ca44db2b755Dominik Luecke DEBUG(SSSDBG_OP_FAILURE, "talloc_zero failed.\n");
16e124196c6b204769042028c74f533509c9b5d3Christian Maeder /* Sub-domains always have the same view as the parent */
b72a390042c19e630cf221494b60c9df2a60d187Dominik Luecke dom->view_name = talloc_strdup(dom, parent->view_name);
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder DEBUG(SSSDBG_OP_FAILURE, "Failed to copy parent's view name.\n");
656f17ae9b7610ff2de1b6eedeeadea0c3bcdc8dChristian Maeder DEBUG(SSSDBG_OP_FAILURE, "Failed to copy domain name.\n");
548f3850942936a8c6021185c8391dfcd3b03018Dominik Luecke dom->provider = talloc_strdup(dom, parent->provider);
656f17ae9b7610ff2de1b6eedeeadea0c3bcdc8dChristian Maeder DEBUG(SSSDBG_OP_FAILURE, "Failed to copy provider name.\n");
548f3850942936a8c6021185c8391dfcd3b03018Dominik Luecke dom->conn_name = talloc_strdup(dom, parent->conn_name);
548f3850942936a8c6021185c8391dfcd3b03018Dominik Luecke DEBUG(SSSDBG_OP_FAILURE, "Failed to copy connection name.\n");
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder DEBUG(SSSDBG_OP_FAILURE, "Failed to copy realm name.\n");
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder dom->flat_name = talloc_strdup(dom, flat_name);
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder DEBUG(SSSDBG_OP_FAILURE, "Failed to copy flat name.\n");
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder DEBUG(SSSDBG_OP_FAILURE, "Failed to copy forest.\n");
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder /* If the parent domain filters out group members, the subdomain should
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder * as well if configured */
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder inherit_option = string_in_list(CONFDB_DOMAIN_IGNORE_GROUP_MEMBERS,
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder dom->ignore_group_members = parent->ignore_group_members;
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder /* If the parent domain explicitly limits ID ranges, the subdomain
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder * should honour the limits as well.
202df46772cac2ee2e8627ba196a5faebb6f9a05Christian Maeder dom->id_min = parent->id_min ? parent->id_min : 0;
202df46772cac2ee2e8627ba196a5faebb6f9a05Christian Maeder dom->id_max = parent->id_max ? parent->id_max : 0xffffffff;
202df46772cac2ee2e8627ba196a5faebb6f9a05Christian Maeder dom->pwd_expiration_warning = parent->pwd_expiration_warning;
202df46772cac2ee2e8627ba196a5faebb6f9a05Christian Maeder dom->cache_credentials = parent->cache_credentials;
202df46772cac2ee2e8627ba196a5faebb6f9a05Christian Maeder dom->group_timeout = parent->group_timeout;
202df46772cac2ee2e8627ba196a5faebb6f9a05Christian Maeder dom->netgroup_timeout = parent->netgroup_timeout;
202df46772cac2ee2e8627ba196a5faebb6f9a05Christian Maeder dom->service_timeout = parent->service_timeout;
202df46772cac2ee2e8627ba196a5faebb6f9a05Christian Maeder dom->override_homedir = parent->override_homedir;
202df46772cac2ee2e8627ba196a5faebb6f9a05Christian Maeder dom->fallback_homedir = parent->fallback_homedir;
202df46772cac2ee2e8627ba196a5faebb6f9a05Christian Maeder dom->subdomain_homedir = parent->subdomain_homedir;
202df46772cac2ee2e8627ba196a5faebb6f9a05Christian Maeder dom->override_shell = parent->override_shell;
202df46772cac2ee2e8627ba196a5faebb6f9a05Christian Maeder dom->default_shell = parent->default_shell;
202df46772cac2ee2e8627ba196a5faebb6f9a05Christian Maeder dom->homedir_substr = parent->homedir_substr;
202df46772cac2ee2e8627ba196a5faebb6f9a05Christian Maeder DEBUG(SSSDBG_OP_FAILURE, "Missing sysdb context in parent domain.\n");
goto fail;
return dom;
fail:
return NULL;
struct sss_domain_info *d;
if (is_forest_root(d) == true) {
d->forest_root = d;
NULL};
const char *name;
const char *realm;
const char *flat;
const char *id;
const char *forest;
bool mpg;
bool enumerate;
goto done;
goto done;
goto done;
goto done;
goto done;
SYSDB_SUBDOMAIN_MPG, false);
SYSDB_SUBDOMAIN_ENUM, false);
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
done:
return ret;
const char *tmp_str;
NULL};
return ENOMEM;
goto done;
goto done;
goto done;
goto done;
NULL);
goto done;
NULL);
goto done;
NULL);
goto done;
NULL);
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
done:
return ret;
const char *realm,
const char *flat,
const char *id,
const char* forest)
int ret;
bool do_update = false;
return ENOMEM;
goto done;
goto done;
goto done;
goto done;
do_update = true;
goto done;
goto done;
do_update = true;
goto done;
goto done;
do_update = true;
goto done;
goto done;
do_update = true;
if (do_update == false) {
goto done;
goto done;
goto done;
done:
return ret;
NULL};
const char *tmp_str;
bool tmp_bool;
bool store = false;
int realm_flags = 0;
int flat_flags = 0;
int id_flags = 0;
int mpg_flags = 0;
int enum_flags = 0;
int forest_flags = 0;
int td_flags = 0;
int ret;
return ENOMEM;
goto done;
goto done;
if (ret) {
goto done;
store = true;
goto done;
if (realm) {
if (flat_name) {
if (domain_id) {
!mpg);
!enumerate);
if (forest) {
&& td_flags == 0) {
goto done;
goto done;
if (store) {
goto done;
goto done;
if (realm_flags) {
goto done;
goto done;
if (flat_flags) {
goto done;
goto done;
if (id_flags) {
goto done;
goto done;
if (mpg_flags) {
goto done;
goto done;
if (enum_flags) {
goto done;
goto done;
if (forest_flags) {
NULL);
goto done;
goto done;
if (td_flags) {
goto done;
goto done;
goto done;
done:
return ret;
int ret;
goto done;
goto done;
goto done;
done:
return ret;
const char *domain_component_name,
char *dom_basedn;
char *expected_basedn;
const char *orig_dn;
size_t c = 0;
int ret;
int dom_basedn_comp_num;
int dn_comp_num;
const char *component_name;
|| count == 0) {
return EINVAL;
return ENOMEM;
goto done;
goto done;
goto done;
goto done;
for (c = 0; c < count; c++) {
goto done;
expected_basedn) == 0) {
goto done;
for (c = 0; c < count; c++) {
goto done;
dom_basedn) == 0) {
goto done;
domain_component_name) != 0) {
goto done;
goto done;
done:
return ret;