[python-ldap] Modlist with a replace sometimes fails

William william at blackhats.net.au
Wed Feb 17 23:58:04 EST 2016


Hi,

I noticed that the code for modlist does the following:

line 111: 
      if replace_attr_value:
        modlist.append((ldap.MOD_DELETE,attrtype,None))
        modlist.append((ldap.MOD_ADD,attrtype,new_value))

This often fails on certain ldap servers, especially with configuration
directives as they cannot be removed before the add takes place.

I would like to ask that either this be fixed to:

line 111: 
      if replace_attr_value:
        modlist.append((ldap.MOD_REPLACE,attrtype,new_value))

Or if there is a reason to distinguish this behaviour than a boolean or int flag
in the modlist signature be added similar to the ignore_oldexistent=0 flag. IE
replace_is_add_delete=True/False. This way Administrators can control the
behaviour.


Thanks!


-- 
William <william at blackhats.net.au>



More information about the python-ldap mailing list