summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/scripting/python/samba/getopt.py7
-rw-r--r--source4/scripting/python/samba/netcmd/export.py2
-rw-r--r--source4/scripting/python/samba/netcmd/join.py2
-rw-r--r--source4/scripting/python/samba/netcmd/time.py2
-rw-r--r--source4/scripting/python/samba/netcmd/user.py4
-rw-r--r--source4/scripting/python/samba/netcmd/vampire.py2
6 files changed, 13 insertions, 6 deletions
diff --git a/source4/scripting/python/samba/getopt.py b/source4/scripting/python/samba/getopt.py
index 29ab8f0e01..62c94e4411 100644
--- a/source4/scripting/python/samba/getopt.py
+++ b/source4/scripting/python/samba/getopt.py
@@ -98,6 +98,7 @@ class CredentialsOptions(optparse.OptionGroup):
"""Command line options for specifying credentials."""
def __init__(self, parser):
self.no_pass = True
+ self.ipaddress = None
optparse.OptionGroup.__init__(self, parser, "Credentials Options")
self.add_option("--simple-bind-dn", metavar="DN", action="callback",
callback=self._set_simple_bind_dn, type=str,
@@ -115,6 +116,9 @@ class CredentialsOptions(optparse.OptionGroup):
self.add_option("-k", "--kerberos", metavar="KERBEROS",
action="callback", type=str,
help="Use Kerberos", callback=self._set_kerberos)
+ self.add_option("", "--ipaddress", metavar="IPADDRESS",
+ action="callback", type=str,
+ help="IP address of server", callback=self._set_ipaddress)
self.creds = Credentials()
def _parse_username(self, option, opt_str, arg, parser):
@@ -127,6 +131,9 @@ class CredentialsOptions(optparse.OptionGroup):
self.creds.set_password(arg)
self.no_pass = False
+ def _set_ipaddress(self, option, opt_str, arg, parser):
+ self.ipaddress = arg
+
def _set_kerberos(self, option, opt_str, arg, parser):
if bool(arg) or arg.lower() == "yes":
self.creds.set_kerberos_state(MUST_USE_KERBEROS)
diff --git a/source4/scripting/python/samba/netcmd/export.py b/source4/scripting/python/samba/netcmd/export.py
index 5edb318f3e..47c0bf0732 100644
--- a/source4/scripting/python/samba/netcmd/export.py
+++ b/source4/scripting/python/samba/netcmd/export.py
@@ -45,7 +45,7 @@ class cmd_export_keytab(Command):
def run(self, keytab, credopts=None, sambaopts=None, versionopts=None):
lp = sambaopts.get_loadparm()
creds = credopts.get_credentials(lp)
- net = Net(creds, lp)
+ net = Net(creds, lp, server=credopts.ipaddress)
net.export_keytab(keytab=keytab)
diff --git a/source4/scripting/python/samba/netcmd/join.py b/source4/scripting/python/samba/netcmd/join.py
index bce9162e45..0939ec25a0 100644
--- a/source4/scripting/python/samba/netcmd/join.py
+++ b/source4/scripting/python/samba/netcmd/join.py
@@ -47,7 +47,7 @@ class cmd_join(Command):
versionopts=None, server=None, site=None):
lp = sambaopts.get_loadparm()
creds = credopts.get_credentials(lp)
- net = Net(creds, lp)
+ net = Net(creds, lp, server=credopts.ipaddress)
if site is None:
site = "Default-First-Site-Name"
diff --git a/source4/scripting/python/samba/netcmd/time.py b/source4/scripting/python/samba/netcmd/time.py
index 0286f9d100..0856873f39 100644
--- a/source4/scripting/python/samba/netcmd/time.py
+++ b/source4/scripting/python/samba/netcmd/time.py
@@ -41,5 +41,5 @@ class cmd_time(Command):
def run(self, server_name, credopts=None, sambaopts=None, versionopts=None):
lp = sambaopts.get_loadparm()
creds = credopts.get_credentials(lp)
- net = Net(creds, lp)
+ net = Net(creds, lp, server=credopts.ipaddress)
print net.time(server_name)
diff --git a/source4/scripting/python/samba/netcmd/user.py b/source4/scripting/python/samba/netcmd/user.py
index aac7798de8..23840a4a03 100644
--- a/source4/scripting/python/samba/netcmd/user.py
+++ b/source4/scripting/python/samba/netcmd/user.py
@@ -42,7 +42,7 @@ class cmd_user_add(Command):
def run(self, name, password=None, credopts=None, sambaopts=None, versionopts=None):
lp = sambaopts.get_loadparm()
creds = credopts.get_credentials(lp)
- net = Net(creds, lp)
+ net = Net(creds, lp, server=credopts.ipaddress)
net.create_user(name)
if password is not None:
net.set_password(name, creds.get_domain(), password, creds)
@@ -63,7 +63,7 @@ class cmd_user_delete(Command):
def run(self, name, credopts=None, sambaopts=None, versionopts=None):
lp = sambaopts.get_loadparm()
creds = credopts.get_credentials(lp)
- net = Net(creds, lp)
+ net = Net(creds, lp, server=credopts.ipaddress)
net.delete_user(name)
diff --git a/source4/scripting/python/samba/netcmd/vampire.py b/source4/scripting/python/samba/netcmd/vampire.py
index 0bc8fcb7c6..a1cd4fa35b 100644
--- a/source4/scripting/python/samba/netcmd/vampire.py
+++ b/source4/scripting/python/samba/netcmd/vampire.py
@@ -47,6 +47,6 @@ class cmd_vampire(Command):
def run(self, domain, target_dir=None, credopts=None, sambaopts=None, versionopts=None):
lp = sambaopts.get_loadparm()
creds = credopts.get_credentials(lp)
- net = Net(creds, lp)
+ net = Net(creds, lp, server=credopts.ipaddress)
(domain_name, domain_sid) = net.vampire(domain=domain, target_dir=target_dir)
self.outf.write("Vampired domain %s (%s)\n" % (domain_name, domain_sid))