[SSSD] [PATCH] failover: Protect against empty host names

Michal Židek mzidek at redhat.com
Mon Nov 26 13:40:11 UTC 2012


On 11/23/2012 10:11 AM, Pavel Březina wrote:
> On 10/17/2012 04:01 PM, Michal Židek wrote:
>> On 10/16/2012 11:36 AM, Pavel Březina wrote:
>>> On 10/15/2012 12:30 PM, Michal Židek wrote:
>>>> Added new parameter to split_on_separator that allows to skip
>>>> empty values.
>>>>
>>>> https://fedorahosted.org/sssd/ticket/1484
>>>>
>>>> Patch is in attachment.
>>>>
>>>> Michal
>>>
>>> Nack. See below.
>>>
>>>> --- a/src/util/util.c
>>>> +++ b/src/util/util.c
>>>> @@ -31,7 +31,8 @@
>>>>    * the separator is a string, and is case-sensitive.
>>>>    * optionally single values can be trimmed of of spaces and tabs */
>>>>   int split_on_separator(TALLOC_CTX *mem_ctx, const char *str,
>>>> -                       const char sep, bool trim, char ***_list, int
>>>> *size)
>>>> +                       const char sep, bool trim, bool skip_empty,
>>>> +                       char ***_list, int *size)
>>>>   {
>>>>       const char *t, *p, *n;
>>>>       size_t l, len;
>>>> @@ -80,6 +81,11 @@ int split_on_separator(TALLOC_CTX *mem_ctx, const
>>>> char *str,
>>>>           }
>>>>
>>>>           if (len == 0) {
>>>> +            if (skip_empty) {
>>>> +                /* Move to next string and continue */
>>>> +                t = n;
>>>> +                continue;
>>>> +            }
>>>
>>> Move this^ condition before talloc_realloc.
>>>
>>
>> I did not like the function at all, it seemed to be written for
>> different purpose but slightly modified to fit our needs. I wrote a new
>> version in this patch and added test for it.
>>
>> New patch attached.
>>
>> Michal
>
> Hi,
> can you rebase it atop the current master please?
>

Sure, here is the new patch.

Thanks
Michal



-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-failover-Protect-against-empty-host-names.patch
Type: text/x-patch
Size: 15642 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20121126/ea3eaa72/attachment.bin>


More information about the sssd-devel mailing list