[SCM] Samba Shared Repository - branch master updated
Matthieu Patou
mat at samba.org
Sat Nov 13 07:50:43 MST 2010
On 13/11/2010 17:09, Matthias Dieter Wallnöfer wrote:
> Sure, Jelmer!
>
> Consider this modify request message - doesn't make much sense but was
> needed for a test. There's obviously a bug that the previous message
> element is overwritten by the second one. Only with "modify_ldif" it
> works correctly.
>
> Greets,
> Matthias
>> - m = Message()
>> - m.dn = Dn(ldb, "cn=ldaptestuser,cn=users," + self.base_dn)
>> - m["objectClass"] = MessageElement("bootableDevice",
>> FLAG_MOD_DELETE,
>> - "objectClass")
>> - m["objectClass"] = MessageElement("bootableDevice",
>> FLAG_MOD_ADD,
>> - "objectClass")
>> - try:
>> - ldb.modify(m)
>> - self.fail()
>> - except LdbError, (num, _):
>> - self.assertEquals(num, ERR_ATTRIBUTE_OR_VALUE_EXISTS)
>>
>> + # More than one change operation is allowed
>> + ldb.modify_ldif("""
>> +dn: cn=ldaptestuser,cn=users, """ + self.base_dn + """
>> +changetype: modify
>> +delete: objectClass
>> +objectClass: bootableDevice
>> +add: objectClass
>> +objectClass: bootableDevice
>> +""")
Well that's pretty obvious that the m["objecClass"] way is not correct
as you expect to it to have both the add and remove in your message but
in reality you'll have just the add.
The first question: did you try the FLAG_MOD_MODIFY ?
The second question: it seems that you are trying to trigger some
behavior by changing the objectclass what is the goal of this ?
So for the example you gave modify_ldif might be correct but clearly for
the change you made in upgradeprovisionhelper it wasn't as we can do it
with Message() + modify().
Matthieu.
--
Matthieu Patou
Samba Team http://samba.org
Private repo http://git.samba.org/?p=mat/samba.git;a=summary
More information about the samba-technical
mailing list