traffic: grant user write permission
authorJoe Guo <joeg@catalyst.net.nz>
Thu, 10 May 2018 04:43:04 +0000 (16:43 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Sat, 12 May 2018 00:09:29 +0000 (02:09 +0200)
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 <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
python/samba/emulate/traffic.py

index eaa0c934049292bb822a0aa69b540b9a7680949c..d65aec6f32c22e516719a3ad52bc8b94ded08bbc 100644 (file)
@@ -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))