On (02/08/16 11:09), Michal Židek wrote:
Hi!
When reviewing Petr's netgroup patch I found some issues
with netgroups when using IPA provider.
Attached patch fixes one of them.
I filed ticket for the other issue here:
https://fedorahosted.org/sssd/ticket/3117
Reviewing this is not priority for this week, but
I already had the patch and wanted to put the
list.
Thanks,
Michal
From 2e5022452d7002e44ad17a59b4d5b12958721997 Mon Sep 17 00:00:00
2001
From: =?UTF-8?q?Michal=20=C5=BDidek?= <mzidek(a)redhat.com>
Date: Thu, 28 Jul 2016 12:55:46 +0200
Subject: [PATCH] ipa_netgroups: Lowercase key to htable
Fixes:
https://fedorahosted.org/sssd/ticket/3116
We lowercase the search key when storing
entries into the hash table, but do not
do it when we search for them. As a result
we were not able to find netgroup by
DN.
---
src/providers/ipa/ipa_netgroups.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/providers/ipa/ipa_netgroups.c b/src/providers/ipa/ipa_netgroups.c
index a19e5e0..38b4b5d 100644
--- a/src/providers/ipa/ipa_netgroups.c
+++ b/src/providers/ipa/ipa_netgroups.c
@@ -888,7 +888,13 @@ static int ipa_netgr_process_all(struct ipa_get_netgroups_state
*state)
j = 0;
if (ret == EOK) {
for (j = 0; members[j]; j++) {
- key.str = discard_const(members[j]);
+ /* Lower case the search key (we do this also when storing
+ * the entries in the hash table). */
+ key.str = talloc_strdup(state, discard_const(members[j]));
+ for (int p = 0; key.str[p] != '\0'; p++) {
+ key.str[p] = tolower(key.str[p]);
+ }
+
Currently it's not possible to write an integration test using cwrap
But it would be good to add test into freeipa tests.
https://git.fedorahosted.org/cgit/freeipa.git/tree/ipatests/test_integrat...
It should not be complicated. You can reuse 99% of current upstream freeipa
tests. You will need to jsut add netgroups/hostgroups to IPA and call
"getent netgroup"
It's better to write integration tests in other project rather than
manually testing with each release.
LS