mirror of
https://github.com/samba-team/samba.git
synced 2025-12-21 20:23:50 +03:00
python/samba/netcmd/schema.py: samdb schema update now
When we change schema values, we should trigger a schema update to refresh the changes applied. This is called after a change is made. A helper to samdb is added so that it's easier for other locations to call additionally. Signed-off-by: William Brown <william@blackhats.net.au> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Tue May 29 08:30:52 CEST 2018 on sn-devel-144
This commit is contained in:
committed by
Andrew Bartlett
parent
4b1a86235b
commit
5b8620307e
@@ -3909,15 +3909,6 @@ class ldif_schema_update:
|
|||||||
self.dn = None
|
self.dn = None
|
||||||
self.ldif = ""
|
self.ldif = ""
|
||||||
|
|
||||||
def _ldap_schemaUpdateNow(self, samdb):
|
|
||||||
ldif = """
|
|
||||||
dn:
|
|
||||||
changetype: modify
|
|
||||||
add: schemaUpdateNow
|
|
||||||
schemaUpdateNow: 1
|
|
||||||
"""
|
|
||||||
samdb.modify_ldif(ldif)
|
|
||||||
|
|
||||||
def can_ignore_failure(self, error):
|
def can_ignore_failure(self, error):
|
||||||
"""Checks if we can safely ignore failure to apply an LDIF update"""
|
"""Checks if we can safely ignore failure to apply an LDIF update"""
|
||||||
(num, errstr) = error.args
|
(num, errstr) = error.args
|
||||||
@@ -3946,7 +3937,7 @@ schemaUpdateNow: 1
|
|||||||
# Otherwise the OID-to-attribute mapping in
|
# Otherwise the OID-to-attribute mapping in
|
||||||
# _apply_updates_in_file() won't work, because it
|
# _apply_updates_in_file() won't work, because it
|
||||||
# can't lookup the new OID in the schema
|
# can't lookup the new OID in the schema
|
||||||
self._ldap_schemaUpdateNow(samdb)
|
samdb.set_schema_update_now()
|
||||||
|
|
||||||
samdb.modify_ldif(self.ldif, controls=['relax:0'])
|
samdb.modify_ldif(self.ldif, controls=['relax:0'])
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ class cmd_schema_attribute_modify(Command):
|
|||||||
str(searchflags_int), ldb.FLAG_MOD_REPLACE, 'searchFlags')
|
str(searchflags_int), ldb.FLAG_MOD_REPLACE, 'searchFlags')
|
||||||
|
|
||||||
samdb.modify(m)
|
samdb.modify(m)
|
||||||
|
samdb.set_schema_update_now()
|
||||||
self.outf.write("modified %s" % attr_dn)
|
self.outf.write("modified %s" % attr_dn)
|
||||||
|
|
||||||
class cmd_schema_attribute_show(Command):
|
class cmd_schema_attribute_show(Command):
|
||||||
|
|||||||
@@ -762,6 +762,15 @@ accountExpires: %u
|
|||||||
def set_schema_from_ldb(self, ldb_conn, write_indices_and_attributes=True):
|
def set_schema_from_ldb(self, ldb_conn, write_indices_and_attributes=True):
|
||||||
dsdb._dsdb_set_schema_from_ldb(self, ldb_conn, write_indices_and_attributes)
|
dsdb._dsdb_set_schema_from_ldb(self, ldb_conn, write_indices_and_attributes)
|
||||||
|
|
||||||
|
def set_schema_update_now(self):
|
||||||
|
ldif = """
|
||||||
|
dn:
|
||||||
|
changetype: modify
|
||||||
|
add: schemaUpdateNow
|
||||||
|
schemaUpdateNow: 1
|
||||||
|
"""
|
||||||
|
self.modify_ldif(ldif)
|
||||||
|
|
||||||
def dsdb_DsReplicaAttribute(self, ldb, ldap_display_name, ldif_elements):
|
def dsdb_DsReplicaAttribute(self, ldb, ldap_display_name, ldif_elements):
|
||||||
'''convert a list of attribute values to a DRSUAPI DsReplicaAttribute'''
|
'''convert a list of attribute values to a DRSUAPI DsReplicaAttribute'''
|
||||||
return dsdb._dsdb_DsReplicaAttribute(ldb, ldap_display_name, ldif_elements)
|
return dsdb._dsdb_DsReplicaAttribute(ldb, ldap_display_name, ldif_elements)
|
||||||
|
|||||||
Reference in New Issue
Block a user