mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
classicupgrade: Avoid needing to quote CN values in an DN, use dn.set_component()
While invalid for samAccountName values, when also used for samAccountName we should be dealing with this at the samldb layer, not here. This comes from unvalidated Samba3 data that can contain a , or = without a problem in that codebase. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
This commit is contained in:
parent
e0acee0223
commit
ac1ed18f8d
@ -272,8 +272,10 @@ def add_group_from_mapping_entry(samdb, groupmap, logger):
|
||||
return
|
||||
|
||||
m = ldb.Message()
|
||||
m.dn = ldb.Dn(samdb, "CN=%s,CN=Users,%s" % (groupmap.nt_name, samdb.get_default_basedn()))
|
||||
m['cn'] = ldb.MessageElement(groupmap.nt_name, ldb.FLAG_MOD_ADD, 'cn')
|
||||
# We avoid using the format string to avoid needing to escape the CN values
|
||||
m.dn = ldb.Dn(samdb, "CN=X,CN=Users")
|
||||
m.dn.set_component(0, "CN", groupmap.nt_name)
|
||||
m.dn.add_base(samdb.get_default_basedn())
|
||||
m['objectClass'] = ldb.MessageElement('group', ldb.FLAG_MOD_ADD, 'objectClass')
|
||||
m['objectSid'] = ldb.MessageElement(ndr_pack(groupmap.sid), ldb.FLAG_MOD_ADD,
|
||||
'objectSid')
|
||||
|
Loading…
x
Reference in New Issue
Block a user