summaryrefslogtreecommitdiff
path: root/source4/scripting/swig/samr.py
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2005-02-12 00:40:00 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:09:44 -0500
commit8cd9d7095bb431d78ed146f1e03a6a036cf66249 (patch)
treedffcb3f11af0438ca44c655847e23a84bd5a7c48 /source4/scripting/swig/samr.py
parent64ad8e52eccc7e191d9d00e09537e720f24341d3 (diff)
downloadsamba-8cd9d7095bb431d78ed146f1e03a6a036cf66249.tar.gz
samba-8cd9d7095bb431d78ed146f1e03a6a036cf66249.tar.bz2
samba-8cd9d7095bb431d78ed146f1e03a6a036cf66249.zip
r5348: Implement the remaining samr connect functions and fix up setsecurity.
(This used to be commit 4b2c3c7ac56e1e428dec6205e4e69268be84cac6)
Diffstat (limited to 'source4/scripting/swig/samr.py')
-rw-r--r--source4/scripting/swig/samr.py59
1 files changed, 53 insertions, 6 deletions
diff --git a/source4/scripting/swig/samr.py b/source4/scripting/swig/samr.py
index ae3f9c77f1..7f82babee3 100644
--- a/source4/scripting/swig/samr.py
+++ b/source4/scripting/swig/samr.py
@@ -118,15 +118,18 @@ class SamrHandle:
result = dcerpc.dcerpc_samr_QuerySecurity(self.pipe, r)
- return r.data_out.sdbuf.sd
+ return r.data_out.sdbuf
- def SetSecurity(self, sec_info = 7):
+ def SetSecurity(self, sdbuf, sec_info = 7):
r = dcerpc.samr_SetSecurity()
r.data_in.handle = self.handle
r.data_in.sec_info = sec_info
+ r.data_in.sdbuf = sdbuf
+ result = dcerpc.dcerpc_samr_SetSecurity(self.pipe, r)
+
class ConnectHandle(SamrHandle):
def EnumDomains(self):
@@ -329,6 +332,17 @@ class AliasHandle(SamrHandle):
pass
+def Connect(pipe, access_mask = 0x02000000):
+
+ r = dcerpc.samr_Connect()
+ r.data_in.system_name = dcerpc.new_uint16_array(1)
+ dcerpc.uint16_array_setitem(r.data_in.system_name, 0, ord('\\'))
+ r.data_in.access_mask = access_mask
+
+ result = dcerpc.dcerpc_samr_Connect(pipe, r)
+
+ return ConnectHandle(pipe, r.data_out.connect_handle)
+
def Connect2(pipe, system_name = '', access_mask = 0x02000000):
"""Connect to the SAMR pipe."""
@@ -340,6 +354,43 @@ def Connect2(pipe, system_name = '', access_mask = 0x02000000):
return ConnectHandle(pipe, r.data_out.connect_handle)
+def Connect3(pipe, system_name = '', access_mask = 0x02000000):
+
+ r = dcerpc.samr_Connect3()
+ r.data_in.system_name = system_name
+ r.data_in.unknown = 0
+ r.data_in.access_mask = access_mask
+
+ result = dcerpc.dcerpc_samr_Connect3(pipe, r)
+
+ return ConnectHandle(pipe, r.data_out.connect_handle)
+
+def Connect4(pipe, system_name = '', access_mask = 0x02000000):
+
+ r = dcerpc.samr_Connect4()
+ r.data_in.system_name = system_name
+ r.data_in.unknown = 0
+ r.data_in.access_mask = access_mask
+
+ result = dcerpc.dcerpc_samr_Connect4(pipe, r)
+
+ return ConnectHandle(pipe, r.data_out.connect_handle)
+
+def Connect5(pipe, system_name = '', access_mask = 0x02000000):
+
+ r = dcerpc.samr_Connect5()
+ r.data_in.system_name = system_name
+ r.data_in.access_mask = access_mask
+ r.data_in.level = 1
+ r.data_in.info = dcerpc.new_samr_ConnectInfo_array(1)
+ r.data_in.info.unknown1 = 0
+ r.data_in.info.unknown2 = 0
+
+ result = dcerpc.dcerpc_samr_Connect5(pipe, r)
+
+ return ConnectHandle(pipe, r.data_out.connect_handle)
+
+
# CreateDomainGroup
# CreateDomAlias
# GetAliasMembership
@@ -379,13 +430,9 @@ def Connect2(pipe, system_name = '', access_mask = 0x02000000):
# OemChangePasswordUser2
# ChangePasswordUser2
# GetDomPwInfo
-# Connect
# SetUserInfo2
# SetBootKeyInformation
# GetBootKeyInformation
-# Connect3
-# Connect4
# ChangePasswordUser3
-# Connect5
# SetDsrmPassword
# ValidatePassword