Blame SOURCES/0016-util-Remove-the-unused-function-is_email_from_domain.patch

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