summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPavel Reichl <preichl@redhat.com>2014-07-21 08:06:23 +0100
committerJakub Hrozek <jhrozek@redhat.com>2014-07-22 09:40:08 +0200
commitdb18dda869bc6c52a41797b2066cf121cf10f49c (patch)
tree7bdfa5d0ee9ce1d135202e1f87d63f95aafe0c6b /src
parent9ca0071db0e226e4e65b2a80fdeddd5048ca8990 (diff)
downloadsssd-db18dda869bc6c52a41797b2066cf121cf10f49c.tar.gz
sssd-db18dda869bc6c52a41797b2066cf121cf10f49c.tar.xz
sssd-db18dda869bc6c52a41797b2066cf121cf10f49c.zip
UTIL: rename find_subdomain_by_name
The function was named "find_subdomain" yet it could find both main domain and subdomain. sed 's/find_subdomain_by_name/find_domain_by_name/' -i `find . -name "*.[ch]"` Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/providers/ad/ad_access.c4
-rw-r--r--src/providers/ad/ad_id.c2
-rw-r--r--src/providers/ad/ad_subdomains.c4
-rw-r--r--src/providers/data_provider_be.c2
-rw-r--r--src/providers/ipa/ipa_access.c2
-rw-r--r--src/providers/ipa/ipa_hbac_common.c4
-rw-r--r--src/providers/ipa/ipa_idmap.c6
-rw-r--r--src/providers/ipa/ipa_selinux.c4
-rw-r--r--src/providers/ipa/ipa_subdomains.c2
-rw-r--r--src/providers/ipa/ipa_subdomains_id.c10
-rw-r--r--src/providers/krb5/krb5_utils.c4
-rw-r--r--src/providers/ldap/ldap_access.c2
-rw-r--r--src/tests/cmocka/test_utils.c46
-rw-r--r--src/util/domain_info_utils.c8
-rw-r--r--src/util/usertools.c2
-rw-r--r--src/util/util.h6
16 files changed, 54 insertions, 54 deletions
diff --git a/src/providers/ad/ad_access.c b/src/providers/ad/ad_access.c
index 06ad47417..74077ec10 100644
--- a/src/providers/ad/ad_access.c
+++ b/src/providers/ad/ad_access.c
@@ -456,9 +456,9 @@ ad_access_handler(struct be_req *breq)
/* Handle subdomains */
if (strcasecmp(pd->domain, be_ctx->domain->name) != 0) {
- domain = find_subdomain_by_name(be_ctx->domain, pd->domain, true);
+ domain = find_domain_by_name(be_ctx->domain, pd->domain, true);
if (domain == NULL) {
- DEBUG(SSSDBG_OP_FAILURE, "find_subdomain_by_name failed.\n");
+ DEBUG(SSSDBG_OP_FAILURE, "find_domain_by_name failed.\n");
be_req_terminate(breq, DP_ERR_FATAL, PAM_SYSTEM_ERR, NULL);
return;
}
diff --git a/src/providers/ad/ad_id.c b/src/providers/ad/ad_id.c
index 2e53a685f..ddb108370 100644
--- a/src/providers/ad/ad_id.c
+++ b/src/providers/ad/ad_id.c
@@ -360,7 +360,7 @@ ad_account_info_handler(struct be_req *be_req)
dom = be_ctx->domain;
if (strcasecmp(ar->domain, be_ctx->domain->name) != 0) {
/* Subdomain request, verify subdomain */
- dom = find_subdomain_by_name(be_ctx->domain, ar->domain, true);
+ dom = find_domain_by_name(be_ctx->domain, ar->domain, true);
}
if (dom == NULL) {
diff --git a/src/providers/ad/ad_subdomains.c b/src/providers/ad/ad_subdomains.c
index efe4b3fe1..f7574d05d 100644
--- a/src/providers/ad/ad_subdomains.c
+++ b/src/providers/ad/ad_subdomains.c
@@ -799,8 +799,8 @@ static struct ad_id_ctx *ads_get_root_id_ctx(struct ad_subdomains_req_ctx *ctx)
}
/* With a subsequent run, the root should already be known */
- root = find_subdomain_by_name(ctx->sd_ctx->be_ctx->domain,
- name, false);
+ root = find_domain_by_name(ctx->sd_ctx->be_ctx->domain,
+ name, false);
if (root == NULL) {
DEBUG(SSSDBG_OP_FAILURE, "Could not find the root domain\n");
return NULL;
diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c
index dbd48b20d..f3432492d 100644
--- a/src/providers/data_provider_be.c
+++ b/src/providers/data_provider_be.c
@@ -161,7 +161,7 @@ static errno_t be_req_set_domain(struct be_req *be_req, const char *domain)
{
struct sss_domain_info *dom = NULL;
- dom = find_subdomain_by_name(be_req->be_ctx->domain, domain, true);
+ dom = find_domain_by_name(be_req->be_ctx->domain, domain, true);
if (dom == NULL) {
DEBUG(SSSDBG_CRIT_FAILURE, "Unknown domain [%s]!\n", domain);
return ERR_DOMAIN_NOT_FOUND;
diff --git a/src/providers/ipa/ipa_access.c b/src/providers/ipa/ipa_access.c
index bb8e45cf9..ed52132ad 100644
--- a/src/providers/ipa/ipa_access.c
+++ b/src/providers/ipa/ipa_access.c
@@ -89,7 +89,7 @@ void ipa_access_handler(struct be_req *be_req)
dom = be_ctx->domain;
if (strcasecmp(pd->domain, be_ctx->domain->name) != 0) {
/* Subdomain request, verify subdomain */
- dom = find_subdomain_by_name(be_ctx->domain, pd->domain, true);
+ dom = find_domain_by_name(be_ctx->domain, pd->domain, true);
}
/* First, verify that this account isn't locked.
diff --git a/src/providers/ipa/ipa_hbac_common.c b/src/providers/ipa/ipa_hbac_common.c
index 317be9944..7d68aa512 100644
--- a/src/providers/ipa/ipa_hbac_common.c
+++ b/src/providers/ipa/ipa_hbac_common.c
@@ -449,9 +449,9 @@ hbac_ctx_to_eval_request(TALLOC_CTX *mem_ctx,
/* Get user the user name and groups,
* take care of subdomain users as well */
if (strcasecmp(pd->domain, domain->name) != 0) {
- user_dom = find_subdomain_by_name(domain, pd->domain, true);
+ user_dom = find_domain_by_name(domain, pd->domain, true);
if (user_dom == NULL) {
- DEBUG(SSSDBG_OP_FAILURE, "find_subdomain_by_name failed.\n");
+ DEBUG(SSSDBG_OP_FAILURE, "find_domain_by_name failed.\n");
ret = ENOMEM;
goto done;
}
diff --git a/src/providers/ipa/ipa_idmap.c b/src/providers/ipa/ipa_idmap.c
index 7e4f985f3..4e6831082 100644
--- a/src/providers/ipa/ipa_idmap.c
+++ b/src/providers/ipa/ipa_idmap.c
@@ -84,11 +84,11 @@ static errno_t ipa_idmap_check_posix_child(struct sdap_idmap_ctx *idmap_ctx,
return EINVAL;
}
- forest_root = find_subdomain_by_name(idmap_ctx->id_ctx->be->domain,
- dom->forest, true);
+ forest_root = find_domain_by_name(idmap_ctx->id_ctx->be->domain,
+ dom->forest, true);
if (forest_root == NULL) {
DEBUG(SSSDBG_OP_FAILURE,
- "find_subdomain_by_name failed to find forest root [%s].\n",
+ "find_domain_by_name failed to find forest root [%s].\n",
dom->forest);
return ENOENT;
}
diff --git a/src/providers/ipa/ipa_selinux.c b/src/providers/ipa/ipa_selinux.c
index 927e5456f..6cb014e43 100644
--- a/src/providers/ipa/ipa_selinux.c
+++ b/src/providers/ipa/ipa_selinux.c
@@ -119,8 +119,8 @@ void ipa_selinux_handler(struct be_req *be_req)
pd->domain);
goto fail;
} else {
- user_domain = find_subdomain_by_name(subdom_be_ctx->domain,
- pd->domain, true);
+ user_domain = find_domain_by_name(subdom_be_ctx->domain,
+ pd->domain, true);
if (user_domain == NULL) {
DEBUG(SSSDBG_MINOR_FAILURE, "No domain entry found " \
"for [%s].\n", pd->domain);
diff --git a/src/providers/ipa/ipa_subdomains.c b/src/providers/ipa/ipa_subdomains.c
index 7103ba28a..524504846 100644
--- a/src/providers/ipa/ipa_subdomains.c
+++ b/src/providers/ipa/ipa_subdomains.c
@@ -342,7 +342,7 @@ const char *get_flat_name_from_subdomain_name(struct be_ctx *be_ctx,
return NULL;
}
- dom = find_subdomain_by_name(ctx->be_ctx->domain, name, true);
+ dom = find_domain_by_name(ctx->be_ctx->domain, name, true);
if (dom) {
return dom->flat_name;
}
diff --git a/src/providers/ipa/ipa_subdomains_id.c b/src/providers/ipa/ipa_subdomains_id.c
index 1c4c315a7..113bc6c06 100644
--- a/src/providers/ipa/ipa_subdomains_id.c
+++ b/src/providers/ipa/ipa_subdomains_id.c
@@ -75,10 +75,10 @@ struct tevent_req *ipa_get_subdom_acct_send(TALLOC_CTX *memctx,
goto fail;
}
- state->domain = find_subdomain_by_name(state->ctx->be->domain,
- ar->domain, true);
+ state->domain = find_domain_by_name(state->ctx->be->domain,
+ ar->domain, true);
if (state->domain == NULL) {
- DEBUG(SSSDBG_OP_FAILURE, "find_subdomain_by_name failed.\n");
+ DEBUG(SSSDBG_OP_FAILURE, "find_domain_by_name failed.\n");
ret = ENOMEM;
goto fail;
}
@@ -289,8 +289,8 @@ ipa_get_ad_acct_send(TALLOC_CTX *mem_ctx,
state->ar = ar;
/* This can only be a subdomain request, verify subdomain */
- state->user_dom = find_subdomain_by_name(ipa_ctx->sdap_id_ctx->be->domain,
- ar->domain, true);
+ state->user_dom = find_domain_by_name(ipa_ctx->sdap_id_ctx->be->domain,
+ ar->domain, true);
if (state->user_dom == NULL) {
ret = EINVAL;
goto fail;
diff --git a/src/providers/krb5/krb5_utils.c b/src/providers/krb5/krb5_utils.c
index 0734310ca..0d2e28119 100644
--- a/src/providers/krb5/krb5_utils.c
+++ b/src/providers/krb5/krb5_utils.c
@@ -1094,9 +1094,9 @@ errno_t get_domain_or_subdomain(struct be_ctx *be_ctx,
if (domain_name != NULL &&
strcasecmp(domain_name, be_ctx->domain->name) != 0) {
- *dom = find_subdomain_by_name(be_ctx->domain, domain_name, true);
+ *dom = find_domain_by_name(be_ctx->domain, domain_name, true);
if (*dom == NULL) {
- DEBUG(SSSDBG_OP_FAILURE, "find_subdomain_by_name failed.\n");
+ DEBUG(SSSDBG_OP_FAILURE, "find_domain_by_name failed.\n");
return ENOMEM;
}
} else {
diff --git a/src/providers/ldap/ldap_access.c b/src/providers/ldap/ldap_access.c
index 05354d10c..1913cd9a9 100644
--- a/src/providers/ldap/ldap_access.c
+++ b/src/providers/ldap/ldap_access.c
@@ -61,7 +61,7 @@ void sdap_pam_access_handler(struct be_req *breq)
dom = be_ctx->domain;
if (strcasecmp(pd->domain, be_ctx->domain->name) != 0) {
/* Subdomain request, verify subdomain */
- dom = find_subdomain_by_name(be_ctx->domain, pd->domain, true);
+ dom = find_domain_by_name(be_ctx->domain, pd->domain, true);
}
req = sdap_access_send(breq, be_ctx->ev, be_ctx,
diff --git a/src/tests/cmocka/test_utils.c b/src/tests/cmocka/test_utils.c
index 59b6e08ba..2254c0a7c 100644
--- a/src/tests/cmocka/test_utils.c
+++ b/src/tests/cmocka/test_utils.c
@@ -101,23 +101,23 @@ void teardown_dom_list(void **state)
assert_true(leak_check_teardown());
}
-void test_find_subdomain_by_name_null(void **state)
+void test_find_domain_by_name_null(void **state)
{
struct dom_list_test_ctx *test_ctx = talloc_get_type(*state,
struct dom_list_test_ctx);
struct sss_domain_info *dom;
- dom = find_subdomain_by_name(NULL, NULL, false);
+ dom = find_domain_by_name(NULL, NULL, false);
assert_null(dom);
- dom = find_subdomain_by_name(test_ctx->dom_list, NULL, false);
+ dom = find_domain_by_name(test_ctx->dom_list, NULL, false);
assert_null(dom);
- dom = find_subdomain_by_name(NULL, "test", false);
+ dom = find_domain_by_name(NULL, "test", false);
assert_null(dom);
}
-void test_find_subdomain_by_name(void **state)
+void test_find_domain_by_name(void **state)
{
struct dom_list_test_ctx *test_ctx = talloc_get_type(*state,
struct dom_list_test_ctx);
@@ -137,25 +137,25 @@ void test_find_subdomain_by_name(void **state)
sid = talloc_asprintf(global_talloc_context, SID_TMPL, c);
assert_non_null(sid);
- dom = find_subdomain_by_name(test_ctx->dom_list, name, false);
+ dom = find_domain_by_name(test_ctx->dom_list, name, false);
assert_non_null(dom);
assert_string_equal(name, dom->name);
assert_string_equal(flat_name, dom->flat_name);
assert_string_equal(sid, dom->domain_id);
- dom = find_subdomain_by_name(test_ctx->dom_list, name, true);
+ dom = find_domain_by_name(test_ctx->dom_list, name, true);
assert_non_null(dom);
assert_string_equal(name, dom->name);
assert_string_equal(flat_name, dom->flat_name);
assert_string_equal(sid, dom->domain_id);
- dom = find_subdomain_by_name(test_ctx->dom_list, flat_name, true);
+ dom = find_domain_by_name(test_ctx->dom_list, flat_name, true);
assert_non_null(dom);
assert_string_equal(name, dom->name);
assert_string_equal(flat_name, dom->flat_name);
assert_string_equal(sid, dom->domain_id);
- dom = find_subdomain_by_name(test_ctx->dom_list, flat_name, false);
+ dom = find_domain_by_name(test_ctx->dom_list, flat_name, false);
assert_null(dom);
talloc_free(name);
@@ -164,7 +164,7 @@ void test_find_subdomain_by_name(void **state)
}
}
-void test_find_subdomain_by_name_missing_flat_name(void **state)
+void test_find_domain_by_name_missing_flat_name(void **state)
{
struct dom_list_test_ctx *test_ctx = talloc_get_type(*state,
struct dom_list_test_ctx);
@@ -196,7 +196,7 @@ void test_find_subdomain_by_name_missing_flat_name(void **state)
sid = talloc_asprintf(global_talloc_context, SID_TMPL, c);
assert_non_null(sid);
- dom = find_subdomain_by_name(test_ctx->dom_list, name, true);
+ dom = find_domain_by_name(test_ctx->dom_list, name, true);
assert_non_null(dom);
assert_string_equal(name, dom->name);
if (c == mis - 1) {
@@ -206,7 +206,7 @@ void test_find_subdomain_by_name_missing_flat_name(void **state)
}
assert_string_equal(sid, dom->domain_id);
- dom = find_subdomain_by_name(test_ctx->dom_list, name, false);
+ dom = find_domain_by_name(test_ctx->dom_list, name, false);
assert_non_null(dom);
assert_string_equal(name, dom->name);
if (c == mis - 1) {
@@ -216,7 +216,7 @@ void test_find_subdomain_by_name_missing_flat_name(void **state)
}
assert_string_equal(sid, dom->domain_id);
- dom = find_subdomain_by_name(test_ctx->dom_list, flat_name, true);
+ dom = find_domain_by_name(test_ctx->dom_list, flat_name, true);
if (c == mis - 1) {
assert_null(dom);
} else {
@@ -226,7 +226,7 @@ void test_find_subdomain_by_name_missing_flat_name(void **state)
assert_string_equal(sid, dom->domain_id);
}
- dom = find_subdomain_by_name(test_ctx->dom_list, flat_name, false);
+ dom = find_domain_by_name(test_ctx->dom_list, flat_name, false);
assert_null(dom);
talloc_free(name);
@@ -235,7 +235,7 @@ void test_find_subdomain_by_name_missing_flat_name(void **state)
}
}
-void test_find_subdomain_by_name_disabled(void **state)
+void test_find_domain_by_name_disabled(void **state)
{
struct dom_list_test_ctx *test_ctx = talloc_get_type(*state,
struct dom_list_test_ctx);
@@ -267,7 +267,7 @@ void test_find_subdomain_by_name_disabled(void **state)
sid = talloc_asprintf(global_talloc_context, SID_TMPL, c);
assert_non_null(sid);
- dom = find_subdomain_by_name(test_ctx->dom_list, name, true);
+ dom = find_domain_by_name(test_ctx->dom_list, name, true);
if (c == mis - 1) {
assert_null(dom);
} else {
@@ -277,7 +277,7 @@ void test_find_subdomain_by_name_disabled(void **state)
assert_string_equal(sid, dom->domain_id);
}
- dom = find_subdomain_by_name(test_ctx->dom_list, name, false);
+ dom = find_domain_by_name(test_ctx->dom_list, name, false);
if (c == mis - 1) {
assert_null(dom);
} else {
@@ -287,7 +287,7 @@ void test_find_subdomain_by_name_disabled(void **state)
assert_string_equal(sid, dom->domain_id);
}
- dom = find_subdomain_by_name(test_ctx->dom_list, flat_name, true);
+ dom = find_domain_by_name(test_ctx->dom_list, flat_name, true);
if (c == mis - 1) {
assert_null(dom);
} else {
@@ -297,7 +297,7 @@ void test_find_subdomain_by_name_disabled(void **state)
assert_string_equal(sid, dom->domain_id);
}
- dom = find_subdomain_by_name(test_ctx->dom_list, flat_name, false);
+ dom = find_domain_by_name(test_ctx->dom_list, flat_name, false);
assert_null(dom);
talloc_free(name);
@@ -895,13 +895,13 @@ int main(int argc, const char *argv[])
setup_dom_list, teardown_dom_list),
unit_test_setup_teardown(test_find_domain_by_sid_disabled,
setup_dom_list, teardown_dom_list),
- unit_test_setup_teardown(test_find_subdomain_by_name_null,
+ unit_test_setup_teardown(test_find_domain_by_name_null,
setup_dom_list, teardown_dom_list),
- unit_test_setup_teardown(test_find_subdomain_by_name,
+ unit_test_setup_teardown(test_find_domain_by_name,
setup_dom_list, teardown_dom_list),
- unit_test_setup_teardown(test_find_subdomain_by_name_missing_flat_name,
+ unit_test_setup_teardown(test_find_domain_by_name_missing_flat_name,
setup_dom_list, teardown_dom_list),
- unit_test_setup_teardown(test_find_subdomain_by_name_disabled,
+ unit_test_setup_teardown(test_find_domain_by_name_disabled,
setup_dom_list, teardown_dom_list),
unit_test_setup_teardown(test_sss_names_init,
diff --git a/src/util/domain_info_utils.c b/src/util/domain_info_utils.c
index 83f3baa62..b449591a5 100644
--- a/src/util/domain_info_utils.c
+++ b/src/util/domain_info_utils.c
@@ -87,9 +87,9 @@ bool subdomain_enumerates(struct sss_domain_info *parent,
return false;
}
-struct sss_domain_info *find_subdomain_by_name(struct sss_domain_info *domain,
- const char *name,
- bool match_any)
+struct sss_domain_info *find_domain_by_name(struct sss_domain_info *domain,
+ const char *name,
+ bool match_any)
{
struct sss_domain_info *dom = domain;
@@ -193,7 +193,7 @@ find_subdomain_by_object_name(struct sss_domain_info *domain,
if (domainname == NULL) {
dom = domain;
} else {
- dom = find_subdomain_by_name(domain, domainname, true);
+ dom = find_domain_by_name(domain, domainname, true);
}
done:
diff --git a/src/util/usertools.c b/src/util/usertools.c
index 57945c7f1..06384b849 100644
--- a/src/util/usertools.c
+++ b/src/util/usertools.c
@@ -399,7 +399,7 @@ static struct sss_domain_info * match_any_domain_or_subdomain_name(
return dom;
}
- return find_subdomain_by_name(dom, dmatch, true);
+ return find_domain_by_name(dom, dmatch, true);
}
int sss_parse_name_for_domains(TALLOC_CTX *memctx,
diff --git a/src/util/util.h b/src/util/util.h
index 3cf1bc0a0..ee84735c5 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -511,9 +511,9 @@ struct sss_domain_info *get_domains_head(struct sss_domain_info *domain);
struct sss_domain_info *get_next_domain(struct sss_domain_info *domain,
bool descend);
-struct sss_domain_info *find_subdomain_by_name(struct sss_domain_info *domain,
- const char *name,
- bool match_any);
+struct sss_domain_info *find_domain_by_name(struct sss_domain_info *domain,
+ const char *name,
+ bool match_any);
struct sss_domain_info *find_domain_by_sid(struct sss_domain_info *domain,
const char *sid);