diff options
author | Simo Sorce <simo@redhat.com> | 2013-01-14 16:47:51 -0500 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-02-10 22:08:47 +0100 |
commit | 95e94691178297f2b8225a83d43ae388cab04b45 (patch) | |
tree | 5869555cf5490a7019b3f18d4fa647a9dae8b619 | |
parent | 1187a07ed4207c1c326fdf83915dddfe472b8620 (diff) | |
download | sssd-95e94691178297f2b8225a83d43ae388cab04b45.tar.gz sssd-95e94691178297f2b8225a83d43ae388cab04b45.tar.bz2 sssd-95e94691178297f2b8225a83d43ae388cab04b45.zip |
Remove sysdb_subdom completely
struct sss_domain_info is always used to represent domains now.
Adjust tests accordingly.
-rw-r--r-- | src/db/sysdb.h | 12 | ||||
-rw-r--r-- | src/db/sysdb_subdomains.c | 24 | ||||
-rw-r--r-- | src/providers/ipa/ipa_subdomains.c | 110 | ||||
-rw-r--r-- | src/tests/sysdb-tests.c | 112 |
4 files changed, 131 insertions, 127 deletions
diff --git a/src/db/sysdb.h b/src/db/sysdb.h index 98cf6bcd..2bc858ed 100644 --- a/src/db/sysdb.h +++ b/src/db/sysdb.h @@ -235,13 +235,6 @@ struct sysdb_attrs { /* sysdb_attrs helper functions */ struct sysdb_attrs *sysdb_new_attrs(TALLOC_CTX *mem_ctx); -struct sysdb_subdom { - const char *realm; - const char *name; - const char *flat_name; - const char *id; -}; - struct range_info { char *name; uint32_t base_id; @@ -373,10 +366,7 @@ errno_t sysdb_subdomain_store(struct sysdb_ctx *sysdb, const char *name, const char *realm, const char *flat_name, const char *domain_id); -errno_t sysdb_update_subdomains(struct sss_domain_info *domain, - int num_subdoms, - struct sysdb_subdom *subdoms); - +errno_t sysdb_update_subdomains(struct sss_domain_info *domain); errno_t sysdb_master_domain_update(struct sss_domain_info *domain); diff --git a/src/db/sysdb_subdomains.c b/src/db/sysdb_subdomains.c index d6692b6d..c2719075 100644 --- a/src/db/sysdb_subdomains.c +++ b/src/db/sysdb_subdomains.c @@ -394,7 +394,6 @@ errno_t sysdb_subdomain_store(struct sysdb_ctx *sysdb, goto done; } - ret = ldb_msg_add_string(msg, SYSDB_OBJECTCLASS, SYSDB_SUBDOMAIN_CLASS); if (ret != LDB_SUCCESS) { ret = sysdb_error_to_errno(ret); @@ -461,9 +460,7 @@ done: return ret; } -errno_t sysdb_update_subdomains(struct sss_domain_info *domain, - int num_subdoms, - struct sysdb_subdom *subdoms) +errno_t sysdb_update_subdomains(struct sss_domain_info *domain) { int ret; int sret; @@ -508,9 +505,9 @@ errno_t sysdb_update_subdomains(struct sss_domain_info *domain, * - if a subdomain already exists in sysdb, mark it for preservation * - if the subdomain doesn't exist in sysdb, create its bare structure */ - for (c = 0; c < num_subdoms; c++) { + for (c = 0; c < domain->subdomain_count; c++) { for (d = 0; d < cur_subdomains_count; d++) { - if (strcasecmp(subdoms[c].name, + if (strcasecmp(domain->subdomains[c]->name, cur_subdomains[d]->name) == 0) { keep_subdomain[d] = true; /* sub-domain already in cache, nothing to do */ @@ -519,20 +516,9 @@ errno_t sysdb_update_subdomains(struct sss_domain_info *domain, } if (d == cur_subdomains_count) { - struct sss_domain_info *ns; - DEBUG(SSSDBG_TRACE_FUNC, ("Adding sub-domain [%s].\n", - subdoms[c].name)); - - ns = new_subdomain(tmp_ctx, domain, - subdoms[c].name, subdoms[c].realm, - subdoms[c].flat_name, subdoms[c].id); - if (!ns) { - DEBUG(SSSDBG_OP_FAILURE, ("new_subdomain failed.\n")); - goto done; - } - - ret = sysdb_subdomain_create(ns); + domain->subdomains[c]->name)); + ret = sysdb_subdomain_create(domain->subdomains[c]); if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, ("sysdb_subdomain_create failed.\n")); goto done; diff --git a/src/providers/ipa/ipa_subdomains.c b/src/providers/ipa/ipa_subdomains.c index 6c441b47..312813c0 100644 --- a/src/providers/ipa/ipa_subdomains.c +++ b/src/providers/ipa/ipa_subdomains.c @@ -77,10 +77,6 @@ struct ipa_subdomains_ctx { struct tevent_timer *timer_event; bool configured_explicit; time_t disabled_until; - - /* subdomain map cache */ - int num_subdoms; - struct sysdb_subdom *subdoms; }; const char *get_flat_name_from_subdomain_name(struct be_ctx *be_ctx, @@ -88,6 +84,7 @@ const char *get_flat_name_from_subdomain_name(struct be_ctx *be_ctx, { size_t c; struct ipa_subdomains_ctx *ctx; + struct sss_domain_info *domain; ctx = talloc_get_type(be_ctx->bet_info[BET_SUBDOMAINS].pvt_bet_data, struct ipa_subdomains_ctx); @@ -96,11 +93,13 @@ const char *get_flat_name_from_subdomain_name(struct be_ctx *be_ctx, return NULL; } - for (c = 0; c < ctx->num_subdoms; c++) { - if (strcasecmp(ctx->subdoms[c].name, name) == 0 || - (ctx->subdoms[c].flat_name != NULL && - strcasecmp(ctx->subdoms[c].flat_name, name) == 0)) { - return ctx->subdoms[c].flat_name; + domain = ctx->be_ctx->domain; + + for (c = 0; c < domain->subdomain_count; c++) { + if (strcasecmp(domain->subdomains[c]->name, name) == 0 || + (domain->subdomains[c]->flat_name != NULL && + strcasecmp(domain->subdomains[c]->flat_name, name) == 0)) { + return domain->subdomains[c]->flat_name; } } @@ -199,9 +198,11 @@ done: } static errno_t ipa_subdom_parse(TALLOC_CTX *memctx, + struct sss_domain_info *parent, struct sysdb_attrs *attrs, - struct sysdb_subdom *subdom) + struct sss_domain_info **_subdom) { + struct sss_domain_info *subdom = *_subdom; const char *value; int ret; @@ -210,9 +211,10 @@ static errno_t ipa_subdom_parse(TALLOC_CTX *memctx, DEBUG(SSSDBG_OP_FAILURE, ("sysdb_attrs_get_string failed.\n")); return ret; } - if (subdom->name == NULL) { - subdom->name = talloc_strdup(memctx, value); - if (subdom->name == NULL) { + + if (subdom == NULL) { + subdom = new_subdomain(memctx, parent, value, NULL, NULL, NULL); + if (subdom == NULL) { return ENOMEM; } } else if (strcmp(subdom->name, value) != 0) { @@ -223,7 +225,7 @@ static errno_t ipa_subdom_parse(TALLOC_CTX *memctx, if (subdom->realm == NULL) { /* Add Realm as upper(domain name), this is generally always correct * with AD domains */ - subdom->realm = get_uppercase_realm(memctx, subdom->name); + subdom->realm = get_uppercase_realm(subdom, subdom->name); if (!subdom->realm) { return ENOMEM; } @@ -241,12 +243,11 @@ static errno_t ipa_subdom_parse(TALLOC_CTX *memctx, if (strcmp(subdom->flat_name, value) != 0) { DEBUG(SSSDBG_TRACE_INTERNAL, ("Flat name for subdomain changed!\n")); - talloc_free(discard_const(subdom->flat_name)); - subdom->flat_name = (const char *)NULL; + talloc_zfree(subdom->flat_name); } } if (subdom->flat_name == NULL) { - subdom->flat_name = talloc_strdup(memctx, value); + subdom->flat_name = talloc_strdup(subdom, value); if (subdom->flat_name == NULL) { return ENOMEM; } @@ -260,28 +261,26 @@ static errno_t ipa_subdom_parse(TALLOC_CTX *memctx, /* in theory this may change, it should never happen, so we will log a * warning if it does, but we will allow it for now */ - if (subdom->id != NULL) { - if (strcmp(subdom->id, value) != 0) { + if (subdom->domain_id != NULL) { + if (strcmp(subdom->domain_id, value) != 0) { DEBUG(SSSDBG_TRACE_INTERNAL, ("ID for subdomain changed!\n")); - talloc_free(discard_const(subdom->id)); - subdom->flat_name = (const char *)NULL; + talloc_zfree(subdom->domain_id); } } - if (subdom->id == NULL) { - subdom->id = talloc_strdup(memctx, value); - if (subdom->id == NULL) { + if (subdom->domain_id == NULL) { + subdom->domain_id = talloc_strdup(subdom, value); + if (subdom->domain_id == NULL) { return ENOMEM; } } + *_subdom = subdom; return EOK; } static errno_t -ipa_subdomains_write_mappings(struct sss_domain_info *domain, - size_t num_subdoms, - struct sysdb_subdom *subdoms) +ipa_subdomains_write_mappings(struct sss_domain_info *domain) { errno_t ret; errno_t err; @@ -343,10 +342,12 @@ ipa_subdomains_write_mappings(struct sss_domain_info *domain, goto done; } - for (i = 0; i < num_subdoms; i++) { + for (i = 0; i < domain->subdomain_count; i++) { ret = fprintf(fstream, ".%s = %s\n%s = %s\n", - subdoms[i].name, subdoms[i].realm, - subdoms[i].name, subdoms[i].realm); + domain->subdomains[i]->name, + domain->subdomains[i]->realm, + domain->subdomains[i]->name, + domain->subdomains[i]->realm); if (ret < 0) { DEBUG(SSSDBG_CRIT_FAILURE, ("fprintf failed\n")); goto done; @@ -409,16 +410,18 @@ static errno_t ipa_subdomains_refresh(struct ipa_subdomains_ctx *ctx, int count, struct sysdb_attrs **reply, bool *changes) { + struct sss_domain_info *domain; bool handled[count]; const char *value; int c, h; int ret; int i, j; + domain = ctx->be_ctx->domain; memset(handled, 0, sizeof(bool) * count); - /* check existing subdoms in cache */ - for (i = 0, h = 0; i < ctx->num_subdoms; i++) { + /* check existing subdomains */ + for (i = 0, h = 0; i < domain->subdomain_count; i++) { for (c = 0; c < count; c++) { if (handled[c]) { continue; @@ -428,21 +431,26 @@ static errno_t ipa_subdomains_refresh(struct ipa_subdomains_ctx *ctx, DEBUG(SSSDBG_OP_FAILURE, ("sysdb_attrs_get_string failed.\n")); goto done; } - if (strcmp(value, ctx->subdoms[i].name) == 0) { + if (strcmp(value, domain->subdomains[i]->name) == 0) { break; } } if (c >= count) { /* ok this subdomain does not exist anymore, let's clean up */ - for (j = i; j < ctx->num_subdoms - 1; j++) { - ctx->subdoms[j] = ctx->subdoms[j + 1]; + for (j = i; j < domain->subdomain_count - 1; j++) { + talloc_zfree(domain->subdomains[j]); + domain->subdomains[j] = domain->subdomains[j + 1]; + } + if (i != 0) { + domain->subdomains[i - 1]->next = domain->subdomains[i]; } - ctx->num_subdoms--; + domain->subdomain_count--; i--; } else { /* ok let's try to update it */ - ret = ipa_subdom_parse(ctx->subdoms, reply[c], &ctx->subdoms[i]); + ret = ipa_subdom_parse(domain->subdomains, domain, + reply[c], &domain->subdomains[i]); if (ret) { DEBUG(SSSDBG_OP_FAILURE, ("Failed to parse subdom data\n")); goto done; @@ -463,10 +471,10 @@ static errno_t ipa_subdomains_refresh(struct ipa_subdomains_ctx *ctx, /* add space for unhandled domains */ c = count - h; - ctx->subdoms = talloc_realloc(ctx, ctx->subdoms, - struct sysdb_subdom, - ctx->num_subdoms + c); - if (ctx->subdoms == NULL) { + domain->subdomains = talloc_realloc(domain, domain->subdomains, + struct sss_domain_info *, + domain->subdomain_count + c); + if (domain->subdomains == NULL) { ret = ENOMEM; goto done; } @@ -475,14 +483,15 @@ static errno_t ipa_subdomains_refresh(struct ipa_subdomains_ctx *ctx, if (handled[c]) { continue; } - i = ctx->num_subdoms; - memset(&ctx->subdoms[i], 0, sizeof(struct sysdb_subdom)); - ret = ipa_subdom_parse(ctx->subdoms, reply[c], &ctx->subdoms[i]); + i = domain->subdomain_count; + domain->subdomains[i] = NULL; + ret = ipa_subdom_parse(domain->subdomains, domain, + reply[c], &domain->subdomains[i]); if (ret) { DEBUG(SSSDBG_OP_FAILURE, ("Failed to parse subdom data\n")); goto done; } - ctx->num_subdoms++; + domain->subdomain_count++; } ret = EOK; @@ -490,8 +499,8 @@ static errno_t ipa_subdomains_refresh(struct ipa_subdomains_ctx *ctx, done: if (ret != EOK) { ctx->last_refreshed = 0; - ctx->num_subdoms = 0; - talloc_zfree(ctx->subdoms); + domain->subdomain_count = 0; + talloc_zfree(domain->subdomains); } else { ctx->last_refreshed = time(NULL); } @@ -715,16 +724,13 @@ static void ipa_subdomains_handler_done(struct tevent_req *req) } if (refresh_has_changes) { - ret = sysdb_update_subdomains(domain, ctx->sd_ctx->num_subdoms, - ctx->sd_ctx->subdoms); + ret = sysdb_update_subdomains(domain); if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, ("sysdb_update_subdomains failed.\n")); goto done; } - ret = ipa_subdomains_write_mappings(domain, - ctx->sd_ctx->num_subdoms, - ctx->sd_ctx->subdoms); + ret = ipa_subdomains_write_mappings(domain); if (ret != EOK) { DEBUG(SSSDBG_MINOR_FAILURE, ("ipa_subdomains_write_mappings failed.\n")); diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c index 0d46fc0a..58198d50 100644 --- a/src/tests/sysdb-tests.c +++ b/src/tests/sysdb-tests.c @@ -4467,20 +4467,14 @@ START_TEST(test_sysdb_original_dn_case_insensitive) } END_TEST -struct sysdb_subdom dom1 = { "DOM1.SUB", "dom1.sub", "dom1", "S-1" }; -struct sysdb_subdom dom2 = { "DOM2.SUB", "dom2.sub", "dom2", "S-2" }; -struct sysdb_subdom dom_t = { "TEST.SUB", "test.sub", "test", "S-3" }; - START_TEST(test_sysdb_subdomain_create) { struct sysdb_test_ctx *test_ctx; errno_t ret; struct sss_domain_info **cur_subdomains = NULL; size_t cur_subdomains_count; - struct sysdb_subdom *new_subdom1 = &dom1; - struct sysdb_subdom *new_subdom2 = &dom2; - int num_subdom1 = 1; - int num_subdom2 = 1; + struct sss_domain_info *new_subdom1; + struct sss_domain_info *new_subdom2; ret = setup_sysdb_tests(&test_ctx); fail_if(ret != EOK, "Could not set up the test"); @@ -4489,10 +4483,25 @@ START_TEST(test_sysdb_subdomain_create) &cur_subdomains_count, &cur_subdomains); fail_unless(ret == EOK, "sysdb_get_subdomains failed with [%d][%s]", ret, strerror(ret)); - fail_unless(cur_subdomains != NULL, "No sub-domains returned."); + fail_unless(cur_subdomains != NULL, "Non zero sub-domains returned."); fail_unless(cur_subdomains[0] == NULL, "No empty sub-domain list returned."); - ret = sysdb_update_subdomains(test_ctx->domain, num_subdom1, new_subdom1); + test_ctx->domain->subdomains = talloc_array(test_ctx->domain, + struct sss_domain_info *, 2); + fail_unless(test_ctx->domain->subdomains != NULL, + "talloc_array_zero failed"); + + new_subdom1 = new_subdomain(test_ctx, test_ctx->domain, + "dom1.sub", "DOM1.SUB", "dom1", "S-1"); + fail_unless(new_subdom1 != NULL, "Failed to create new subdomin."); + test_ctx->domain->subdomains[0] = new_subdom1; + test_ctx->domain->subdomain_count = 1; + + ret = sysdb_subdomain_store(test_ctx->sysdb, + "dom1.sub", "DOM1.SUB", "dom1", "S-1"); + fail_if(ret != EOK, "Could not set up the test (dom1)"); + + ret = sysdb_update_subdomains(test_ctx->domain); fail_unless(ret == EOK, "sysdb_update_subdomains failed with [%d][%s]", ret, strerror(ret)); @@ -4500,13 +4509,23 @@ START_TEST(test_sysdb_subdomain_create) &cur_subdomains_count, &cur_subdomains); fail_unless(ret == EOK, "sysdb_get_subdomains failed with [%d][%s]", ret, strerror(ret)); - fail_unless(cur_subdomains != NULL, "No sub-domains returned."); - fail_unless(cur_subdomains[0] != NULL, "Empyt sub-domain list returned."); - fail_unless(strcmp(cur_subdomains[0]->name, new_subdom1[0].name) == 0, - "Unexpected sub-domain found, expected [%s], got [%s]", - new_subdom1[0].name, cur_subdomains[0]->name); - - ret = sysdb_update_subdomains(test_ctx->domain, num_subdom2, new_subdom2); + fail_if(cur_subdomains_count != 1, "Wrong number of sub-domains returned."); + fail_if(cur_subdomains[0] == NULL, "Empyt sub-domain list returned."); + fail_if(strcmp(cur_subdomains[0]->name, new_subdom1->name) != 0, + "Unexpected sub-domain found, expected [%s], got [%s]", + new_subdom1->name, cur_subdomains[0]->name); + + new_subdom2 = new_subdomain(test_ctx, test_ctx->domain, + "dom2.sub", "DOM2.SUB", "dom2", "S-2"); + fail_unless(new_subdom2 != NULL, "Failed to create new subdomin."); + test_ctx->domain->subdomains[1] = new_subdom2; + test_ctx->domain->subdomain_count = 2; + + ret = sysdb_subdomain_store(test_ctx->sysdb, + "dom2.sub", "DOM2.SUB", "dom2", "S-2"); + fail_if(ret != EOK, "Could not set up the test (dom2)"); + + ret = sysdb_update_subdomains(test_ctx->domain); fail_unless(ret == EOK, "sysdb_update_subdomains failed with [%d][%s]", ret, strerror(ret)); @@ -4514,13 +4533,16 @@ START_TEST(test_sysdb_subdomain_create) &cur_subdomains_count, &cur_subdomains); fail_unless(ret == EOK, "sysdb_get_subdomains failed with [%d][%s]", ret, strerror(ret)); - fail_unless(cur_subdomains != NULL, "No sub-domains returned."); - fail_unless(cur_subdomains[0] != NULL, "Empyt sub-domain list returned."); - fail_unless(strcmp(cur_subdomains[0]->name, new_subdom2[0].name) == 0, - "Unexpected sub-domain found, expected [%s], got [%s]", - new_subdom2[0].name, cur_subdomains[0]->name); + fail_if(cur_subdomains_count != 2, "Wrong number of sub-domains returned."); + fail_if(cur_subdomains[1] == NULL, "Empyt sub-domain list returned."); + fail_if(strcmp(cur_subdomains[1]->name, new_subdom2->name) != 0, + "Unexpected sub-domain found, expected [%s], got [%s]", + new_subdom2->name, cur_subdomains[1]->name); - ret = sysdb_update_subdomains(test_ctx->domain, 0, NULL); + test_ctx->domain->subdomain_count = 0; + talloc_zfree(test_ctx->domain->subdomains); + + ret = sysdb_update_subdomains(test_ctx->domain); fail_unless(ret == EOK, "sysdb_update_subdomains failed with [%d][%s]", ret, strerror(ret)); @@ -4529,7 +4551,7 @@ START_TEST(test_sysdb_subdomain_create) fail_unless(ret == EOK, "sysdb_get_subdomains failed with [%d][%s]", ret, strerror(ret)); fail_unless(cur_subdomains != NULL, "No sub-domains returned."); - fail_unless(cur_subdomains[0] == NULL, "No empty sub-domain list returned."); + fail_if(cur_subdomains[0] != NULL, "No empty sub-domain list returned."); } END_TEST @@ -4537,8 +4559,6 @@ START_TEST(test_sysdb_subdomain_store_user) { struct sysdb_test_ctx *test_ctx; errno_t ret; - struct sysdb_subdom *test_subdom = &dom_t; - int num_subdom = 1; struct sss_domain_info *subdomain = NULL; struct ldb_result *results = NULL; struct ldb_dn *base_dn = NULL; @@ -4547,14 +4567,16 @@ START_TEST(test_sysdb_subdomain_store_user) ret = setup_sysdb_tests(&test_ctx); fail_if(ret != EOK, "Could not set up the test"); - ret = sysdb_update_subdomains(test_ctx->domain, num_subdom, test_subdom); + subdomain = new_subdomain(test_ctx, test_ctx->domain, + "test.sub", "TEST.SUB", "test", "S-3"); + fail_unless(subdomain != NULL, "Failed to create new subdomin."); + ret = sysdb_subdomain_create(subdomain); + fail_if(ret != EOK, "Could not set up the test (test subdom)"); + + ret = sysdb_update_subdomains(test_ctx->domain); fail_unless(ret == EOK, "sysdb_update_subdomains failed with [%d][%s]", ret, strerror(ret)); - subdomain = new_subdomain(test_ctx, test_ctx->domain, "test.sub", - NULL, NULL, NULL); - fail_unless(subdomain != NULL, "new_subdomain failed."); - ret = sysdb_store_user(subdomain->sysdb, subdomain, "subdomuser", NULL, 12345, 0, "Sub Domain User", "/home/subdomuser", "/bin/bash", @@ -4594,8 +4616,6 @@ START_TEST(test_sysdb_subdomain_user_ops) { struct sysdb_test_ctx *test_ctx; errno_t ret; - struct sysdb_subdom *test_subdom = &dom_t; - int num_subdom = 1; struct sss_domain_info *subdomain = NULL; struct ldb_message *msg = NULL; struct ldb_dn *check_dn = NULL; @@ -4603,14 +4623,16 @@ START_TEST(test_sysdb_subdomain_user_ops) ret = setup_sysdb_tests(&test_ctx); fail_if(ret != EOK, "Could not set up the test"); - ret = sysdb_update_subdomains(test_ctx->domain, num_subdom, test_subdom); + subdomain = new_subdomain(test_ctx, test_ctx->domain, + "test.sub", "TEST.SUB", "test", "S-3"); + fail_unless(subdomain != NULL, "Failed to create new subdomin."); + ret = sysdb_subdomain_create(subdomain); + fail_if(ret != EOK, "Could not set up the test (test subdom)"); + + ret = sysdb_update_subdomains(test_ctx->domain); fail_unless(ret == EOK, "sysdb_update_subdomains failed with [%d][%s]", ret, strerror(ret)); - subdomain = new_subdomain(test_ctx, test_ctx->domain, "test.sub", - NULL, NULL, NULL); - fail_unless(subdomain != NULL, "new_subdomain failed."); - ret = sysdb_store_user(subdomain->sysdb, subdomain, "subdomuser", NULL, 12345, 0, "Sub Domain User", "/home/subdomuser", "/bin/bash", @@ -4646,8 +4668,6 @@ START_TEST(test_sysdb_subdomain_group_ops) { struct sysdb_test_ctx *test_ctx; errno_t ret; - struct sysdb_subdom *test_subdom = &dom_t; - int num_subdom = 1; struct sss_domain_info *subdomain = NULL; struct ldb_message *msg = NULL; struct ldb_dn *check_dn = NULL; @@ -4655,14 +4675,16 @@ START_TEST(test_sysdb_subdomain_group_ops) ret = setup_sysdb_tests(&test_ctx); fail_if(ret != EOK, "Could not set up the test"); - ret = sysdb_update_subdomains(test_ctx->domain, num_subdom, test_subdom); + subdomain = new_subdomain(test_ctx, test_ctx->domain, + "test.sub", "TEST.SUB", "test", "S-3"); + fail_unless(subdomain != NULL, "Failed to create new subdomin."); + ret = sysdb_subdomain_create(subdomain); + fail_if(ret != EOK, "Could not set up the test (test subdom)"); + + ret = sysdb_update_subdomains(test_ctx->domain); fail_unless(ret == EOK, "sysdb_update_subdomains failed with [%d][%s]", ret, strerror(ret)); - subdomain = new_subdomain(test_ctx, test_ctx->domain, "test.sub", - NULL, NULL, NULL); - fail_unless(subdomain != NULL, "new_subdomain failed."); - ret = sysdb_store_group(subdomain->sysdb, subdomain, "subdomgroup", 12345, NULL, -1, 0); fail_unless(ret == EOK, "sysdb_store_domgroup failed."); |