samba 3.0.6/7 ldap backend bug

Jeremy Allison jra at samba.org
Tue Sep 21 01:06:01 GMT 2004


On Mon, Sep 20, 2004 at 11:58:02AM +0200, Richard Renard wrote:
> Hi all,
> 
> As already reported on the list by Igor Belyi (09/16/2004), there is a 
> bug in pdb_ldap.c which prevents ldap backend to work correctly when not 
> using "ldap delete dn = yes".
> 
> seems that the bug has been introduced in r1388 of SAMBA_3_0 branch.
> 
> Attached is a patch that fixes the problem.

Richard, this code has already been changed in SVN to read the
following :

                /* We are only allowed to delete the attributes that
                   really exist. */
                                                                                                                                                         
                for (attrib = attrs; *attrib != NULL; attrib++) {
                        if (strequal(*attrib, name)) {
                                DEBUG(10, ("ldapsam_delete_entry: deleting "
                                           "attribute %s\n", name));
                                smbldap_set_mod(&mods, LDAP_MOD_DELETE, name,
                                                NULL);
                        }
                }

Which calls delete if the name matches. Can you explain exactly what the
patch is trying to achieve here ? Are you attempting to prevent deletion
of the LDAP_ATTR_MOD_TIMESTAMP attribute ? If so, I'd prefer the patch to
look like :

                /* We are only allowed to delete the attributes that
                   really exist. */
                                                                                                                                                                                                                                       
                for (attrib = attrs; *attrib != NULL; attrib++) {
			/* Don't delete LDAP_ATTR_MOD_TIMESTAMP attribute. */
			if (strequal(*attrib, get_userattr_key2string(ldap_state->schema_ver,
					LDAP_ATTR_MOD_TIMESTAMP))) {
				continue;
			}
                        if (strequal(*attrib, name)) {
                                DEBUG(10, ("ldapsam_delete_entry: deleting "
                                           "attribute %s\n", name));
                                smbldap_set_mod(&mods, LDAP_MOD_DELETE, name,
                                                NULL);
                        }
                }


Jeremy.


More information about the samba-technical mailing list