Исправлена работа в домена на samba 4.8

3.6.1.4
parent f258e34299
commit 46e88c87d0

@ -33,6 +33,7 @@ from calculate.lib.utils.files import (getModeFile, removeDir,
pathJoin, tarLinks,
listDirectory, process, find, STDOUT,
sambaPasswordCheck, checkUtils)
from calculate.lib.utils.samba import Samba, SambaError
from calculate.lib.utils.mount import isMount
from calculate.lib.utils.common import cmpVersion
from calculate.desktop._cl_keys import getKey, clearKey
@ -288,23 +289,34 @@ class Client(commandServer, encrypt, Desktop):
else:
nomapposix = ",nomapposix"
cache_method = self.clVars.Get('cl_cifs_cache')
domain = self.clVars.Get('cl_remote_domain') or \
self.get_server_domainname(host)
cifs_mount_vers = self.clVars.Get('cl_cifs_mount_vers')
if not uid is None:
# mount by uid
p = process(mountCmd, "-t", "cifs", "-o",
"cache=%s,vers=%s,user=%s,uid=%d,gid=%d,noperm%s" % (
cache_method, cifs_mount_vers, userName, uid, gid, nomapposix),
"cache=%s,domain=%s,user=%s,uid=%d,gid=%d,noperm%s" % (
cache_method, domain, cifs_mount_vers,
userName, uid, gid, nomapposix),
"//%s/%s" % (host, res), rpath,
envdict={"PASSWD": userPwd}, stderr=STDOUT)
return p.success()
else:
p = process(mountCmd, "-t", "cifs", "-o",
"cache=%s,vers=%s,user=%s%s" % (cache_method,
cifs_mount_vers, userName, nomapposix),
"cache=%s,domain=%s,vers=%s,user=%s%s" % (cache_method,
cifs_mount_vers, domain, userName, nomapposix),
"//%s/%s" % (host, res), rpath,
envdict={"PASSWD": userPwd}, stderr=STDOUT)
return p.success()
def get_server_domainname(self, host):
if host not in self._domainnames:
try:
self._domainnames[host] = Samba().get_server_domainname(host)
except SambaError as e:
raise ClientError(str(e))
return self._domainnames[host]
def mountSleepRes(self, host, userName, userPwd, res, rpath, uid=None,
gid=None):
"""
@ -1093,6 +1105,7 @@ class Client(commandServer, encrypt, Desktop):
p = process(smbClientCmd, "-N", "//{}/remote".format(domain),
stderr=STDOUT)
if "NT_STATUS_ACCESS_DENIED" in p.read():
self.get_server_domainname(domain)
return True
else:
self.printERROR(_("Samba server not found in %s") % domain)

@ -52,6 +52,11 @@ class VariableClRemoteHost(Variable):
"""
value = ""
class VariableClRemoteDomain(Variable):
"""
Имя домена
"""
value = ""
class VariableClRemoteHostNew(Variable):
"""

Loading…
Cancel
Save