summaryrefslogtreecommitdiff
path: root/source4/scripting/swig/samr.py
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2005-04-05 11:50:47 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:11:27 -0500
commitb796dc40771f082939e491180570e9697c03cf28 (patch)
tree8629a9b90f8d6afa337234fb7e60757d84b6181c /source4/scripting/swig/samr.py
parentf0641cae5d39eaf4c26881be53f946367a1f49b9 (diff)
downloadsamba-b796dc40771f082939e491180570e9697c03cf28.tar.gz
samba-b796dc40771f082939e491180570e9697c03cf28.tar.bz2
samba-b796dc40771f082939e491180570e9697c03cf28.zip
r6214: Fix typo in DomainHandle.OpenUser() function.
Implement DomainHandle.LookupNames() function. UserHandle.DeleteUser() closes the handle so don't try and close it when the GC destroys the class instance. (This used to be commit 57680163bcc1aa5c707a64dcd1d0998dbc9f0659)
Diffstat (limited to 'source4/scripting/swig/samr.py')
-rw-r--r--source4/scripting/swig/samr.py25
1 files changed, 22 insertions, 3 deletions
diff --git a/source4/scripting/swig/samr.py b/source4/scripting/swig/samr.py
index 22b591930c..9782a9fc7b 100644
--- a/source4/scripting/swig/samr.py
+++ b/source4/scripting/swig/samr.py
@@ -323,7 +323,7 @@ class DomainHandle(SamrHandle):
call_fn(dcerpc.dcerpc_samr_OpenUser, self.pipe, r)
- return UserHandle(pipe, r.data_out.user_handle)
+ return UserHandle(self.pipe, r.data_out.user_handle)
def OpenGroup(self, rid, access_mask = 0x02000000):
@@ -363,7 +363,24 @@ class DomainHandle(SamrHandle):
r.data_in.sid = sid
call_fn(dcerpc.dcerpc_samr_RemoveMemberFromForeignDomain, self.pipe, r)
-
+
+ def LookupNames(self, names):
+
+ r = dcerpc.samr_LookupNames()
+ r.data_in.domain_handle = self.handle
+ r.data_in.num_names = len(names)
+ r.data_in.names = dcerpc.new_samr_String_array(len(names))
+
+ for i in range(len(names)):
+ s = dcerpc.samr_String()
+ s.string = names[i]
+ dcerpc.samr_String_array_setitem(r.data_in.names, i, s)
+
+ call_fn(dcerpc.dcerpc_samr_LookupNames, self.pipe, r)
+
+ return ([dcerpc.uint32_array_getitem(r.data_out.rids.ids, i) for i in range(r.data_out.rids.count)],
+ [dcerpc.uint32_array_getitem(r.data_out.types.ids, i) for i in range(r.data_out.types.count)])
+
class UserHandle(SamrHandle):
@@ -371,8 +388,10 @@ class UserHandle(SamrHandle):
r = dcerpc.samr_DeleteUser()
r.data_in.user_handle = self.handle
-
+
call_fn(dcerpc.dcerpc_samr_DeleteUser, self.pipe, r)
+
+ self.handle = None
class GroupHandle(SamrHandle):