sssd/0016-util-Remove-the-unused-function-is_email_from_domain.patch
Fabiano Fidêncio 68ef824a5f Resolves: upstream#3766 - CVE-2018-10852: information leak from the sssd-sudo responder
And also ...

- Related: upstream#941 - return multiple server addresses to the Kerberos
                          locator plugin
- Related: upstream#3652 - kdcinfo doesn't get populated for other domains
- Resolves: upstream#3747 - sss_ssh_authorizedkeys exits abruptly if SSHD
                            closes its end of the pipe before reading all the
                            SSH keys
- Resolves: upstream#3607 - Handle conflicting e-mail addresses more gracefully
- Resolves: upstream#3754 - SSSD AD uses LDAP filter to detect POSIX attributes
                            stored in AD GC also for regular AD DC queries
- Related: upstream#3219 - [RFE] Regular expression used in sssd.conf not being
                           able to consume an @-sign in the user/group name.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2018-06-25 09:38:16 +02:00

118 lines
4.5 KiB
Diff

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