summaryrefslogtreecommitdiffstats
path: root/ipaserver/install
diff options
context:
space:
mode:
authorTomas Babej <tbabej@redhat.com>2016-02-25 14:09:48 +0100
committerTomas Babej <tbabej@redhat.com>2016-02-29 15:46:06 +0100
commitb41fbceeafea126f8e014da5d3596138c6cf0feb (patch)
tree521cfe7bf745cf9b382db1babcbdc571dda22158 /ipaserver/install
parent8f01b47ed96ee3118479d366a71a018e8f938156 (diff)
downloadfreeipa-b41fbceeafea126f8e014da5d3596138c6cf0feb.tar.gz
freeipa-b41fbceeafea126f8e014da5d3596138c6cf0feb.tar.xz
freeipa-b41fbceeafea126f8e014da5d3596138c6cf0feb.zip
ipa-adtrust-install: Allow dash in the NETBIOS name
Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
Diffstat (limited to 'ipaserver/install')
-rw-r--r--ipaserver/install/adtrustinstance.py18
1 files changed, 12 insertions, 6 deletions
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() \