|
|
ca1eb8 |
From 5651a893f7dddb13fa9edc94e96d7bc95ec13f8b Mon Sep 17 00:00:00 2001
|
|
|
ca1eb8 |
From: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
ca1eb8 |
Date: Thu, 21 Jun 2018 12:40:44 +0200
|
|
|
ca1eb8 |
Subject: [PATCH] util: Remove the unused function is_email_from_domain
|
|
|
ca1eb8 |
MIME-Version: 1.0
|
|
|
ca1eb8 |
Content-Type: text/plain; charset=UTF-8
|
|
|
ca1eb8 |
Content-Transfer-Encoding: 8bit
|
|
|
ca1eb8 |
|
|
|
ca1eb8 |
This commit pretty much reverts commit
|
|
|
ca1eb8 |
04d4c4d45f3942a813b7f772737f801f877f4e64, it's just coded manually,
|
|
|
ca1eb8 |
because "git revert 04d4c4d45f3942a813b7f772737f801f877f4e64"
|
|
|
ca1eb8 |
resulted in conflicts. It's easier to just remove the single
|
|
|
ca1eb8 |
function.
|
|
|
ca1eb8 |
|
|
|
ca1eb8 |
Related:
|
|
|
ca1eb8 |
https://pagure.io/SSSD/sssd/issue/3607
|
|
|
ca1eb8 |
|
|
|
ca1eb8 |
Reviewed-by: Fabiano FidĂȘncio <fidencio@redhat.com>
|
|
|
ca1eb8 |
(cherry picked from commit 58f60a0949f5d84b1fe5d15e52adfceb84053569)
|
|
|
ca1eb8 |
---
|
|
|
ca1eb8 |
src/tests/cmocka/test_utils.c | 21 ---------------------
|
|
|
ca1eb8 |
src/util/domain_info_utils.c | 27 ---------------------------
|
|
|
ca1eb8 |
src/util/util.h | 1 -
|
|
|
ca1eb8 |
3 files changed, 49 deletions(-)
|
|
|
ca1eb8 |
|
|
|
ca1eb8 |
diff --git a/src/tests/cmocka/test_utils.c b/src/tests/cmocka/test_utils.c
|
|
|
ca1eb8 |
index cf314abe2db4056fe92c167454a4ddc31be98a51..1a8699a2a87d57ab43c70ceebf9bc71da4def4d4 100644
|
|
|
ca1eb8 |
--- a/src/tests/cmocka/test_utils.c
|
|
|
ca1eb8 |
+++ b/src/tests/cmocka/test_utils.c
|
|
|
ca1eb8 |
@@ -1849,25 +1849,6 @@ static void test_sss_get_domain_mappings_content(void **state)
|
|
|
ca1eb8 |
* capaths might not be as expected. */
|
|
|
ca1eb8 |
}
|
|
|
ca1eb8 |
|
|
|
ca1eb8 |
-static void test_is_email_from_domain(void **state)
|
|
|
ca1eb8 |
-{
|
|
|
ca1eb8 |
- struct dom_list_test_ctx *test_ctx = talloc_get_type(*state,
|
|
|
ca1eb8 |
- struct dom_list_test_ctx);
|
|
|
ca1eb8 |
- struct sss_domain_info *d;
|
|
|
ca1eb8 |
-
|
|
|
ca1eb8 |
- d = find_domain_by_name(test_ctx->dom_list, "name_0.dom", false);
|
|
|
ca1eb8 |
- assert_non_null(d);
|
|
|
ca1eb8 |
-
|
|
|
ca1eb8 |
- assert_false(is_email_from_domain(NULL, NULL));
|
|
|
ca1eb8 |
- assert_false(is_email_from_domain("hello", NULL));
|
|
|
ca1eb8 |
- assert_false(is_email_from_domain(NULL, d));
|
|
|
ca1eb8 |
- assert_false(is_email_from_domain("hello", d));
|
|
|
ca1eb8 |
- assert_false(is_email_from_domain("hello@hello", d));
|
|
|
ca1eb8 |
-
|
|
|
ca1eb8 |
- assert_true(is_email_from_domain("hello@name_0.dom", d));
|
|
|
ca1eb8 |
- assert_true(is_email_from_domain("hello@NaMe_0.DoM", d));
|
|
|
ca1eb8 |
-}
|
|
|
ca1eb8 |
-
|
|
|
ca1eb8 |
int main(int argc, const char *argv[])
|
|
|
ca1eb8 |
{
|
|
|
ca1eb8 |
poptContext pc;
|
|
|
ca1eb8 |
@@ -1896,8 +1877,6 @@ int main(int argc, const char *argv[])
|
|
|
ca1eb8 |
setup_dom_list, teardown_dom_list),
|
|
|
ca1eb8 |
cmocka_unit_test_setup_teardown(test_find_domain_by_name_disabled,
|
|
|
ca1eb8 |
setup_dom_list, teardown_dom_list),
|
|
|
ca1eb8 |
- cmocka_unit_test_setup_teardown(test_is_email_from_domain,
|
|
|
ca1eb8 |
- setup_dom_list, teardown_dom_list),
|
|
|
ca1eb8 |
|
|
|
ca1eb8 |
cmocka_unit_test_setup_teardown(test_sss_names_init,
|
|
|
ca1eb8 |
confdb_test_setup,
|
|
|
ca1eb8 |
diff --git a/src/util/domain_info_utils.c b/src/util/domain_info_utils.c
|
|
|
ca1eb8 |
index 66077092a40111967a98b0937506d9e4472f50d5..9d608ef2079cadbf3c66187e3bb8c81d2d7b4604 100644
|
|
|
ca1eb8 |
--- a/src/util/domain_info_utils.c
|
|
|
ca1eb8 |
+++ b/src/util/domain_info_utils.c
|
|
|
ca1eb8 |
@@ -889,33 +889,6 @@ bool sss_domain_is_forest_root(struct sss_domain_info *dom)
|
|
|
ca1eb8 |
return (dom->forest_root == dom);
|
|
|
ca1eb8 |
}
|
|
|
ca1eb8 |
|
|
|
ca1eb8 |
-bool is_email_from_domain(const char *email, struct sss_domain_info *dom)
|
|
|
ca1eb8 |
-{
|
|
|
ca1eb8 |
- const char *p;
|
|
|
ca1eb8 |
-
|
|
|
ca1eb8 |
- if (email == NULL || dom == NULL) {
|
|
|
ca1eb8 |
- return false;
|
|
|
ca1eb8 |
- }
|
|
|
ca1eb8 |
-
|
|
|
ca1eb8 |
- p = strchr(email, '@');
|
|
|
ca1eb8 |
- if (p == NULL) {
|
|
|
ca1eb8 |
- DEBUG(SSSDBG_TRACE_ALL,
|
|
|
ca1eb8 |
- "Input [%s] does not look like an email address.\n", email);
|
|
|
ca1eb8 |
- return false;
|
|
|
ca1eb8 |
- }
|
|
|
ca1eb8 |
-
|
|
|
ca1eb8 |
- if (strcasecmp(p+1, dom->name) == 0) {
|
|
|
ca1eb8 |
- DEBUG(SSSDBG_TRACE_ALL, "Email [%s] is from domain [%s].\n", email,
|
|
|
ca1eb8 |
- dom->name);
|
|
|
ca1eb8 |
- return true;
|
|
|
ca1eb8 |
- }
|
|
|
ca1eb8 |
-
|
|
|
ca1eb8 |
- DEBUG(SSSDBG_TRACE_ALL, "Email [%s] is not from domain [%s].\n", email,
|
|
|
ca1eb8 |
- dom->name);
|
|
|
ca1eb8 |
-
|
|
|
ca1eb8 |
- return false;
|
|
|
ca1eb8 |
-}
|
|
|
ca1eb8 |
-
|
|
|
ca1eb8 |
char *subdomain_create_conf_path(TALLOC_CTX *mem_ctx,
|
|
|
ca1eb8 |
struct sss_domain_info *subdomain)
|
|
|
ca1eb8 |
{
|
|
|
ca1eb8 |
diff --git a/src/util/util.h b/src/util/util.h
|
|
|
ca1eb8 |
index 4657ab0c691e3e0442f340b94ae149e9d6602bb5..2785ac2e285cfb4dd6a309fe5d73dd755e07b8ad 100644
|
|
|
ca1eb8 |
--- a/src/util/util.h
|
|
|
ca1eb8 |
+++ b/src/util/util.h
|
|
|
ca1eb8 |
@@ -539,7 +539,6 @@ struct sss_domain_info *find_domain_by_sid(struct sss_domain_info *domain,
|
|
|
ca1eb8 |
enum sss_domain_state sss_domain_get_state(struct sss_domain_info *dom);
|
|
|
ca1eb8 |
void sss_domain_set_state(struct sss_domain_info *dom,
|
|
|
ca1eb8 |
enum sss_domain_state state);
|
|
|
ca1eb8 |
-bool is_email_from_domain(const char *email, struct sss_domain_info *dom);
|
|
|
ca1eb8 |
bool sss_domain_is_forest_root(struct sss_domain_info *dom);
|
|
|
ca1eb8 |
const char *sss_domain_type_str(struct sss_domain_info *dom);
|
|
|
ca1eb8 |
|
|
|
ca1eb8 |
--
|
|
|
ca1eb8 |
2.17.1
|
|
|
ca1eb8 |
|