Более безопастное монтирование Samba ресурсов.

git-svn-id: http://svn.calculate.ru/calculate2/calculate-client/trunk@975 c91db197-33c1-4113-bf15-f8a5c547ca64
develop
asamoukin 15 years ago
parent 2d97002610
commit c20c95671f

@ -416,7 +416,6 @@ conjunction with the 'login' or 'logout'")
if not pwDialog:
pwDialog = _("Password")
userPwd = getpass.getpass(pwDialog+":")
userPwd = re.sub("(\W)", r"\\\1",userPwd)
return userPwd
def chownR(self, directory, uid, gid, dirsAndFiles=False):
@ -628,8 +627,10 @@ conjunction with the 'login' or 'logout'")
return False
if not os.path.exists(pathRemote):
os.makedirs(pathRemote)
mountStr = "mount -t cifs -o user=client,password=%s \
//%s/remote %s" %(pwdRemote,domain,pathRemote)
#Экранируем символы
escPwdRemote = re.sub("(\W)", r"\\\1",pwdRemote)
mountStr = "PASSWD=%s mount -t cifs -o user=client \
//%s/remote %s" %(escPwdRemote,domain,pathRemote)
textLine = self.execProg(mountStr)
if not (textLine == None):
self.printERROR(_("Can not mount Samba resource [remote]") +\
@ -743,8 +744,10 @@ conjunction with the 'login' or 'logout'")
pwdRemote = userPwd
if not os.path.exists(pathRemote):
os.makedirs(pathRemote)
mountStr = "mount -t cifs -o user=client,password=%s \
//%s/remote %s" %(pwdRemote,domain,pathRemote)
# Экранируем символы
escPwdRemote = re.sub("(\W)", r"\\\1",pwdRemote)
mountStr = "PASSWD=%s mount -t cifs -o user=client \
//%s/remote %s" %(escPwdRemote,domain,pathRemote)
textLine = self.execProg(mountStr)
if not (textLine == None):
self.printERROR(_("Can not mount Samba resource [remote]") + \
@ -970,19 +973,23 @@ install/6intranet" %(domain,servDn,unixDN,bindDn,bindPw)
def mountSambaRes(self,userName,userPwd,uid,gid,res,path,
mountUidList=['ftp','share']):
"""Монтирует Samba ресурсы"""
#Экранируем символы
print "PWD", userPwd
escUserPwd = re.sub("(\W)", r"\\\1",userPwd)
print "escPWD", escUserPwd
if res in mountUidList:
# Монтируем директории c uid
mountStr="mount -t cifs -o user=%s,password=%s,uid=%s,gid=%s"\
%(userName,userPwd,uid,gid) + " " +\
"//%s/%s %s" %(self.clVars.Get("cl_remote_host"),
mountStr="PASSWD=%s mount -t cifs -o user=%s,uid=%s,gid=%s"\
%(escUserPwd,userName,uid,gid) +\
" //%s/%s %s" %(self.clVars.Get("cl_remote_host"),
res, path)
else:
# Монтируем директории
mountStr="mount -t cifs -o user=%s,password=%s"%(userName,
userPwd) + " " +\
"//%s/%s %s" %(self.clVars.Get("cl_remote_host"),
mountStr="PASSWD=%s mount -t cifs -o user=%s"%(escUserPwd,
userName)+\
" //%s/%s %s" %(self.clVars.Get("cl_remote_host"),
res, path)
print mountStr
textLine = self.execProg(mountStr)
return textLine

Loading…
Cancel
Save