Skip to content

Commit 72c9ed7

Browse files
committedJul 3, 2017
Merge #26628: treewide: setuid/setgid fallout
(cherry picked from commit d88c0cf) There were just a couple of conflicts, apparently someone has already fixed rewritefs and cron on 17.03. I re-checked that all those do build now (with a new-enough nix daemon).
1 parent ebeb890 commit 72c9ed7

File tree

12 files changed

+48
-7
lines changed

12 files changed

+48
-7
lines changed
 

‎pkgs/applications/misc/udevil/default.nix

+2-5
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ stdenv.mkDerivation {
77
};
88
buildInputs = [ intltool glib pkgconfig udev ];
99
configurePhase = ''
10-
substituteInPlace src/Makefile.am --replace "-o root -g root" ""
1110
substituteInPlace src/Makefile.in --replace "-o root -g root" ""
11+
# do not set setuid bit in nix store
12+
substituteInPlace src/Makefile.in --replace 4755 0755
1213
./configure \
1314
--prefix=$out \
1415
--with-mount-prog=${utillinux}/bin/mount \
@@ -17,10 +18,6 @@ stdenv.mkDerivation {
1718
--with-setfacl-prog=${acl.bin}/bin/setfacl \
1819
--sysconfdir=$prefix/etc
1920
'';
20-
preConfigure = ''
21-
cat src/Makefile.am
22-
exit 2
23-
'';
2421
patches = [ ./device-info-sys-stat.patch ];
2522
meta = {
2623
description = "A command line Linux program which mounts and unmounts removable devices without a password, shows device info, and monitors device changes";

‎pkgs/games/unnethack/default.nix

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ stdenv.mkDerivation rec {
2020
"--with-gamesdir=/tmp/unnethack"
2121
];
2222

23+
makeFlags = [ "GAMEPERM=744" ];
24+
2325
postInstall = ''
2426
cp -r /tmp/unnethack $out/share/unnethack/profile
2527
mv $out/bin/unnethack $out/bin/.wrapped_unnethack

‎pkgs/games/xconq/default.nix

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ stdenv.mkDerivation rec {
2626
# Fix Makefiles
2727
find . -name 'Makefile.in' -exec sed -re 's@^ ( *)(cd|[&][&])@ \1\2@' -i '{}' ';'
2828
find . -name 'Makefile.in' -exec sed -e '/chown/d; /chgrp/d' -i '{}' ';'
29+
# do not set sticky bit in nix store
30+
find . -name 'Makefile.in' -exec sed -e 's/04755/755/g' -i '{}' ';'
2931
sed -e '/^ * *[$][(]tcltkdir[)]\/[*][.][*]/d' -i tcltk/Makefile.in
3032
3133
# Fix C files

‎pkgs/games/xsokoban/default.nix

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,18 @@ stdenv.mkDerivation rec {
1515

1616
hardeningDisable = [ "format" ];
1717

18+
prePatch = ''
19+
substituteInPlace Makefile.in --replace 4755 0755
20+
'';
21+
1822
preConfigure = ''
1923
sed -e 's/getline/my_getline/' -i score.c
2024
2125
chmod a+rw config.h
2226
cat >>config.h <<EOF
2327
#define HERE "@nixos-packaged"
2428
#define WWW 0
25-
#define OWNER "'$(whoami)'"
29+
#define OWNER "$(whoami)"
2630
#define ROOTDIR "$out/lib/xsokoban"
2731
#define ANYLEVEL 1
2832
#define SCOREFILE ".xsokoban-score"

‎pkgs/servers/computing/torque/default.nix

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ stdenv.mkDerivation rec {
2929
3030
for f in $(find ./ -name Makefile.in); do
3131
echo patching $f...
32-
sed -i $f -e '/PBS_MKDIRS/d'
32+
sed -i $f -e '/PBS_MKDIRS/d' -e '/chmod u+s/d'
3333
done
34+
3435
'';
3536

3637
postInstall = ''

‎pkgs/servers/http/hiawatha/default.nix

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ stdenv.mkDerivation rec {
2121

2222
buildInputs = [ cmake libxslt zlib libxml2 ] ++ stdenv.lib.optional enableSSL openssl ;
2323

24+
prePatch = ''
25+
substituteInPlace CMakeLists.txt --replace SETUID ""
26+
'';
27+
2428
cmakeFlags = [
2529
( if enableSSL then "-DENABLE_TLS=on" else "-DENABLE_TLS=off" )
2630
( if enableMonitor then "-DENABLE_MONITOR=on" else "-DENABLE_MONITOR=off" )

‎pkgs/shells/rssh/default.nix

+6
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ stdenv.mkDerivation rec {
5959
})
6060
];
6161

62+
# Run this after to avoid conflict with patches above
63+
postPatch = ''
64+
sed -i '/chmod u+s/d' Makefile.in
65+
'';
66+
67+
6268
buildInputs = [ openssh rsync cvs ];
6369

6470
configureFlags = [

‎pkgs/tools/misc/uucp/default.nix

+7
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ stdenv.mkDerivation rec {
1010

1111
hardeningDisable = [ "format" ];
1212

13+
prePatch = ''
14+
# do not set sticky bit in nix store
15+
substituteInPlace Makefile.in \
16+
--replace 4555 0555
17+
sed -i '/chown $(OWNER)/d' Makefile.in
18+
'';
19+
1320
meta = {
1421
description = "Unix-unix cp over serial line, also includes cu program";
1522

‎pkgs/tools/security/logkeys/default.nix

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ stdenv.mkDerivation rec {
1515
postPatch = ''
1616
substituteInPlace src/Makefile.in --replace 'root' '$(id -u)'
1717
substituteInPlace configure --replace '/dev/input' '/tmp'
18+
sed -i '/chmod u+s/d' src/Makefile.in
1819
'';
1920

2021
meta = with stdenv.lib; {

‎pkgs/tools/security/sudo/default.nix

+5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ stdenv.mkDerivation rec {
1414
sha256 = "07fvh8qy0l1h93lccc625f48d8yp0pkp5rjjykq13pb07ar0x64y";
1515
};
1616

17+
prePatch = ''
18+
# do not set sticky bit in nix store
19+
substituteInPlace src/Makefile.in --replace 04755 0755
20+
'';
21+
1722
configureFlags = [
1823
"--with-env-editor"
1924
"--with-editor=/run/current-system/sw/bin/nano"

‎pkgs/tools/security/super/default.nix

+7
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ stdenv.mkDerivation rec {
99
sha256 = "0k476f83w7f45y9jpyxwr00ikv1vhjiq0c26fgjch9hnv18icvwy";
1010
};
1111

12+
prePatch = ''
13+
# do not set sticky bit in nix store
14+
substituteInPlace Makefile.in \
15+
--replace "-o root" "" \
16+
--replace 04755 755
17+
'';
18+
1219
patches = [
1320
(fetchpatch { url = http://anonscm.debian.org/cgit/users/robert/super.git/plain/debian/patches/14-Fix-unchecked-setuid-call.patch;
1421
sha256 = "08m9hw4kyfjv0kqns1cqha4v5hkgp4s4z0q1rgif1fnk14xh7wqh";

‎pkgs/tools/system/logcheck/default.nix

+5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ stdenv.mkDerivation rec {
1010
sha256 = "1x4skb5nmv2xj8cygj8pq1rd1ws4m2fsibw54yslgdyjri4r2yq7";
1111
};
1212

13+
prePatch = ''
14+
# do not set sticky bit in nix store.
15+
substituteInPlace Makefile --replace 2750 0750
16+
'';
17+
1318
preConfigure = ''
1419
substituteInPlace src/logtail --replace "/usr/bin/perl" "${perl}/bin/perl"
1520
substituteInPlace src/logtail2 --replace "/usr/bin/perl" "${perl}/bin/perl"

0 commit comments

Comments
 (0)
Please sign in to comment.