summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2005-04-13 07:14:33 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:11:32 -0500
commit0545dfe8565699b030b65e525d6a9649dcc7118c (patch)
tree8ba61793cf018e35e00d5edd22e26cbe91e0bf6f
parent621588c9e6cc4d72212f495de3ed95c47d37fbfd (diff)
downloadsamba-0545dfe8565699b030b65e525d6a9649dcc7118c.tar.gz
samba-0545dfe8565699b030b65e525d6a9649dcc7118c.tar.bz2
samba-0545dfe8565699b030b65e525d6a9649dcc7118c.zip
r6328: Fix bug in OpenAlias.
Implement DeleteDomAlias, QueryAliasInfo, SetAliasInfo, AddAliasMember, and AddMultipleMembersToAlias. Fix one of those annoying large integer warnings. (This used to be commit 25ed39651b020c9e4bda1d8aa8e2d78f918be3a2)
-rw-r--r--source4/scripting/swig/samr.py75
1 files changed, 66 insertions, 9 deletions
diff --git a/source4/scripting/swig/samr.py b/source4/scripting/swig/samr.py
index 9782a9fc7b..8c0d3d32c0 100644
--- a/source4/scripting/swig/samr.py
+++ b/source4/scripting/swig/samr.py
@@ -94,7 +94,7 @@ def call_fn(fn, pipe, args):
result = fn(pipe, args);
- if result & 0xc0000000:
+ if result & 0xc0000000L:
raise dcerpc.NTSTATUS(result, dcerpc.nt_errstr(result));
return result;
@@ -345,7 +345,20 @@ class DomainHandle(SamrHandle):
call_fn(dcerpc.dcerpc_samr_OpenAlias, self.pipe, r)
- return AliasHandle(pipe, r.data_out.group_handle)
+ return AliasHandle(self.pipe, r.data_out.alias_handle)
+
+ def CreateDomAlias(self, alias_name, access_mask = 0x02000000):
+
+ r = dcerpc.samr_CreateDomAlias()
+ r.data_in.domain_handle = self.handle
+ r.data_in.alias_name = dcerpc.samr_String()
+ r.data_in.alias_name.string = alias_name
+ r.data_in.access_mask = access_mask
+
+ call_fn(dcerpc.dcerpc_samr_CreateDomAlias, self.pipe, r)
+
+ return (AliasHandle(self.pipe, r.data_out.alias_handle),
+ r.data_out.rid)
def RidToSid(self, rid):
@@ -399,8 +412,57 @@ class GroupHandle(SamrHandle):
class AliasHandle(SamrHandle):
- pass
-
+
+ def DeleteDomAlias(self):
+
+ r = dcerpc.samr_DeleteDomAlias()
+ r.data_in.alias_handle = self.handle
+
+ call_fn(dcerpc.dcerpc_samr_DeleteDomAlias, self.pipe, r)
+
+ self.handle = None
+
+ def QueryAliasInfo(self, level = 1):
+
+ r = dcerpc.samr_QueryAliasInfo()
+ r.data_in.alias_handle = self.handle
+ r.data_in.level = level
+
+ call_fn(dcerpc.dcerpc_samr_QueryAliasInfo, self.pipe, r)
+
+ return r.data_out.info
+
+ def SetAliasInfo(self, level, info):
+
+ r = dcerpc.samr_SetAliasInfo()
+ r.data_in.alias_handle = self.handle
+ r.data_in.level = level
+ r.data_in.info = info
+
+ call_fn(dcerpc.dcerpc_samr_SetAliasInfo, self.pipe, r)
+
+ def AddAliasMember(self, sid):
+
+ r = dcerpc.samr_AddAliasMember()
+ r.data_in.alias_handle = self.handle
+ r.data_in.sid = string_to_sid(sid)
+
+ call_fn(dcerpc.dcerpc_samr_AddAliasMember, self.pipe, r)
+
+ def AddMultipleMembersToAlias(self, sids):
+
+ r = dcerpc.samr_AddMultipleMembersToAlias()
+ r.data_in.alias_handle = self.handle
+ r.data_in.sids = dcerpc.lsa_SidArray()
+ r.data_in.sids.num_sids = len(sids)
+ r.data_in.sids.sids = dcerpc.new_lsa_SidPtr_array(len(sids))
+
+ for i in range(len(sids)):
+ s = dcerpc.lsa_SidPtr()
+ s.sid = string_to_sid(sids[i])
+ dcerpc.lsa_SidPtr_array_setitem(r.data_in.sids.sids, i, s)
+
+ call_fn(dcerpc.dcerpc_samr_AddMultipleMembersToAlias, self.pipe, r)
def Connect(pipe, access_mask = 0x02000000):
@@ -466,7 +528,6 @@ def Connect5(pipe, system_name = '', access_mask = 0x02000000):
# CreateDomainGroup
-# CreateDomAlias
# GetAliasMembership
# LookupNames
# QueryGroupInfo
@@ -476,9 +537,6 @@ def Connect5(pipe, system_name = '', access_mask = 0x02000000):
# DeleteGroupMember
# QueryGroupMember
# SetMemberAttributesofGroup
-# QueryAliasInfo
-# SetAliasInfo
-# DeleteDomAlias
# AddAliasMember
# DeleteAliasMember
# GetMembersinAlias
@@ -497,7 +555,6 @@ def Connect5(pipe, system_name = '', access_mask = 0x02000000):
# QueryDisplayInfo2
# GetDisplayEnumerationIndex2
# QueryDisplayInfo3
-# AddMultipleMembersToAlias
# RemoveMultipleMembersFromAlias
# OemChangePasswordUser2
# ChangePasswordUser2