summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2010-10-30 20:42:50 +0400
committerMatthieu Patou <mat@samba.org>2010-10-30 17:31:23 +0000
commitb548674c29aa04594e70599d9021182f9a69d753 (patch)
treeabd853c2ce90fd71174646c1aa188fe998356dcb /source4
parenta509b93518b17309f401a6fd107c726c7ab7582f (diff)
downloadsamba-b548674c29aa04594e70599d9021182f9a69d753.tar.gz
samba-b548674c29aa04594e70599d9021182f9a69d753.tar.bz2
samba-b548674c29aa04594e70599d9021182f9a69d753.zip
provision: fix wrong tests
Autobuild-User: Matthieu Patou <mat@samba.org> Autobuild-Date: Sat Oct 30 17:31:23 UTC 2010 on sn-devel-104
Diffstat (limited to 'source4')
-rw-r--r--source4/scripting/python/samba/provision.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py
index 49ad5d755d..319b63debb 100644
--- a/source4/scripting/python/samba/provision.py
+++ b/source4/scripting/python/samba/provision.py
@@ -61,6 +61,7 @@ import samba.registry
from samba.schema import Schema
from samba.samdb import SamDB
+VALID_NETBIOS_CHARS = " !#$%&'()-.@^_{}~"
__docformat__ = "restructuredText"
DEFAULT_POLICY_GUID = "31B2F340-016D-11D2-945F-00C04FB984F9"
DEFAULT_DC_POLICY_GUID = "6AC1786C-016F-11D2-945F-00C04fB984F9"
@@ -444,10 +445,12 @@ def guess_names(lp=None, hostname=None, domain=None, dnsdomain=None,
if netbiosname is None:
netbiosname = hostname
# remove forbidden chars
- for char in " !#$%&'()-.@^_{}~":
- netbiosname = "".join(netbiosname.split(char))
+ newnbname = ""
+ for x in netbiosname:
+ if x.isalnum() or x in VALID_NETBIOS_CHARS:
+ newnbname = "%s%c" % (newnbname, x)
#force the length to be <16
- netbiosname = netbiosname[0:15]
+ netbiosname = newnbname[0:15]
assert netbiosname is not None
netbiosname = netbiosname.upper()
if not valid_netbios_name(netbiosname):
@@ -541,10 +544,12 @@ def make_smbconf(smbconf, setup_path, hostname, domain, realm, serverrole,
hostname = socket.gethostname().split(".")[0]
netbiosname = hostname.upper()
# remove forbidden chars
- for char in " !#$%&'()-.@^_{}~":
- netbiosname = "".join(netbiosname.split(char))
+ newnbname = ""
+ for x in netbiosname:
+ if x.isalnum() or x in VALID_NETBIOS_CHARS:
+ newnbname = "%s%c" % (newnbname, x)
#force the length to be <16
- netbiosname = netbiosname[0:15]
+ netbiosname = newnbname[0:15]
else:
netbiosname = hostname.upper()