adding one more case to ndr_pull_string_array/ndr_push_string_array

Matthieu Patou mat at samba.org
Sun Oct 3 00:48:44 MDT 2010


  It seems that nobody has any objection to this patches

I propose to push them on monday if nobody raise any concern.

Cheers.
Matthieu.

On 16/09/2010 20:34, Matthieu Patou wrote:
>  Here some blob example
>
> On 06/09/2010 00:23, Jelmer Vernooij wrote:
>> On Sat, 2010-09-04 at 23:46 +0400, Matthieu Patou wrote:
>>> On 04/09/2010 22:42, Jelmer Vernooij wrote:
>>>> On Sat, 2010-09-04 at 19:54 +0400, Matthieu Patou wrote:
>>>>> It seems that I have a small pb with dfs
>>>>>
>>>>> The expanded names is an array of null terminated utf-16 strings but
>>>>> it's not null terminated that I declared like this:
>>>>>
>>>>>         [relative_short,subcontext(0),flag(STR_NOTERM|NDR_REMAINING)]
>>>>> string *expanded_names
>>>>>
>>>>> Although with this I'm able to parse message made from windows it 
>>>>> causes
>>>>> a pb when s4 should act as a server for windows clients as the last
>>>>> expanded_names is not null terminated.
>>>>>
>>>>> If I set the time to be nstring then w7 is happy but I'm not able to
>>>>> parse the expoted bytes that I attached.
>>>>>
>>>>> I tried to use array to take advantage of the fact that I have the 
>>>>> size
>>>>> with things like:
>>>>>
>>>>>
>>>>> [relative_short] nstring tab[size]
>>>>> or
>>>>> [relative_short, size_is(size)] nstring *tab
>>>>> or
>>>>> [relative_short, size_is(size)] nstring tab[]
>>>>>
>>>>> But either it didn't compile, or it didn't pass the test of 
>>>>> ndrdump with
>>>>> the attached file.
>>>>>
>>>>>
>>>>>
>>>>> I propose to add a kind of exception like:
>>>>>
>>>>> diff --git a/librpc/ndr/ndr_string.c b/librpc/ndr/ndr_string.c
>>>>> index 2e04633..8de2257 100644
>>>>> --- a/librpc/ndr/ndr_string.c
>>>>> +++ b/librpc/ndr/ndr_string.c
>>>>> @@ -469,6 +469,11 @@ _PUBLIC_ enum ndr_err_code
>>>>> ndr_pull_string_array(struct ndr_pull *ndr, int ndr_f
>>>>>                            tmp_ctx = ndr->current_mem_ctx;
>>>>>                            ndr->current_mem_ctx = a;
>>>>>                            NDR_CHECK(ndr_pull_string(ndr, 
>>>>> ndr_flags,&s));
>>>>> +                       if ((ndr->data_size - ndr->offset) == 0&&
>>>>> ndr->flags&   LIBNDR_FLAG_REMAINING)
>>>>> +                       {
>>>>> +                               a[count] = s;
>>>>> +                               break;
>>>>> +                       }
>>>>>                            ndr->current_mem_ctx = tmp_ctx;
>>>>>                            if (strcmp("", s)==0) {
>>>>>                                    a[count] = NULL;
>>>> Do we already generate correct data from the push function ? The
>>>> ndr_push/ndr_pull functions should be consistent in how they handle
>>>> flags.
>>> No that's why I made a more complete patch, as it is in my dfs 
>>> branch on
>>> git.samba.org.
>> Ah, great. This isn't particularly urgent, but something to watch out
>> for as it can be a source of confusion for others.
>>
>> Cheers,
>>
>> Jelmer
>
>
>


-- 
Matthieu Patou
Samba Team        http://samba.org



More information about the samba-technical mailing list