python-ldap as replication client

Eric Brunson brunson at brunson.com
Wed Mar 23 17:38:33 CET 2011


On 03/23/2011 01:11 AM, Michael Ströder wrote:
> Eric Brunson wrote:
>> The new code works great, thanks so much for the new features.
>>
>> I do have one issue, and maybe I'm just not looking in the correct
>> place.  The Sync Info Message returns a syncInfoValue which is a BER
>> encoded ASN.1 CHOICE structure:
>>
>>      syncInfoValue ::= CHOICE {
>>                newcookie      [0] syncCookie,
>>                refreshDelete  [1] SEQUENCE {
>>                    cookie         syncCookie OPTIONAL,
>>                    refreshDone    BOOLEAN DEFAULT TRUE
>>                },
>>                refreshPresent [2] SEQUENCE {
>>                    cookie         syncCookie OPTIONAL,
>>                    refreshDone    BOOLEAN DEFAULT TRUE
>>                },
>>                syncIdSet      [3] SEQUENCE {
>>                    cookie         syncCookie OPTIONAL,
>>                    refreshDeletes BOOLEAN DEFAULT FALSE,
>>                    syncUUIDs      SET OF syncUUID
>>                }
>>            }
>>
>> The data is returned and I've been able to successfully decode it with
>> the PyASN1 BER codec, but I can't find any indication of the choice
>> index being returned in the value.   I don't know that the refreshDelete
>> and the refreshPresent are distinguishable from each other without
>> additional information, but I see that the value being returned from
>> result4() is simply what ldap_parse_intermediate() returns, without any
>> indication of the choice index.  Looking at the raw BER encoded packet
>> in wireshark, it would seem that the two bytes before the data being
>> returned have the index embedded in the second byte.
>>
>> I'm sure this must simply be something I'm overlooking.  Any help?
> Could you share a short script demonstrating this?

I've done some more reading and I think I'm mistaken about there being 
some sort of index indicating the type of choice that was encoded.  The 
documentation for the PyASN library implies that the decoder has to 
infer the choice based on the structure of the data, which seems odd.

Thanks for the reply, I'll get back to you when I figure something out.

e.



More information about the python-ldap mailing list