1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-18 00:59:12 +03:00

Some changes to allow processing of ldap controls on modify requests.

ldap_backend used to filter out ldap controls on modify. Also, modified
python binding for ldap_modify to allow writing tests for such controls.
This commit is contained in:
Nadezhda Ivanova
2009-11-20 13:22:38 +02:00
parent 07e971f1c1
commit a760f169f4
6 changed files with 106 additions and 10 deletions

View File

@ -566,6 +566,12 @@ void initglue(void)
PyModule_AddObject(m, "DS_DC_FUNCTION_2008", PyInt_FromLong(DS_DC_FUNCTION_2008));
PyModule_AddObject(m, "DS_DC_FUNCTION_2008_R2", PyInt_FromLong(DS_DC_FUNCTION_2008_R2));
/* "LDAP_SERVER_SD_FLAGS_OID" */
PyModule_AddObject(m, "SECINFO_OWNER", PyInt_FromLong(SECINFO_OWNER));
PyModule_AddObject(m, "SECINFO_GROUP", PyInt_FromLong(SECINFO_GROUP));
PyModule_AddObject(m, "SECINFO_DACL", PyInt_FromLong(SECINFO_DACL));
PyModule_AddObject(m, "SECINFO_SACL", PyInt_FromLong(SECINFO_SACL));
/* one of the most annoying things about python scripts is
that they don't die when you hit control-C. This fixes that
sillyness. As we do all database operations using

View File

@ -241,7 +241,7 @@ class Ldb(ldb.Ldb):
"""
self.add_ldif(open(ldif_path, 'r').read())
def add_ldif(self, ldif,controls=None):
def add_ldif(self, ldif, controls=None):
"""Add data based on a LDIF string.
:param ldif: LDIF text.
@ -250,13 +250,13 @@ class Ldb(ldb.Ldb):
assert changetype == ldb.CHANGETYPE_NONE
self.add(msg,controls)
def modify_ldif(self, ldif):
def modify_ldif(self, ldif, controls=None):
"""Modify database based on a LDIF string.
:param ldif: LDIF text.
"""
for changetype, msg in self.parse_ldif(ldif):
self.modify(msg)
self.modify(msg, controls)
def set_domain_sid(self, sid):
"""Change the domain SID used by this LDB.
@ -423,3 +423,9 @@ DS_DC_FUNCTION_2003 = glue.DS_DC_FUNCTION_2003
DS_DC_FUNCTION_2008 = glue.DS_DC_FUNCTION_2008
DS_DC_FUNCTION_2008_R2 = glue.DS_DC_FUNCTION_2008_R2
#LDAP_SERVER_SD_FLAGS_OID flags
SECINFO_OWNER = glue.SECINFO_OWNER
SECINFO_GROUP = glue.SECINFO_GROUP
SECINFO_DACL = glue.SECINFO_DACL
SECINFO_SACL = glue.SECINFO_SACL