public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH] socks5: use ${PORTAGE_TMPDIR}/portage (bug 683040)
@ 2019-04-11  3:14 Zac Medico
  0 siblings, 0 replies; only message in thread
From: Zac Medico @ 2019-04-11  3:14 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Zac Medico

Write temporary socket files in ${PORTAGE_TMPDIR}/portage,
since writing files directly in ${PORTAGE_TMPDIR} is generally
unexpected.

Bug: https://bugs.gentoo.org/683040
Signed-off-by: Zac Medico <zmedico@gentoo.org>
---
 lib/portage/util/socks5.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/portage/util/socks5.py b/lib/portage/util/socks5.py
index 59e6699ec..86bb24f25 100644
--- a/lib/portage/util/socks5.py
+++ b/lib/portage/util/socks5.py
@@ -38,7 +38,15 @@ class ProxyManager(object):
 		except ImportError:
 			raise NotImplementedError('SOCKSv5 proxy requires asyncio module')
 
-		self.socket_path = os.path.join(settings['PORTAGE_TMPDIR'],
+		tmpdir = os.path.join(settings['PORTAGE_TMPDIR'], 'portage')
+		ensure_dirs_kwargs = {}
+		if portage.secpass >= 1:
+			ensure_dirs_kwargs['gid'] = portage_gid
+			ensure_dirs_kwargs['mode'] = 0o70
+			ensure_dirs_kwargs['mask'] = 0
+		portage.util.ensure_dirs(tmpdir, **ensure_dirs_kwargs)
+
+		self.socket_path = os.path.join(tmpdir,
 				'.portage.%d.net.sock' % os.getpid())
 		server_bin = os.path.join(settings['PORTAGE_BIN_PATH'], 'socks5-server.py')
 		spawn_kwargs = {}
-- 
2.21.0



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-04-11  3:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-11  3:14 [gentoo-portage-dev] [PATCH] socks5: use ${PORTAGE_TMPDIR}/portage (bug 683040) Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox