import samba.getopt as options
from samba.auth import system_session
-from ldb import SCOPE_BASE, LdbError
-from ldb import ERR_NO_SUCH_OBJECT
-from ldb import Message, MessageElement, Dn
-from ldb import FLAG_MOD_REPLACE
+from ldb import (SCOPE_BASE, LdbError, ERR_NO_SUCH_OBJECT, Message,
+ MessageElement, Dn, FLAG_MOD_REPLACE)
from samba import Ldb
from samba import glue
-#
+
# Unix SMB/CIFS implementation.
# backend code for provisioning a Samba4 server
import ldb
from samba.auth import system_session, admin_session
-from samba import glue, version, Ldb, substitute_var, valid_netbios_name
+import samba
+from samba import version, Ldb, substitute_var, valid_netbios_name
from samba import check_all_substituted, read_and_sub_file, setup_file
from samba.dsdb import DS_DOMAIN_FUNCTION_2003, DS_DC_FUNCTION_2008
from samba.dcerpc import security
policyguid_dc = policyguid_dc.upper()
if adminpass is None:
- adminpass = glue.generate_random_password(12, 32)
+ adminpass = samba.generate_random_password(12, 32)
if krbtgtpass is None:
- krbtgtpass = glue.generate_random_password(128, 255)
+ krbtgtpass = samba.generate_random_password(128, 255)
if machinepass is None:
- machinepass = glue.generate_random_password(128, 255)
+ machinepass = samba.generate_random_password(128, 255)
if dnspass is None:
- dnspass = glue.generate_random_password(128, 255)
+ dnspass = samba.generate_random_password(128, 255)
if ldapadminpass is None:
#Make a new, random password between Samba and it's LDAP server
- ldapadminpass=glue.generate_random_password(128, 255)
+ ldapadminpass=samba.generate_random_password(128, 255)
if backend_type is None:
backend_type = "ldb"
paths.bind_gid = bind_gid
if hostip is None:
- hostips = glue.interface_ips(lp, False)
+ hostips = samba.interface_ips(lp, False)
if len(hostips) == 0:
message("No external IPv4 address has been found: I use the loopback.")
hostip = '127.0.0.1'
"""print a message if quiet is not set."""
print text
- glue.set_debug_level(debuglevel)
+ samba.set_debug_level(debuglevel)
return provision(setup_dir, message, system_session(), None,
smbconf=smbconf, targetdir=targetdir, samdb_fill=FILL_DRS,
self.lp = lp
if url is None:
- url = lp.get("sam database")
+ url = lp.get("sam database")
super(SamDB, self).__init__(url=url, lp=lp, modules_dir=modules_dir,
session_info=session_info, credentials=credentials, flags=flags,
accountExpires = 0
else:
userAccountControl = userAccountControl & ~0x10000
- accountExpires = glue.unix2nttime(expiry_seconds + int(time.time()))
+ accountExpires = samba.unix2nttime(expiry_seconds + int(time.time()))
setexp = """
dn: %s
self.transaction_cancel()
raise
self.transaction_commit()
-