summaryrefslogtreecommitdiff
path: root/source4/scripting/swig/rpcclient
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2005-05-01 01:31:23 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:16:24 -0500
commit5c6e1f81cec532e075f2d9e7eab25794a6b10bf7 (patch)
tree9aa86688d86689644ff99d4e45ffe5d42bd97068 /source4/scripting/swig/rpcclient
parent2b215cb5063b31821641315737cff7146b43c97f (diff)
downloadsamba-5c6e1f81cec532e075f2d9e7eab25794a6b10bf7.tar.gz
samba-5c6e1f81cec532e075f2d9e7eab25794a6b10bf7.tar.bz2
samba-5c6e1f81cec532e075f2d9e7eab25794a6b10bf7.zip
r6539: A patch from jbm:
- convert rpcclient to new credential code - allow anonymous connections (This used to be commit f40977c42145e202ddfe50c9a7daad624b06cc59)
Diffstat (limited to 'source4/scripting/swig/rpcclient')
-rwxr-xr-xsource4/scripting/swig/rpcclient29
1 files changed, 16 insertions, 13 deletions
diff --git a/source4/scripting/swig/rpcclient b/source4/scripting/swig/rpcclient
index faf5b3ec09..34efafdf73 100755
--- a/source4/scripting/swig/rpcclient
+++ b/source4/scripting/swig/rpcclient
@@ -28,12 +28,10 @@ class rpcclient(Cmd):
prompt = 'rpcclient$ '
- def __init__(self, server, domain, username, password):
+ def __init__(self, server, cred):
Cmd.__init__(self)
self.server = server
- self.domain = domain
- self.username = username
- self.password = password
+ self.cred = cred
def emptyline(self):
@@ -85,7 +83,7 @@ class rpcclient(Cmd):
pipe = dcerpc.pipe_connect(
'ncacn_np:%s' % self.server,
dcerpc.DCERPC_SAMR_UUID, int(dcerpc.DCERPC_SAMR_VERSION),
- (self.domain, self.username, self.password))
+ self.cred)
connect_handle = samr.Connect(pipe)
@@ -107,7 +105,7 @@ class rpcclient(Cmd):
pipe = dcerpc.pipe_connect(
'ncacn_np:%s' % self.server,
dcerpc.DCERPC_SAMR_UUID, int(dcerpc.DCERPC_SAMR_VERSION),
- (self.domain, self.username, self.password))
+ self.cred)
connect_handle = samr.Connect(pipe)
@@ -128,7 +126,7 @@ class rpcclient(Cmd):
pipe = dcerpc.pipe_connect(
'ncacn_np:%s' % self.server,
dcerpc.DCERPC_SAMR_UUID, int(dcerpc.DCERPC_SAMR_VERSION),
- (self.domain, self.username, self.password))
+ self.cred)
connect_handle = samr.Connect(pipe)
domain_handle = connect_handle.OpenDomain(args[0])
@@ -155,7 +153,7 @@ class rpcclient(Cmd):
pipe = dcerpc.pipe_connect(
'ncacn_np:%s' % self.server,
dcerpc.DCERPC_SAMR_UUID, int(dcerpc.DCERPC_SAMR_VERSION),
- (self.domain, self.username, self.password))
+ self.cred)
connect_handle = samr.Connect(pipe)
domain_handle = connect_handle.OpenDomain(args[0])
@@ -182,7 +180,7 @@ class rpcclient(Cmd):
pipe = dcerpc.pipe_connect(
'ncacn_np:%s' % self.server,
dcerpc.DCERPC_SAMR_UUID, int(dcerpc.DCERPC_SAMR_VERSION),
- (self.domain, self.username, self.password))
+ self.cred)
connect_handle = samr.Connect(pipe)
domain_handle = connect_handle.OpenDomain(args[0])
@@ -207,7 +205,7 @@ class rpcclient(Cmd):
pipe = dcerpc.pipe_connect(
'ncacn_np:%s' % self.server,
dcerpc.DCERPC_SAMR_UUID, int(dcerpc.DCERPC_SAMR_VERSION),
- (self.domain, self.username, self.password))
+ self.cred)
connect_handle = samr.Connect(pipe)
domain_handle = connect_handle.OpenDomain(args[0])
@@ -231,7 +229,7 @@ class rpcclient(Cmd):
pipe = dcerpc.pipe_connect(
'ncacn_np:%s' % self.server,
dcerpc.DCERPC_SAMR_UUID, int(dcerpc.DCERPC_SAMR_VERSION),
- (self.domain, self.username, self.password))
+ self.cred)
connect_handle = samr.Connect(pipe)
domain_handle = connect_handle.OpenDomain(args[0])
@@ -268,7 +266,9 @@ if __name__ == '__main__':
options, args = parser.parse_args()
- # Break --username up into domain, usernamd and password
+ # Break --username up into domain, username and password
+
+ cred = None
if not options.username:
options.username = '%'
@@ -283,9 +283,12 @@ if __name__ == '__main__':
username = options.username
+ if username != '':
+ cred = (domain, username, password)
+
# Run command loop
- c = rpcclient(server, domain, username, password)
+ c = rpcclient(server, cred)
if options.command:
c.onecmd(options.command)