From 435319ac1f77f6d33d994a81f73713be0c8e1ab1 Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 24 Apr 2019 23:40:55 +0800 Subject: [PATCH] Update site_api.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 防跨站攻击(open_basedir) 手动设置生效,不自动生效 --- class/core/site_api.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/class/core/site_api.py b/class/core/site_api.py index a716a2f1a..2371cddcf 100755 --- a/class/core/site_api.py +++ b/class/core/site_api.py @@ -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)