Adding objectClass to existing dn
Mark Roach
mrroach at okmaybe.com
Tue Feb 1 17:46:17 CET 2005
On Tue, 2005-02-01 at 17:11 +0100, Robert Cooke wrote:
> Hi,
>
> Thanks mark for your quick response but I'm sorry to tell the problem is
> not yet solved.
Hmm... perhaps the problem is adding new attributes as a tuple. Here is
a snippet from actual working code:
sambaAttributes = deepcopy(newAttributes)
sambaAttributes['objectClass'].append('sambaSAMAccount')
sambaSID = domainSID + "-" + str(int(uidNumber) * 2 + 1000)
sambaAttributes['sambaSID'] = sambaSID
sambaAttributes['sambaAcctFlags'] = '[UX]'
modlist = ldap.modlist.modifyModlist(newAttributes, sambaAttributes)
self._conn.modify_s(userdn, modlist)
As you can see, the new attributes are just strings. That really
*shouldn't* make a difference though. ... oh wait. I think I see a
problem here:
> list(newattrs['objectClass']).append('ipHost')
This is creating a new copy of newattrs['objectClass'] and appending the
new objectClass to that list. You don't need the list() call at all, in
fact you need to not use list().
-Mark
More information about the python-ldap
mailing list