diff options
-rwxr-xr-x | install/tools/ipa-adtrust-install | 6 | ||||
-rw-r--r-- | ipaserver/install/adtrustinstance.py | 18 |
2 files changed, 16 insertions, 8 deletions
diff --git a/install/tools/ipa-adtrust-install b/install/tools/ipa-adtrust-install index 8b3fce2db..f972835ec 100755 --- a/install/tools/ipa-adtrust-install +++ b/install/tools/ipa-adtrust-install @@ -88,13 +88,15 @@ def parse_options(): def netbios_name_error(name): print("\nIllegal NetBIOS name [%s].\n" % name) - print("Up to 15 characters and only uppercase ASCII letter and digits are allowed.") + print("Up to 15 characters and only uppercase ASCII letters, digits " + "and dashes are allowed.") def read_netbios_name(netbios_default): netbios_name = "" print("Enter the NetBIOS name for the IPA domain.") - print("Only up to 15 uppercase ASCII letters and digits are allowed.") + print("Only up to 15 uppercase ASCII letters, digits " + "and dashes are allowed.") print("Example: EXAMPLE.") print("") print("") diff --git a/ipaserver/install/adtrustinstance.py b/ipaserver/install/adtrustinstance.py index 9e7e001f7..8a6e31e5c 100644 --- a/ipaserver/install/adtrustinstance.py +++ b/ipaserver/install/adtrustinstance.py @@ -51,7 +51,7 @@ from ipaplatform.tasks import tasks if six.PY3: unicode = str -ALLOWED_NETBIOS_CHARS = string.ascii_uppercase + string.digits +ALLOWED_NETBIOS_CHARS = string.ascii_uppercase + string.digits + '-' UPGRADE_ERROR = """ Entry %(dn)s does not exist. @@ -90,13 +90,19 @@ def ipa_smb_conf_exists(): return False -def check_netbios_name(s): - # NetBIOS names may not be longer than 15 allowed characters - if not s or len(s) > 15 or \ - ''.join([c for c in s if c not in ALLOWED_NETBIOS_CHARS]): +def check_netbios_name(name): + # Empty NetBIOS name is not allowed + if name is None: return False - return True + # NetBIOS names may not be longer than 15 allowed characters + invalid_netbios_name = any([ + len(name) > 15, + ''.join([c for c in name if c not in ALLOWED_NETBIOS_CHARS]) + ]) + + return not invalid_netbios_name + def make_netbios_name(s): return ''.join([c for c in s.split('.')[0].upper() \ |