[SSSD] [PATCH] SYSDB: Print message why netgroup cannot be parsed

Lukas Slebodnik lslebodn at redhat.com
Wed Nov 13 16:22:25 UTC 2013


On (13/11/13 15:47), Jakub Hrozek wrote:
>On Wed, Nov 13, 2013 at 03:17:29PM +0100, Lukas Slebodnik wrote:
>> On (13/11/13 15:03), Jakub Hrozek wrote:
>> >On Tue, Nov 12, 2013 at 05:21:56PM +0100, Lukas Slebodnik wrote:
>> >> ehlo,
>> >> 
>> >> It was not easy find out why netgroup could not be covert into result entries.
>> >> Problem was that nisNetgroupTriple contained unexpected string "(,user01)"
>> >> 
>> >> [sssd[nss]] [lookup_netgr_step] (0x0100): Requesting info for [netgr_example]
>> >> [sssd[nss]] [lookup_netgr_step] (0x0020): Failed to convert results into entries
>> >> [sssd[nss]] [nss_cmd_setnetgrent_done] (0x0020): setnetgrent failed
>> >> [sssd[nss]] [netgr_hash_remove] (0x1000): netgroup [netgr_example] was already removed
>> >> 
>> >> Simple patch is attached.
>> >> 
>> >> LS
>> >
>> >> From f68890db040a979639909ca2c2880d4853d244a0 Mon Sep 17 00:00:00 2001
>> >> From: Lukas Slebodnik <lslebodn at redhat.com>
>> >> Date: Tue, 12 Nov 2013 14:39:27 +0100
>> >> Subject: [PATCH] SYSDB: Print message why netgroup cannot be parsed
>> >> 
>> >> It was not easy find out why netgroup could not be covert into result entries.
>> >> Problem was that nisNetgroupTriple contained unexpected string "(,user01)"
>> >
>> >Thanks, this required a good detective work!
>> >
>> >> 
>> >> Resolves:
>> >> https://fedorahosted.org/sssd/ticket/2137
>> >> ---
>> >>  src/db/sysdb_search.c | 3 +++
>> >>  1 file changed, 3 insertions(+)
>> >> 
>> >> diff --git a/src/db/sysdb_search.c b/src/db/sysdb_search.c
>> >> index 8dfaf1f2ada22db5e70ebe18bee1ee299e4767dd..71e727efb24db637d2a693d3efa62deec989a387 100644
>> >> --- a/src/db/sysdb_search.c
>> >> +++ b/src/db/sysdb_search.c
>> >> @@ -728,6 +728,9 @@ errno_t sysdb_netgr_to_entries(TALLOC_CTX *mem_ctx,
>> >>                                          &tmp_entry[c]->value.triple.username,
>> >>                                          &tmp_entry[c]->value.triple.domainname);
>> >>                      if (ret != EOK) {
>> >> +                        DEBUG(SSSDBG_MINOR_FAILURE,
>> >> +                              ("Cannot split netgroup tripple [%s]\n",
>> >
>> >Nitpick The message should say "triple".
>> >
>> >> +                               triple_str));
>> >>                          goto done;
>> >
>> >Can we just discard the single triple and continue instead of failing?
>> 
>> That's the question. I was not sure about it.
>> In my opinion it is better to skip netgroup processing imediately, because
>> it will be higher chance to fix typo in netgroup tripple.
>> On the other hand it will easy to replace s/goto done/continue/.
>> 
>> What is an opinion of other developers?
>
>Then maybe raise the debug level. We have something like IMPORTANT_INFO
>as well..

This patch will ignore only malformed attribute and processing of netgroup
will not fail.

Updated patch is attached.

LS
-------------- next part --------------
>From ddf5f56f3c57f82c74d4e4efb29f59adcd416129 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Tue, 12 Nov 2013 14:39:27 +0100
Subject: [PATCH] SYSDB: Skip malformed netgroup attribute.

It was not easy find out why netgroup could not be covert into result entries.
Problem was that nisNetgroupTriple contained unexpected string "(,user01)"
This patch will ignore only malformed attribute and processing of netgroup
will not fail.

Resolves:
https://fedorahosted.org/sssd/ticket/2137
---
 src/db/sysdb_search.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/db/sysdb_search.c b/src/db/sysdb_search.c
index 8dfaf1f2ada22db5e70ebe18bee1ee299e4767dd..ef51c9fd3101ee634079c37a5c498ccbe3ae2e1e 100644
--- a/src/db/sysdb_search.c
+++ b/src/db/sysdb_search.c
@@ -728,7 +728,11 @@ errno_t sysdb_netgr_to_entries(TALLOC_CTX *mem_ctx,
                                         &tmp_entry[c]->value.triple.username,
                                         &tmp_entry[c]->value.triple.domainname);
                     if (ret != EOK) {
-                        goto done;
+                        DEBUG(SSSDBG_MINOR_IMPORTANT_INFO,
+                              ("Cannot split netgroup triple [%s], "
+                               "this attribute will be skipped \n",
+                               triple_str));
+                        continue;
                     }
 
                     c++;
-- 
1.8.3.1



More information about the sssd-devel mailing list