diff --git a/pkgs/by-name/mp/mpack/CVE-2011-4919.patch b/pkgs/by-name/mp/mpack/CVE-2011-4919.patch deleted file mode 100644 index 10b9a1116ef3..000000000000 --- a/pkgs/by-name/mp/mpack/CVE-2011-4919.patch +++ /dev/null @@ -1,23 +0,0 @@ -commit 0c87201f64491575350b18d04c62ec142e119d1f -Author: Sebastian Pipping -Date: Sat, 31 Dec 2011 19:17:20 +0000 (20:17 +0100) -Source: https://web.archive.org/web/20120128080247/http://git.goodpoint.de/?p=mpack.git;a=commitdiff;h=0c87201f64491575350b18d04c62ec142e119d1f - - Fix permissions - -diff --git a/unixos.c b/unixos.c -index fa6d0a7..0e2f469 100644 (file) ---- a/unixos.c -+++ b/unixos.c -@@ -134,9 +134,9 @@ FILE *os_createnewfile(char *fname) - FILE *ret; - - #ifdef O_EXCL -- fd=open(fname, O_RDWR|O_CREAT|O_EXCL, 0644); -+ fd=open(fname, O_RDWR|O_CREAT|O_EXCL, 0600); - #else -- fd=open(fname, O_RDWR|O_CREAT|O_TRUNC, 0644); -+ fd=open(fname, O_RDWR|O_CREAT|O_TRUNC, 0600); - #endif - - if (fd == -1) diff --git a/pkgs/by-name/mp/mpack/build-fix.patch b/pkgs/by-name/mp/mpack/build-fix.patch deleted file mode 100644 index 0329bedd07f3..000000000000 --- a/pkgs/by-name/mp/mpack/build-fix.patch +++ /dev/null @@ -1,29 +0,0 @@ -diff -ubr mpack-1.6-orig/unixos.c mpack-1.6/unixos.c ---- mpack-1.6-orig/unixos.c 2013-08-17 14:32:38.102772775 +0200 -+++ mpack-1.6/unixos.c 2013-08-17 14:32:43.180792505 +0200 -@@ -38,10 +38,6 @@ - #define MAXHOSTNAMELEN 64 - #endif - --extern int errno; --extern char *malloc(); --extern char *getenv(); -- - int overwrite_files = 0; - int didchat; - -Only in mpack-1.6: unixos.o -Only in mpack-1.6: unixunpk.o -Only in mpack-1.6: uudecode.o -diff -ubr mpack-1.6-orig/xmalloc.c mpack-1.6/xmalloc.c ---- mpack-1.6-orig/xmalloc.c 2013-08-17 14:32:38.102772775 +0200 -+++ mpack-1.6/xmalloc.c 2013-08-17 14:33:08.900892319 +0200 -@@ -24,7 +24,6 @@ - */ - #include - #include --extern char *malloc(), *realloc(); - - char *xmalloc (int size) - { -Only in mpack-1.6: xmalloc.o diff --git a/pkgs/by-name/mp/mpack/package.nix b/pkgs/by-name/mp/mpack/package.nix index 5f2fa1124dee..5fc18538ed0c 100644 --- a/pkgs/by-name/mp/mpack/package.nix +++ b/pkgs/by-name/mp/mpack/package.nix @@ -2,6 +2,8 @@ lib, stdenv, fetchurl, + fetchpatch, + autoreconfHook, testers, mpack, }: @@ -15,23 +17,64 @@ stdenv.mkDerivation rec { hash = "sha256-J0EIuzo5mCpO/BT7OmUpjmbI5xNnw9q/STOBYtIHqUw="; }; - patches = [ - ./build-fix.patch - ./sendmail-via-execvp.diff - ./CVE-2011-4919.patch - ]; + patches = + let + # https://salsa.debian.org/debian/mpack/-/tree/7d6514b314a7341614ec8275b03acfcb6a854a6f/debian/patches + fetchDebPatch = + { name, hash }: + fetchpatch { + inherit name hash; + url = "https://salsa.debian.org/debian/mpack/-/raw/7d6514b314a7341614ec8275b03acfcb6a854a6f/debian/patches/${name}"; + }; + in + [ + ./sendmail-via-execvp.diff + ] + ++ (map fetchDebPatch [ + { + name = "01_legacy.patch"; + hash = "sha256-v2pZUXecgxJqoHadBhpAAoferQNSeYE+m7qzEiggeO4="; + } + { + name = "02_fix-permissions.patch"; + hash = "sha256-sltnIqgv7+pwwSFQRCDeCwnjoo2OrvmGFm+SM9U/HB4="; + } + { + name = "03_specify-filename-replacement-character.patch"; + hash = "sha256-vmLIGFSqKK/qSsltzhdLQGoekew3r25EwAu56umeXlU="; + } + { + name = "04_fix-return-error-code.patch"; + hash = "sha256-l23D6xhkgtkEsErzUy/q6U3aPf5N7YUw2PEToU1YXKI="; + } + { + name = "06_fix-makefile.patch"; + hash = "sha256-69plDqy2sLzO1O4mqjJIlTRCw5ZeVySiqwo93ZkX3Ho="; + } + { + name = "07_fix-decode-base64-attachment.patch"; + hash = "sha256-hzSCrEg0j6dJNLbfwRNn+rWGRnyUBLjJUlORJS9aDD4="; + } + { + name = "08_fix-mime-version.patch"; + hash = "sha256-l2rBqbyKmnz5tEPeuX6HCqw7rSV8pDb7ijpCHsdh57g="; + } + { + name = "09_remove-debugging-message.patch"; + hash = "sha256-dtq6BHgH4ciho0+TNW/rU3KWoeKs/1jwJafnHTr9ebI="; + } + ]); postPatch = '' - for f in *.{c,man,pl,unix} ; do - substituteInPlace $f --replace /usr/tmp /tmp - done + substituteInPlace *.{c,man,pl,unix} --replace-quiet /usr/tmp /tmp - # this just shuts up some warnings - for f in {decode,encode,part,unixos,unixpk,unixunpk,xmalloc}.c ; do - sed -i 'i#include ' $f - done + # silence a buffer overflow warning + substituteInPlace uudecode.c \ + --replace-fail "char buf[1024], buf2[1024];" "char buf[1024], buf2[1066];" ''; + nativeBuildInputs = [ autoreconfHook ]; + postInstall = '' install -Dm644 -t $out/share/doc/mpack INSTALL README.* '';