1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-24 04:23:53 +03:00

gp: samba-tool manage gpo access add don't fail w/out upn

The search response for the user could possibly
not include a upn (this happens with Administrator
for example).

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
David Mulder
2022-11-17 12:37:20 -07:00
committed by Jeremy Allison
parent 8d0d79ba3b
commit 9f6cf276e2

View File

@@ -3916,13 +3916,11 @@ samba-tool gpo manage access add {31B2F340-016D-11D2-945F-00C04FB984F9} allow go
etype = ET.SubElement(listelement, 'type')
etype.text = objectclass.upper()
entry = ET.SubElement(listelement, 'entry')
if objectclass == 'user':
entry.text = get_string(res[0]['userPrincipalName'][-1])
else:
entry.text = '%s\\%s' % (samdb.domain_netbios_name(),
get_string(res[0]['samaccountname'][-1]))
if objectclass == 'group':
groupattr = ET.SubElement(data, 'groupattr')
groupattr.text = 'samAccountName'
entry.text = '%s\\%s' % (domain,
get_string(res[0]['samaccountname'][-1]))
adobject = ET.SubElement(listelement, 'adobject')
name = ET.SubElement(adobject, 'name')
name.text = get_string(res[0]['samaccountname'][-1])