mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
Update site_api.py
防跨站攻击(open_basedir) 手动设置生效,不自动生效
This commit is contained in:
@@ -994,7 +994,6 @@ class site_api:
|
||||
path = request.form.get('path', '').encode('utf-8')
|
||||
|
||||
path = self.getPath(path)
|
||||
print path
|
||||
if path == "" or mid == '0':
|
||||
return public.returnJson(False, "目录不能为空!")
|
||||
|
||||
@@ -1013,13 +1012,13 @@ class site_api:
|
||||
public.writeFile(file, conf)
|
||||
|
||||
# 创建basedir
|
||||
userIni = path + '/.user.ini'
|
||||
if os.path.exists(userIni):
|
||||
public.execShell("chattr -i " + userIni)
|
||||
public.writeFile(userIni, 'open_basedir=' + path + '/:/tmp/:/proc/')
|
||||
public.execShell('chmod 644 ' + userIni)
|
||||
public.execShell('chown root:root ' + userIni)
|
||||
public.execShell('chattr +i ' + userIni)
|
||||
# userIni = path + '/.user.ini'
|
||||
# if os.path.exists(userIni):
|
||||
# public.execShell("chattr -i " + userIni)
|
||||
# public.writeFile(userIni, 'open_basedir=' + path + '/:/tmp/:/proc/')
|
||||
# public.execShell('chmod 644 ' + userIni)
|
||||
# public.execShell('chown root:root ' + userIni)
|
||||
# public.execShell('chattr +i ' + userIni)
|
||||
|
||||
public.restartWeb()
|
||||
public.M("sites").where("id=?", (mid,)).setField('path', path)
|
||||
|
||||
Reference in New Issue
Block a user