diff options
author | Andrew Tridgell <tridge@samba.org> | 2010-09-23 19:51:36 -0700 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-09-25 10:38:45 -0700 |
commit | c53210bf0609de982d0b36f76198defc8a4502da (patch) | |
tree | 9741ba4b9f9f173a075c16e0359f4c6994a9f5f1 /source4/scripting | |
parent | 3d7a4cf5b68a1adcc4b7b53819ffc0c580e92da0 (diff) | |
download | samba-c53210bf0609de982d0b36f76198defc8a4502da.tar.gz samba-c53210bf0609de982d0b36f76198defc8a4502da.tar.bz2 samba-c53210bf0609de982d0b36f76198defc8a4502da.zip |
s4-net: added --ipaddress option to net commands
this allows override of server IP address, bypassing NBT or DNS name
resolution of DCs
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source4/scripting')
-rw-r--r-- | source4/scripting/python/samba/getopt.py | 7 | ||||
-rw-r--r-- | source4/scripting/python/samba/netcmd/export.py | 2 | ||||
-rw-r--r-- | source4/scripting/python/samba/netcmd/join.py | 2 | ||||
-rw-r--r-- | source4/scripting/python/samba/netcmd/time.py | 2 | ||||
-rw-r--r-- | source4/scripting/python/samba/netcmd/user.py | 4 | ||||
-rw-r--r-- | source4/scripting/python/samba/netcmd/vampire.py | 2 |
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)) |