1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

samba-tool user edit: simplify code

Use "None"-changetype here, instead of "Add". This avoids the need to
remove the changetype line afterwards.

Signed-off-by: Björn Baumbach <bb@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Björn Baumbach 2019-03-13 17:40:37 +01:00 committed by Andrew Bartlett
parent 64e37e3822
commit 4954118b81

View File

@ -2448,9 +2448,7 @@ LDAP server using the 'nano' editor.
raise CommandError('Unable to find user "%s"' % (username))
for msg in res:
r_ldif = samdb.write_ldif(msg, 1)
# remove 'changetype' line
result_ldif = re.sub('changetype: add\n', '', r_ldif)
result_ldif = samdb.write_ldif(msg, ldb.CHANGETYPE_NONE)
if editor is None:
editor = os.environ.get('EDITOR')