Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
67c189a2
authored
Feb 05, 2013
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
store-server: Removed f.open
parent
e33cc619
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
9 deletions
+7
-9
miscellaneous/store-server/CloudStore.py
+7
-9
No files found.
miscellaneous/store-server/CloudStore.py
View file @
67c189a2
...
...
@@ -283,6 +283,7 @@ def upload(hash_num):
# Check if upload path valid
if
not
up_path
.
startswith
(
'/home'
):
abort
(
400
,
'Invalid path.'
)
os
.
remove
(
ROOT_WWW_FOLDER
+
'/'
+
hash_num
)
# Get the real upload path
# Delete the hash link
...
...
@@ -292,10 +293,6 @@ def upload(hash_num):
# os.seteuid(getpwnam(username).pw_uid)
# TODO setuid subcommand
# Check if file exist (root can overwrite anything not safe)
f
=
open
(
up_path
,
'wb'
)
os
.
chown
(
up_path
,
getpwnam
(
username
)
.
pw_uid
,
getpwnam
(
username
)
.
pw_gid
)
os
.
chmod
(
up_path
,
0644
)
f
.
close
()
with
open
(
up_path
,
'wb'
)
as
f
:
datalength
=
0
for
chunk
in
fbuffer
(
file_data
.
file
):
...
...
@@ -303,8 +300,10 @@ def upload(hash_num):
datalength
+=
len
(
chunk
)
try
:
redirect_address
=
request
.
headers
.
get
(
'Referer'
)
os
.
chown
(
up_path
,
getpwnam
(
username
)
.
pw_uid
,
getpwnam
(
username
)
.
pw_gid
)
os
.
chmod
(
up_path
,
0644
)
except
:
redirect_address
=
REDIRECT_URL
redirect_address
=
REDIRECT_URL
response
.
set_header
(
'Access-Control-Allow-Origin'
,
'*'
)
response
.
set_header
(
'Access-Control-Allow-Methods'
,
'POST, GET, OPTIONS'
)
response
.
set_header
(
'Access-Control-Allow-Headers'
,
'Content-Type, Content-Range, Content-Disposition, Content-Description'
)
...
...
@@ -329,10 +328,9 @@ def updateSSHAuthorizedKeys(username, key_list):
os
.
mkdir
(
user_home_ssh
,
0700
)
os
.
chown
(
user_home_ssh
,
user_uid
,
user_gid
)
auth_file_name
=
user_home_ssh
+
'/authorized_keys'
auth_file
=
open
(
auth_file_name
,
'w'
)
for
key
in
key_list
:
auth_file
.
write
(
key
+
'
\n
'
)
auth_file
.
close
()
with
open
(
auth_file_name
,
'w'
)
as
auth_file
:
for
key
in
key_list
:
auth_file
.
write
(
key
+
'
\n
'
)
os
.
chmod
(
auth_file_name
,
0600
)
os
.
chown
(
auth_file_name
,
user_uid
,
user_gid
)
return
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment