>From bac04ac0cd2877a7016b32e8c720cfb5ddcd72f4 Mon Sep 17 00:00:00 2001 From: Rowland Penny Date: Wed, 29 Jun 2016 11:10:23 +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 5bcccef..fdd3548 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") + # don't ask for server_role, only 'dc' actually works. server_role = "dc" @@ -376,9 +380,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!") -- 2.1.4