dev-python/pyxdg: Remove old

Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Michał Górny
2020-01-26 18:23:35 +01:00
parent 67ab593e8a
commit fdf7963d5c
4 changed files with 0 additions and 113 deletions

View File

@@ -1,2 +1 @@
DIST pyxdg-0.25.tar.gz 48935 BLAKE2B 8feffefff37da1e560040b36cc1ccb4ffdc57642b4de92f7a937303a02117ffe263a5dfc91bb6e85112ce60bc19509c21e7f8f859ef3ca5fca0e8c87a61cb128 SHA512 86cbf3a54fb8e79043db60dcdbb3fb10013ae25a900fa3592edc8a24bf3f440c19bc04626c7906293c785fcb56eab9d87d209b723b5baa872376ba1eb86758b6
DIST pyxdg-rel-0.26.tar.gz 68435 BLAKE2B a95948db17da9909554e82c0ccf590c3f94ec26d1e34d5ba335868233a649368c08ef30cc19e878310ef038e5bdb6d18cd0e15e9413d9c54b70931f25844ee8c SHA512 0c11bccb74b8c0d98f3c63c318d35d08e1c3bbea128bf7b82792e1bdc0a60c8c4d6414b0612b19296cfb48f7951dfc6dd55ac8d23238e370e7faf6c4f64d1fb6

View File

@@ -1,54 +0,0 @@
Improve security of get_runtime_dir(strict=False)
https://github.com/takluyver/pyxdg/commit/bd999c1c3fe7ee5f30ede2cf704cf03e400347b4
diff --git a/xdg/BaseDirectory.py b/xdg/BaseDirectory.py
index cececa3..a7c31b1 100644
--- a/xdg/BaseDirectory.py
+++ b/xdg/BaseDirectory.py
@@ -25,7 +25,7 @@
Note: see the rox.Options module for a higher-level API for managing options.
"""
-import os
+import os, stat
_home = os.path.expanduser('~')
xdg_data_home = os.environ.get('XDG_DATA_HOME') or \
@@ -131,15 +131,30 @@ def get_runtime_dir(strict=True):
import getpass
fallback = '/tmp/pyxdg-runtime-dir-fallback-' + getpass.getuser()
+ create = False
+
try:
- os.mkdir(fallback, 0o700)
+ # This must be a real directory, not a symlink, so attackers can't
+ # point it elsewhere. So we use lstat to check it.
+ st = os.lstat(fallback)
except OSError as e:
import errno
- if e.errno == errno.EEXIST:
- # Already exists - set 700 permissions again.
- import stat
- os.chmod(fallback, stat.S_IRUSR|stat.S_IWUSR|stat.S_IXUSR)
- else: # pragma: no cover
+ if e.errno == errno.ENOENT:
+ create = True
+ else:
raise
-
+ else:
+ # The fallback must be a directory
+ if not stat.S_ISDIR(st.st_mode):
+ os.unlink(fallback)
+ create = True
+ # Must be owned by the user and not accessible by anyone else
+ elif (st.st_uid != os.getuid()) \
+ or (st.st_mode & (stat.S_IRWXG | stat.S_IRWXO)):
+ os.rmdir(fallback)
+ create = True
+
+ if create:
+ os.mkdir(fallback, 0o700)
+
return fallback

View File

@@ -1,27 +0,0 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=5
PYTHON_COMPAT=( python{2_7,3_6} )
inherit distutils-r1
DESCRIPTION="A Python module to deal with freedesktop.org specifications"
HOMEPAGE="https://freedesktop.org/wiki/Software/pyxdg https://cgit.freedesktop.org/xdg/pyxdg/"
SRC_URI="https://people.freedesktop.org/~takluyver/${P}.tar.gz"
LICENSE="LGPL-2"
SLOT="0"
KEYWORDS="~alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 sparc x86"
IUSE="test"
RESTRICT="!test? ( test )"
DEPEND="test? ( dev-python/nose[${PYTHON_USEDEP}]
x11-themes/hicolor-icon-theme )"
DOCS=( AUTHORS ChangeLog README TODO )
PATCHES=( "${FILESDIR}"/sec-patch-CVE-2014-1624.patch )
python_test() {
nosetests || die
}

View File

@@ -1,31 +0,0 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=6
PYTHON_COMPAT=( python{2_7,3_6} )
inherit distutils-r1
MY_P=${PN}-rel-${PV}
DESCRIPTION="A Python module to deal with freedesktop.org specifications"
HOMEPAGE="https://freedesktop.org/wiki/Software/pyxdg https://cgit.freedesktop.org/xdg/pyxdg/"
# official mirror of the git repo
SRC_URI="https://github.com/takluyver/pyxdg/archive/rel-${PV}.tar.gz -> ${MY_P}.tar.gz"
LICENSE="LGPL-2"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
IUSE="test"
RESTRICT="!test? ( test )"
DEPEND="
test? (
dev-python/nose[${PYTHON_USEDEP}]
x11-themes/hicolor-icon-theme
)"
S=${WORKDIR}/${MY_P}
python_test() {
nosetests -v || die
}