sssd/0016-util-Remove-the-unused-function-is_email_from_domain.patch

118 lines
4.5 KiB
Diff
Raw Normal View History

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