From 63bc622a1c6558f7dd51645031f95d0890aeec7c Mon Sep 17 00:00:00 2001
From: Tomas Halman <thalman@redhat.com>
Date: Wed, 19 Aug 2020 15:17:44 +0200
Subject: [PATCH] UTIL: Use sss_sanitize_dn where we deal with DN 2
Tests show that also ldb_dn_get_linearized can
return DN with extra spaces. We have to trim that too.
Resolves:
https://github.com/SSSD/sssd/issues/5261
(cherry picked from commit 12bbd26e6c551d59793ba9a02a1d7cae4062f189)
---
src/ldb_modules/memberof.c | 6 +++---
src/providers/ldap/ldap_id_cleanup.c | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/ldb_modules/memberof.c b/src/ldb_modules/memberof.c
index dae51938b..5de3b7c3b 100644
--- a/src/ldb_modules/memberof.c
+++ b/src/ldb_modules/memberof.c
@@ -1364,7 +1364,7 @@ static int memberof_del(struct ldb_module *module, struct ldb_request *req)
return LDB_ERR_OPERATIONS_ERROR;
}
- sret = sss_filter_sanitize(del_ctx, dn, &clean_dn);
+ sret = sss_filter_sanitize_dn(del_ctx, dn, &clean_dn);
if (sret != 0) {
talloc_free(ctx);
return LDB_ERR_OPERATIONS_ERROR;
@@ -1781,7 +1781,7 @@ static int mbof_del_execute_op(struct mbof_del_operation *delop)
return LDB_ERR_OPERATIONS_ERROR;
}
- ret = sss_filter_sanitize(del_ctx, dn, &clean_dn);
+ ret = sss_filter_sanitize_dn(del_ctx, dn, &clean_dn);
if (ret != 0) {
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -3054,7 +3054,7 @@ static int mbof_get_ghost_from_parent(struct mbof_mod_del_op *igh)
return LDB_ERR_OPERATIONS_ERROR;
}
- ret = sss_filter_sanitize(igh, dn, &clean_dn);
+ ret = sss_filter_sanitize_dn(igh, dn, &clean_dn);
if (ret != 0) {
return LDB_ERR_OPERATIONS_ERROR;
}
diff --git a/src/providers/ldap/ldap_id_cleanup.c b/src/providers/ldap/ldap_id_cleanup.c
index 8c0f0c18b..cd10126f4 100644
--- a/src/providers/ldap/ldap_id_cleanup.c
+++ b/src/providers/ldap/ldap_id_cleanup.c
@@ -422,7 +422,7 @@ static int cleanup_groups(TALLOC_CTX *memctx,
}
/* sanitize dn */
- ret = sss_filter_sanitize(tmpctx, dn, &sanitized_dn);
+ ret = sss_filter_sanitize_dn(tmpctx, dn, &sanitized_dn);
if (ret != EOK) {
DEBUG(SSSDBG_MINOR_FAILURE,
"sss_filter_sanitize failed: %s:[%d]\n",
--
2.21.3