我希望将大量数据写入LDAP-Server (最好使用ldif),但我也希望ldif中的每个插入/修改/删除操作都能在出现错误时回滚。所以基本上,我需要一个函数,它从一个dict中创建一个ldif,然后得到以下行为。
假设我有一个这样的ldif:
dn: uid=user,cn=testing,dc=foobar #Existing and valid entry so it should work
changeType: modify
replace: sn
sn: Alfred
dn: uid=user2,cn=testing,dc=foobar #Non-existent entry so it should fail
changeType: modify #Now because this fails, the first change
replace: sn #should be rolled back...
sn: Carl因此,如果第二个ldif条目失败,我希望回滚之前所做的更改,以便在整个ldif正确的情况下只创建条目。
似乎没有ldap的交易类型,这将是我正在寻找的。到目前为止,我只发现python...but的ldif解析器已经过时了,因为它已经过时了,我不想再使用它了。因此,如果你们中有谁知道替代方案,请告诉我。
任何帮助都将不胜感激
发布于 2013-06-28 18:36:22
LDAP客户端应该考虑使用RFC5805中指定的LDAP事务。
https://stackoverflow.com/questions/17358814
复制相似问题