On 03/22/2016 10:45 AM, Michal Židek wrote:
On 03/21/2016 02:17 PM, Lukas Slebodnik wrote:
> On (16/03/16 16:50), Michal Židek wrote:
>> Hi,
>>
>> sorry, I do not have working AD so I did
>> not test the patches. My testing
>> was only SSSD compilation :)
>>
>> But I made a small ap that parses
>> ini files and treats the errors
>> the same way as in these patches
>> and it worked fine.
>>
>> It prints the problematic line
>> with short error description
>> (like missing equal sign).
>>
>> The patch is quite simple. It does not
>> solve any GPO issues, just logs found
>> parsing errors for easier debugging.
>>
>> Michal
>
>> From 0bff25243b18406f88910a88705397365e2e37f1 Mon Sep 17 00:00:00 2001
>> From: =?UTF-8?q?Michal=20=C5=BDidek?= <mzidek(a)redhat.com>
>> Date: Wed, 16 Mar 2016 16:38:34 +0100
>> Subject: [PATCH] GPO: log specific ini parse error messages
>>
>> We should log error messages generated by
>> libini if there are problems with parsing
>> gpo files.
>> ---
>> src/providers/ad/ad_gpo.c | 19 +++++++++++++++++++
>> src/providers/ad/ad_gpo_child.c | 19 +++++++++++++++++++
>> 2 files changed, 38 insertions(+)
>>
>> diff --git a/src/providers/ad/ad_gpo.c b/src/providers/ad/ad_gpo.c
>> index 069196c..360aca5 100644
>> --- a/src/providers/ad/ad_gpo.c
>> +++ b/src/providers/ad/ad_gpo.c
>> @@ -1131,8 +1131,27 @@ ad_gpo_store_policy_settings(struct
>> sss_domain_info *domain,
>>
>> ret = ini_config_parse(file_ctx, INI_STOP_ON_NONE, 0, 0,
>> ini_config);
>> if (ret != 0) {
>> + int lret;
>> + char **errors;
>> +
>> DEBUG(SSSDBG_CRIT_FAILURE,
>> "ini_config_parse failed [%d][%s]\n", ret,
>> strerror(ret));
>
> Does it make sense to print also the filename?
> ini_config_get_filename()
> or is it logged somewhere else?
It is not logged on the same level (and in gpo_child
it is not logged at all) so I think it makes sense to
add it to the debug message that informs about parse
failure. I updated the patch.
>
> BTW you might not be able to do it in gpo_child
> because IIRC config file is parsed from memory (fmemopen)
>
It is available in both cases. We call ini_config_file_open
just few lines above.
Michal
> LS
Lukas noticed that there is missing newline in
the debug message. I also shortened one of the
messages because it contained uninteresting info.
New patch attached.
Michal