[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: entry has multiple objectClass attributes

On Tuesday, January 7, 2003, at 06:06 PM, Pierangelo Masarati wrote:

I'm not sure if that is somehow equivalent to your top form. Is add
generally a special case of modify, or is this only the case for the
command line utilities?

Add and modify are completely different LDAP operations; however, they share the same description of attribute-value; assuming you're using the C api, you need to provide an array of struct LDAPMod's whose items contain the attribute types and the values for each attribute. In general, you can't specify each attribytre type more than once in the array; if you have multiple value attributes, you must add all the values in one occurrence of that attribute in the LDAPMod array. My guess is that you're passing your ldap_add() an array of struct LDAPMod's that contains multiple occurrences of objectClass rather than a single occurrence with multiple values.

I'd agree that that's probably what's happening, the tricky part is that it's slurpd that's actually making the API calls which are failing, I'm just writing LDIF to a replog. The fact that the behaviour is different when I define updatedn in slapd.conf makes me think that slurpd is indeed doing something illegal (and in fact the code in slapd that pointed me at that as a potential fix is inside a #if SLURPD_FRIENDLY which makes me think that this is a not-quite-workaround for a known problem). Note also that the same LDIF that makes slurpd make slapd barf works perfectly as input to the ldap_add command.

For other LDAP operations I'm using pythonldap, a python module wrapper around the C API, it exposes the C API calls, but with Python syntax/semantics, so the LDAPMod datastructure you mention above becomes a dictionary with the attribute names as the keys and the values for those keys are lists (even if there's only one value for an attribute is has to be a scalar type). I think it's reasonably transparent, the manual pages for the C API are generally useful in understanding the Python API.