1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-14 01:57:53 +03:00

r6324: Pass server name instead of binding string on command line (always use

ncacn_np for the moment).

Fix rpcclient to work with struct cli_credentials.
This commit is contained in:
Tim Potter 2005-04-13 05:57:51 +00:00 committed by Gerald (Jerry) Carter
parent df146d64eb
commit 162d3609a1

View File

@ -28,9 +28,9 @@ class rpcclient(Cmd):
prompt = 'rpcclient$ '
def __init__(self, binding, domain, username, password):
def __init__(self, server, domain, username, password):
Cmd.__init__(self)
self.binding = binding
self.server = server
self.domain = domain
self.username = username
self.password = password
@ -83,9 +83,9 @@ class rpcclient(Cmd):
return
pipe = dcerpc.pipe_connect(
self.binding,
'ncacn_np:%s' % self.server,
dcerpc.DCERPC_SAMR_UUID, int(dcerpc.DCERPC_SAMR_VERSION),
self.domain, self.username, self.password)
(self.domain, self.username, self.password))
connect_handle = samr.Connect(pipe)
@ -105,9 +105,9 @@ class rpcclient(Cmd):
return
pipe = dcerpc.pipe_connect(
self.binding,
'ncacn_np:%s' % self.server,
dcerpc.DCERPC_SAMR_UUID, int(dcerpc.DCERPC_SAMR_VERSION),
self.domain, self.username, self.password)
(self.domain, self.username, self.password))
connect_handle = samr.Connect(pipe)
@ -126,9 +126,9 @@ class rpcclient(Cmd):
return
pipe = dcerpc.pipe_connect(
self.binding,
'ncacn_np:%s' % self.server,
dcerpc.DCERPC_SAMR_UUID, int(dcerpc.DCERPC_SAMR_VERSION),
self.domain, self.username, self.password)
(self.domain, self.username, self.password))
connect_handle = samr.Connect(pipe)
domain_handle = connect_handle.OpenDomain(args[0])
@ -153,9 +153,9 @@ class rpcclient(Cmd):
return
pipe = dcerpc.pipe_connect(
self.binding,
'ncacn_np:%s' % self.server,
dcerpc.DCERPC_SAMR_UUID, int(dcerpc.DCERPC_SAMR_VERSION),
self.domain, self.username, self.password)
(self.domain, self.username, self.password))
connect_handle = samr.Connect(pipe)
domain_handle = connect_handle.OpenDomain(args[0])
@ -180,9 +180,9 @@ class rpcclient(Cmd):
return
pipe = dcerpc.pipe_connect(
self.binding,
'ncacn_np:%s' % self.server,
dcerpc.DCERPC_SAMR_UUID, int(dcerpc.DCERPC_SAMR_VERSION),
self.domain, self.username, self.password)
(self.domain, self.username, self.password))
connect_handle = samr.Connect(pipe)
domain_handle = connect_handle.OpenDomain(args[0])
@ -205,9 +205,9 @@ class rpcclient(Cmd):
return
pipe = dcerpc.pipe_connect(
self.binding,
'ncacn_np:%s' % self.server,
dcerpc.DCERPC_SAMR_UUID, int(dcerpc.DCERPC_SAMR_VERSION),
self.domain, self.username, self.password)
(self.domain, self.username, self.password))
connect_handle = samr.Connect(pipe)
domain_handle = connect_handle.OpenDomain(args[0])
@ -229,9 +229,9 @@ class rpcclient(Cmd):
return
pipe = dcerpc.pipe_connect(
self.binding,
'ncacn_np:%s' % self.server,
dcerpc.DCERPC_SAMR_UUID, int(dcerpc.DCERPC_SAMR_VERSION),
self.domain, self.username, self.password)
(self.domain, self.username, self.password))
connect_handle = samr.Connect(pipe)
domain_handle = connect_handle.OpenDomain(args[0])
@ -247,18 +247,15 @@ if __name__ == '__main__':
# Parse command line
usage = 'rpcclient BINDING [options]'
usage = 'rpcclient SERVER [options]'
if len(sys.argv) == 1:
print usage
sys.exit(1)
binding = sys.argv[1]
server = sys.argv[1]
del(sys.argv[1])
if string.find(binding, ':') == -1:
binding = 'ncacn_np:' + binding
parser = OptionParser(usage)
parser.add_option('-U', '--username', action='store', type='string',
@ -288,7 +285,7 @@ if __name__ == '__main__':
# Run command loop
c = rpcclient(binding, domain, username, password)
c = rpcclient(server, domain, username, password)
if options.command:
c.onecmd(options.command)