1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-06 08:59:08 +03:00

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
This commit is contained in:
Matthieu Patou
2010-10-30 20:42:50 +04:00
committed by Matthieu Patou
parent a509b93518
commit b548674c29

View File

@ -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()