Skip to content

Commit 56f15b6

Browse files
committed
cms.util.mkdir does not produce group-writable directories
1 parent b74be3e commit 56f15b6

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

cms/util.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
import gevent
3636
import gevent.socket
3737

38-
from cms import ServiceCoord, Address, ConfigError, async_config, config
38+
from cms import ServiceCoord, Address, ConfigError, async_config
3939
import typing
4040

4141
if typing.TYPE_CHECKING:
@@ -54,20 +54,11 @@ def mkdir(path: str) -> bool:
5454
"""
5555
try:
5656
os.mkdir(path)
57+
return True
5758
except FileExistsError:
5859
return True
5960
except OSError:
6061
return False
61-
else:
62-
try:
63-
os.chmod(path, 0o770)
64-
cmsuser_gid = pwd.getpwnam(config.cmsuser).pw_gid
65-
os.chown(path, -1, cmsuser_gid)
66-
except OSError:
67-
os.rmdir(path)
68-
return False
69-
else:
70-
return True
7162

7263

7364
# This function uses os.fwalk() to avoid the symlink attack, see:

0 commit comments

Comments
 (0)