From e422fa0d55711ce4045eebac62402310c937ddf6 Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Thu, 17 Feb 2022 07:19:11 +0100 Subject: [PATCH] perl-core/File-Temp: Add from gentoo It's from gentoo commit 4422984d379c73f5b76891fcb58f694b5ba5a150. It's a dependency of virtual/perl-File-Temp. --- .../File-Temp/File-Temp-0.231.100.ebuild | 17 +++++++++ perl-core/File-Temp/Manifest | 1 + .../File-Temp-0.230.0-symlink-safety.patch | 37 +++++++++++++++++++ perl-core/File-Temp/metadata.xml | 13 +++++++ 4 files changed, 68 insertions(+) create mode 100644 perl-core/File-Temp/File-Temp-0.231.100.ebuild create mode 100644 perl-core/File-Temp/Manifest create mode 100644 perl-core/File-Temp/files/File-Temp-0.230.0-symlink-safety.patch create mode 100644 perl-core/File-Temp/metadata.xml diff --git a/perl-core/File-Temp/File-Temp-0.231.100.ebuild b/perl-core/File-Temp/File-Temp-0.231.100.ebuild new file mode 100644 index 0000000000..7555c0f30c --- /dev/null +++ b/perl-core/File-Temp/File-Temp-0.231.100.ebuild @@ -0,0 +1,17 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +DIST_AUTHOR=ETHER +DIST_VERSION=0.2311 +inherit perl-module + +DESCRIPTION="File::Temp can be used to create and open temporary files in a safe way" + +SLOT="0" +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="" + +# bug 390719 +PATCHES=( "${FILESDIR}/${PN}-0.230.0-symlink-safety.patch" ) diff --git a/perl-core/File-Temp/Manifest b/perl-core/File-Temp/Manifest new file mode 100644 index 0000000000..49f6f62e18 --- /dev/null +++ b/perl-core/File-Temp/Manifest @@ -0,0 +1 @@ +DIST File-Temp-0.2311.tar.gz 76988 BLAKE2B d867a5c391fb8bdf1534469ad67f3e122666fd857c3cabda67fcc216896159cb95b31a4885ee47c803e147fa246defc12608780e7814ede8e5662c8f8ffd3d0e SHA512 2db3f03f4d25013c60585cd3e6aa7e68fe9bb26f1957adf6674e9cae9e963a41c559d36862943703f567d116c82747b4fae0612253a784addeb53d7867a232d1 diff --git a/perl-core/File-Temp/files/File-Temp-0.230.0-symlink-safety.patch b/perl-core/File-Temp/files/File-Temp-0.230.0-symlink-safety.patch new file mode 100644 index 0000000000..d6a3a717c7 --- /dev/null +++ b/perl-core/File-Temp/files/File-Temp-0.230.0-symlink-safety.patch @@ -0,0 +1,37 @@ +From: John Lightsey +Date: Mon, 27 Jun 2011 13:07:44 -0500 +Subject: [PATCH] symlink safety + +Add check for unsafe symbolic links to _is_safe() directory check. + + +diff -ruN File-Temp-0.23.orig/lib/File/Temp.pm File-Temp-0.23/lib/File/Temp.pm +--- File-Temp-0.23.orig/lib/File/Temp.pm 2013-03-14 22:56:59.000000000 +0100 ++++ File-Temp-0.23/lib/File/Temp.pm 2014-10-15 23:46:29.894611586 +0200 +@@ -672,7 +672,25 @@ + my $err_ref = shift; + + # Stat path +- my @info = stat($path); ++ my @info = lstat($path); ++ my $symlink_test_path = $path; ++ my $symlink_loop_count = 0; ++ while (-l _) { ++ if (++$symlink_loop_count >= 50) { ++ $$err_ref = "50 levels of symlinks encountered at $path"; ++ return 0; ++ } ++ if ( $info[4] <= File::Temp->top_system_uid() || $info[4] == $>) { ++ # safe to traverse ++ $symlink_test_path = readlink($symlink_test_path); ++ @info = lstat($symlink_test_path); ++ } ++ else { ++ $$err_ref = "Unsafe symlink at $path"; ++ return 0; ++ } ++ } ++ + unless (scalar(@info)) { + $$err_ref = "stat(path) returned no values"; + return 0; diff --git a/perl-core/File-Temp/metadata.xml b/perl-core/File-Temp/metadata.xml new file mode 100644 index 0000000000..acaf45390a --- /dev/null +++ b/perl-core/File-Temp/metadata.xml @@ -0,0 +1,13 @@ + + + + + perl@gentoo.org + Gentoo Perl Project + + + File-Temp + File::Temp + File::Temp::Dir + +