>From cb917fa550770cfa2687b909f4d52f68743b4054 Mon Sep 17 00:00:00 2001 From: Rowland Penny Date: Mon, 6 Jun 2016 16:01:11 +0100 Subject: [PATCH 2/5] samba-tool domain provision, make 'domain' help a bit more friendly, it also checks if the domain name is not the same as the 'realm' name. Signed-off-by: Rowland Penny --- python/samba/netcmd/domain.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/python/samba/netcmd/domain.py b/python/samba/netcmd/domain.py index 703441b..0ca4c7f 100644 --- a/python/samba/netcmd/domain.py +++ b/python/samba/netcmd/domain.py @@ -173,7 +173,7 @@ class cmd_domain_provision(Command): takes_options = [ Option("--interactive", help="Ask for names", action="store_true"), Option("--domain", type="string", metavar="DOMAIN", - help="NetBIOS domain name to use"), + help="The NetBIOS domain name to use (also known as 'workgroup'"), Option("--domain-guid", type="string", metavar="GUID", help="set domainguid (otherwise random)"), Option("--domain-sid", type="string", metavar="SID", @@ -348,6 +348,10 @@ class cmd_domain_provision(Command): if domain is None: raise CommandError("No domain set!") + if realm == domain: + raise CommandError("The NetBIOS domain name cannot be the same \ +as the realm") + server_role = "dc" dns_backend = ask("DNS backend (SAMBA_INTERNAL, BIND9_FLATFILE, BIND9_DLZ, NONE)", "SAMBA_INTERNAL") @@ -375,9 +379,12 @@ class cmd_domain_provision(Command): else: realm = sambaopts._lp.get('realm') if realm is None: - raise CommandError("No realm set!") + raise CommandError("You must supply the realm name!") if domain is None: - raise CommandError("No domain set!") + raise CommandError("You must supply the NetBIOS domain name!") + if realm == domain: + raise CommandError("The NetBIOS domain name cannot be the same \ +as the realm") if not adminpass: self.logger.info("Administrator password will be set randomly!") -- 1.7.10.4