From: Joe Guo Date: Thu, 10 May 2018 04:43:04 +0000 (+1200) Subject: traffic: grant user write permission X-Git-Tag: ldb-1.4.0~297 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4fb5e28b663c57cc4f67b28312a291132dae2fb6;p=thirdparty%2Fsamba.git traffic: grant user write permission Some packets need user to have write permission, e.g.: writeaccountspn Grant user write permission then we can send packets successfully. Signed-off-by: Joe Guo Reviewed-by: Andrew Bartlett Reviewed-by: Garming Sam --- diff --git a/python/samba/emulate/traffic.py b/python/samba/emulate/traffic.py index eaa0c934049..d65aec6f32c 100644 --- a/python/samba/emulate/traffic.py +++ b/python/samba/emulate/traffic.py @@ -46,6 +46,7 @@ from samba.dsdb import UF_WORKSTATION_TRUST_ACCOUNT, UF_PASSWD_NOTREQD from samba.dsdb import UF_NORMAL_ACCOUNT from samba.dcerpc.misc import SEC_CHAN_WKSTA from samba import gensec +from samba import sd_utils SLEEP_OVERHEAD = 3e-4 @@ -1689,6 +1690,11 @@ def create_user_account(ldb, instance_id, username, userpass): "userAccountControl": str(UF_NORMAL_ACCOUNT), "unicodePwd": utf16pw }) + + # grant user write permission to do things like write account SPN + sdutils = sd_utils.SDUtils(ldb) + sdutils.dacl_add_ace(user_dn, "(A;;WP;;;PS)") + end = time.time() duration = end - start print("%f\t0\tcreate\tuser\t%f\tTrue\t" % (end, duration))