dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0015-Revert-LDAP-IPA-add-local-email-address-to-aliases.patch

ca1eb8
From 9efaade255e59b4a2f5cff2ab78c1db61132a40a Mon Sep 17 00:00:00 2001
ca1eb8
From: Jakub Hrozek <jhrozek@redhat.com>
ca1eb8
Date: Thu, 21 Jun 2018 12:27:32 +0200
ca1eb8
Subject: [PATCH] Revert "LDAP/IPA: add local email address to aliases"
ca1eb8
MIME-Version: 1.0
ca1eb8
Content-Type: text/plain; charset=UTF-8
ca1eb8
Content-Transfer-Encoding: 8bit
ca1eb8
ca1eb8
This reverts commit 9a310913d696d190db14c625080678db853a33fd.
ca1eb8
ca1eb8
Storing the e-mail address as a nameAlias was a performance optimization
ca1eb8
to avoid having to fall back to the UPN lookup, but had the disadvantage
ca1eb8
of returning multiple results for cases where an e-mail address is the
ca1eb8
same as a user's fully qualified name.
ca1eb8
ca1eb8
Since the e-mail lookups would still work without this optimization,
ca1eb8
just after one more lookup, let's revert the patch.
ca1eb8
ca1eb8
Resolves:
ca1eb8
https://pagure.io/SSSD/sssd/issue/3607
ca1eb8
ca1eb8
Reviewed-by: Fabiano FidĂȘncio <fidencio@redhat.com>
ca1eb8
(cherry picked from commit b0ec3875da281a9c29eda2cb19c1026510866d5b)
ca1eb8
ca1eb8
DOWNSTREAM:
ca1eb8
Resolves: rhbz#1527662 - Handle conflicting e-mail addresses more gracefully
ca1eb8
---
ca1eb8
 src/providers/ipa/ipa_s2n_exop.c | 49 --------------------------------
ca1eb8
 src/providers/ldap/sdap_utils.c  | 22 --------------
ca1eb8
 2 files changed, 71 deletions(-)
ca1eb8
ca1eb8
diff --git a/src/providers/ipa/ipa_s2n_exop.c b/src/providers/ipa/ipa_s2n_exop.c
ca1eb8
index 9cb735526293ff5a209d732366b86fdb95dc8679..6f3974637a08b9d70e32fb6d79724be4f6e8dbde 100644
ca1eb8
--- a/src/providers/ipa/ipa_s2n_exop.c
ca1eb8
+++ b/src/providers/ipa/ipa_s2n_exop.c
ca1eb8
@@ -2118,49 +2118,6 @@ done:
ca1eb8
     return ret;
ca1eb8
 }
ca1eb8
 
ca1eb8
-static errno_t add_emails_to_aliases(struct sysdb_attrs *attrs,
ca1eb8
-                                     struct sss_domain_info *dom)
ca1eb8
-{
ca1eb8
-    int ret;
ca1eb8
-    const char **emails;
ca1eb8
-    size_t c;
ca1eb8
-    TALLOC_CTX *tmp_ctx;
ca1eb8
-
ca1eb8
-    tmp_ctx = talloc_new(NULL);
ca1eb8
-    if (tmp_ctx == NULL) {
ca1eb8
-        DEBUG(SSSDBG_OP_FAILURE, "talloc_new failed.\n");
ca1eb8
-        return ENOMEM;
ca1eb8
-    }
ca1eb8
-
ca1eb8
-    ret = sysdb_attrs_get_string_array(attrs, SYSDB_USER_EMAIL, tmp_ctx,
ca1eb8
-                                       &emails);
ca1eb8
-    if (ret == EOK) {
ca1eb8
-        for (c = 0; emails[c] != NULL; c++) {
ca1eb8
-            if (is_email_from_domain(emails[c], dom)) {
ca1eb8
-                ret = sysdb_attrs_add_lc_name_alias_safe(attrs, emails[c]);
ca1eb8
-                if (ret != EOK) {
ca1eb8
-                    DEBUG(SSSDBG_OP_FAILURE,
ca1eb8
-                          "Failed to add lower-cased version of email [%s] "
ca1eb8
-                          "into the alias list\n", emails[c]);
ca1eb8
-                    goto done;
ca1eb8
-                }
ca1eb8
-            }
ca1eb8
-        }
ca1eb8
-    } else if (ret == ENOENT) {
ca1eb8
-        DEBUG(SSSDBG_TRACE_ALL, "No email addresses available.\n");
ca1eb8
-    } else {
ca1eb8
-        DEBUG(SSSDBG_OP_FAILURE,
ca1eb8
-              "sysdb_attrs_get_string_array failed, skipping ...\n");
ca1eb8
-    }
ca1eb8
-
ca1eb8
-    ret = EOK;
ca1eb8
-
ca1eb8
-done:
ca1eb8
-    talloc_free(tmp_ctx);
ca1eb8
-
ca1eb8
-    return ret;
ca1eb8
-}
ca1eb8
-
ca1eb8
 static errno_t ipa_s2n_save_objects(struct sss_domain_info *dom,
ca1eb8
                                     struct req_input *req_input,
ca1eb8
                                     struct resp_attrs *attrs,
ca1eb8
@@ -2314,12 +2271,6 @@ static errno_t ipa_s2n_save_objects(struct sss_domain_info *dom,
ca1eb8
                 goto done;
ca1eb8
             }
ca1eb8
 
ca1eb8
-            ret = add_emails_to_aliases(attrs->sysdb_attrs, dom);
ca1eb8
-            if (ret != EOK) {
ca1eb8
-                DEBUG(SSSDBG_OP_FAILURE,
ca1eb8
-                      "add_emails_to_aliases failed, skipping ...\n");
ca1eb8
-            }
ca1eb8
-
ca1eb8
             if (upn == NULL) {
ca1eb8
                 /* We also have to store a fake UPN here, because otherwise the
ca1eb8
                  * krb5 child later won't be able to properly construct one as
ca1eb8
diff --git a/src/providers/ldap/sdap_utils.c b/src/providers/ldap/sdap_utils.c
ca1eb8
index 0ac3ab2e416d887d00480b5123859c611f514274..6d543101f06ce3cd3925a675af6cabdacb8ebcaa 100644
ca1eb8
--- a/src/providers/ldap/sdap_utils.c
ca1eb8
+++ b/src/providers/ldap/sdap_utils.c
ca1eb8
@@ -87,7 +87,6 @@ sdap_save_all_names(const char *name,
ca1eb8
     int i;
ca1eb8
     bool lowercase = !dom->case_sensitive;
ca1eb8
     bool store_as_fqdn;
ca1eb8
-    const char **emails;
ca1eb8
 
ca1eb8
     switch (entry_type) {
ca1eb8
     case SYSDB_MEMBER_USER:
ca1eb8
@@ -144,27 +143,6 @@ sdap_save_all_names(const char *name,
ca1eb8
 
ca1eb8
     }
ca1eb8
 
ca1eb8
-    ret = sysdb_attrs_get_string_array(ldap_attrs, SYSDB_USER_EMAIL, tmp_ctx,
ca1eb8
-                                       &emails);
ca1eb8
-    if (ret == EOK) {
ca1eb8
-        for (i = 0; emails[i] != NULL; i++) {
ca1eb8
-            if (is_email_from_domain(emails[i], dom)) {
ca1eb8
-                ret = sysdb_attrs_add_lc_name_alias_safe(attrs, emails[i]);
ca1eb8
-                if (ret) {
ca1eb8
-                    DEBUG(SSSDBG_OP_FAILURE,
ca1eb8
-                          "Failed to add lower-cased version of email [%s] "
ca1eb8
-                          "into the alias list\n", emails[i]);
ca1eb8
-                    goto done;
ca1eb8
-                }
ca1eb8
-            }
ca1eb8
-        }
ca1eb8
-    } else if (ret == ENOENT) {
ca1eb8
-        DEBUG(SSSDBG_TRACE_ALL, "No email addresses available.\n");
ca1eb8
-    } else {
ca1eb8
-        DEBUG(SSSDBG_OP_FAILURE,
ca1eb8
-              "sysdb_attrs_get_string_array failed, skipping ...\n");
ca1eb8
-    }
ca1eb8
-
ca1eb8
     ret = EOK;
ca1eb8
 done:
ca1eb8
     talloc_free(tmp_ctx);
ca1eb8
-- 
ca1eb8
2.17.1
ca1eb8