mirror of
https://github.com/samba-team/samba.git
synced 2025-07-29 15:42:04 +03:00
s4-provision Add support for fixing the DC rid to a particular value
This will allow an upgraded DC to keep its SID, while being upgraded to AD. We also watch for the highest RID in the existing DB to set next_rid for other additional users. Andrew Bartlett
This commit is contained in:
@ -416,8 +416,9 @@ def upgrade_from_samba3(samba3, logger, session_info, smbconf, targetdir):
|
||||
|
||||
# Find machine account and password
|
||||
machinepass = None
|
||||
machinerid = 2000
|
||||
machinerid = None
|
||||
machinesid = None
|
||||
next_rid = 1000
|
||||
|
||||
try:
|
||||
machinepass = secrets_db.get_machine_password(netbiosname)
|
||||
@ -456,18 +457,22 @@ def upgrade_from_samba3(samba3, logger, session_info, smbconf, targetdir):
|
||||
userlist = old_passdb.search_users(0)
|
||||
userdata = {}
|
||||
for entry in userlist:
|
||||
if machinesid and machinerid == entry['rid']:
|
||||
if machinerid and machinerid == entry['rid']:
|
||||
continue
|
||||
username = entry['account_name']
|
||||
if entry['rid'] < 1000:
|
||||
print("Skipping wellknown rid=%d (for username=%s)\n" % (entry['rid'], username))
|
||||
continue
|
||||
if entry['rid'] >= next_rid:
|
||||
next_rid = entry['rid'] + 1
|
||||
|
||||
userdata[username] = old_passdb.getsampwnam(username)
|
||||
|
||||
# Do full provision
|
||||
result = provision(logger, session_info, None,
|
||||
targetdir=targetdir, realm=realm, domain=domainname,
|
||||
domainsid=domainsid, next_rid=machinerid,
|
||||
domainsid=domainsid, next_rid=next_rid,
|
||||
dc_rid=machinerid,
|
||||
hostname=netbiosname, machinepass=machinepass,
|
||||
serverrole=serverrole, samdb_fill=FILL_FULL)
|
||||
|
||||
|
Reference in New Issue
Block a user