summary refs log tree commit diff
path: root/pkgs/os-specific/linux/pam
diff options
context:
space:
mode:
authorWill Dietz <w@wdtz.org>2019-04-16 18:50:31 -0500
committerWill Dietz <w@wdtz.org>2019-04-18 11:42:15 -0500
commitc260a8d06355fa6813c7722165bba696592ec307 (patch)
tree627c7c13e0886f643626b800f49c8d03fd29208d /pkgs/os-specific/linux/pam
parente53ade7dab1fa5cf4ff7c37ad279802ee1dce863 (diff)
downloadnixpkgs-c260a8d06355fa6813c7722165bba696592ec307.tar
nixpkgs-c260a8d06355fa6813c7722165bba696592ec307.tar.gz
nixpkgs-c260a8d06355fa6813c7722165bba696592ec307.tar.bz2
nixpkgs-c260a8d06355fa6813c7722165bba696592ec307.tar.lz
nixpkgs-c260a8d06355fa6813c7722165bba696592ec307.tar.xz
nixpkgs-c260a8d06355fa6813c7722165bba696592ec307.tar.zst
nixpkgs-c260a8d06355fa6813c7722165bba696592ec307.zip
libpam: fix w/musl after update to 1.3.1
Diffstat (limited to 'pkgs/os-specific/linux/pam')
-rw-r--r--pkgs/os-specific/linux/pam/default.nix7
-rw-r--r--pkgs/os-specific/linux/pam/musl-fix-pam_exec.patch33
2 files changed, 36 insertions, 4 deletions
diff --git a/pkgs/os-specific/linux/pam/default.nix b/pkgs/os-specific/linux/pam/default.nix
index 9db581ad527..01a6fbb1f9f 100644
--- a/pkgs/os-specific/linux/pam/default.nix
+++ b/pkgs/os-specific/linux/pam/default.nix
@@ -18,10 +18,9 @@ stdenv.mkDerivation rec {
       url = "https://git.alpinelinux.org/cgit/aports/plain/main/linux-pam/libpam-fix-build-with-eglibc-2.16.patch?id=05a62bda8ec255d7049a2bd4cf0fdc4b32bdb2cc";
       sha256 = "1ib6shhvgzinjsc603k2x1lxh9dic6qq449fnk110gc359m23j81";
     })
-    (fetchpatch {
-      url = "https://git.alpinelinux.org/cgit/aports/plain/main/linux-pam/musl-fix-pam_exec.patch?id=05a62bda8ec255d7049a2bd4cf0fdc4b32bdb2cc";
-      sha256 = "04dx6s9d8cxl40r7m7dc4si47ds4niaqm7902y1d6wcjvs11vrf0";
-    })
+    # From adelie's package repo, using local copy since it seems to be currently offline.
+    # (we previously used similar patch from void, but stopped working with update to 1.3.1)
+    ./musl-fix-pam_exec.patch
   ];
 
   outputs = [ "out" "doc" "man" /* "modules" */ ];
diff --git a/pkgs/os-specific/linux/pam/musl-fix-pam_exec.patch b/pkgs/os-specific/linux/pam/musl-fix-pam_exec.patch
new file mode 100644
index 00000000000..194e47b9e5b
--- /dev/null
+++ b/pkgs/os-specific/linux/pam/musl-fix-pam_exec.patch
@@ -0,0 +1,33 @@
+--- ./modules/pam_exec/pam_exec.c.orig
++++ ./modules/pam_exec/pam_exec.c
+@@ -103,11 +103,14 @@
+   int optargc;
+   const char *logfile = NULL;
+   const char *authtok = NULL;
++  char authtok_buf[PAM_MAX_RESP_SIZE+1];
++
+   pid_t pid;
+   int fds[2];
+   int stdout_fds[2];
+   FILE *stdout_file = NULL;
+ 
++  memset(authtok_buf, 0, sizeof(authtok_buf));
+   if (argc < 1) {
+     pam_syslog (pamh, LOG_ERR,
+ 		"This module needs at least one argument");
+@@ -180,12 +183,12 @@
+ 	      if (resp)
+ 		{
+ 		  pam_set_item (pamh, PAM_AUTHTOK, resp);
+-		  authtok = strndupa (resp, PAM_MAX_RESP_SIZE);
++		  authtok = strncpy(authtok_buf, resp, sizeof(authtok_buf));
+ 		  _pam_drop (resp);
+ 		}
+ 	    }
+ 	  else
+-	    authtok = strndupa (void_pass, PAM_MAX_RESP_SIZE);
++	    authtok = strncpy(authtok_buf, void_pass, sizeof(authtok_buf));
+ 
+ 	  if (pipe(fds) != 0)
+ 	    {
+