ipa-adtrust-install: Allow dash in the NETBIOS name

Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
This commit is contained in:
Tomas Babej committed 2016-02-29 15:46:06 +01:00
1 parent 8f01b47ed9
commit b41fbceeaf
2 files changed
+16 -8

No files matched your search

+4 -2
View File
@@ -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("")
+12 -6
View File
@@ -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() \