mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
[3.14] gh-132124: improve safety nets for creating AF_UNIX socket files (GH-134085) (#134447)
gh-132124: improve safety nets for creating AF_UNIX socket files (GH-134085)
* ensure that we can create AF_UNIX socket files
* emit a warning if system-wide temporary directory is used
(cherry picked from commit 1a07a01014
)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit is contained in:
parent
df6d9e7fbd
commit
f8ced87fa3
4 changed files with 87 additions and 5 deletions
|
@ -76,7 +76,7 @@ def arbitrary_address(family):
|
|||
if family == 'AF_INET':
|
||||
return ('localhost', 0)
|
||||
elif family == 'AF_UNIX':
|
||||
return tempfile.mktemp(prefix='listener-', dir=util.get_temp_dir())
|
||||
return tempfile.mktemp(prefix='sock-', dir=util.get_temp_dir())
|
||||
elif family == 'AF_PIPE':
|
||||
return tempfile.mktemp(prefix=r'\\.\pipe\pyc-%d-%d-' %
|
||||
(os.getpid(), next(_mmap_counter)), dir="")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue