1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-03-20 06:50:23 +03:00

Fixes for joining domains in multi steps using key from registro (HKEY_LOCAL_MACHINE\Sotware\UDSEntepriseActor, value "join" of type string must contain "old" (remenber that in 64 bits, this key can be under WOW3264Node)

This commit is contained in:
Adolfo Gómez García 2017-02-14 12:05:36 +01:00
parent 57d1041f87
commit 217655c276
3 changed files with 20 additions and 2 deletions

View File

@ -78,3 +78,6 @@ def writeConfig(data):
cfg.write(f)
os.chmod(CONFIGFILE, 0o0600)
def useOldJoinSystem():
return False

View File

@ -43,6 +43,7 @@ import servicemanager # @UnresolvedImport, pylint: disable=import-error
import os
from udsactor import operations
from udsactor import store
from udsactor.service import CommonService
from udsactor.service import initCfg
@ -158,10 +159,12 @@ class UDSActorSvc(win32serviceutil.ServiceFramework, CommonService):
ver = ver[0] * 10 + ver[1]
logger.debug('Starting joining domain {} with name {} (detected operating version: {})'.format(
domain, name, ver))
# If file c:\compat.bin exists, joind domain in two steps instead one
# Accepts one step joinDomain, also remember XP is no more supported by
# microsoft, but this also must works with it because will do a "multi
# step" join
if ver >= 60:
if ver >= 60 and store.useOldJoinSystem() is False:
self.oneStepJoin(name, domain, ou, account, password)
else:
self.multiStepJoin(name, domain, ou, account, password)

View File

@ -82,7 +82,6 @@ def readConfig():
except Exception:
return None
def writeConfig(data, fixPermissions=True):
try:
key = wreg.OpenKey(baseKey, path, 0, wreg.KEY_ALL_ACCESS) # @UndefinedVariable
@ -93,3 +92,16 @@ def writeConfig(data, fixPermissions=True):
wreg.SetValueEx(key, "", 0, wreg.REG_BINARY, encoder(cPickle.dumps(data))) # @UndefinedVariable
wreg.CloseKey(key) # @UndefinedVariable
def useOldJoinSystem():
try:
key = wreg.OpenKey(baseKey, 'Software\\UDSEnterpriseActor', 0, wreg.KEY_QUERY_VALUE) # @UndefinedVariable
try:
data, _ = wreg.QueryValueEx(key, 'join') # @UndefinedVariable
except Exception:
data = ''
wreg.CloseKey(key) # @UndefinedVariable
except:
data = ''
return data == 'old'