On systems without 'setfsuid', use 'setreuid' instead. The patch originates from the Debian project for GNU/Hurd. Authors: Steve Langasek Upstream status: A ticket was opened to request apply the patch, ticket: 'https://fedorahosted.org/linux-pam/ticket/64'. --- Linux-PAM-1.2.1/libpam/pam_modutil_priv.c 2015-03-24 06:02:32.000000000 -0600 +++ pam_modutil_priv-mod.c 2016-09-20 13:36:53.150663205 -0500 @@ -14,7 +14,9 @@ #include #include #include +#ifdef HAVE_SYS_FSUID_H #include +#endif /* HAVE_SYS_FSUID_H */ /* * Two setfsuid() calls in a row are necessary to check @@ -22,17 +24,55 @@ */ static int change_uid(uid_t uid, uid_t *save) { +#ifdef HAVE_SYS_FSUID_H uid_t tmp = setfsuid(uid); if (save) *save = tmp; return (uid_t) setfsuid(uid) == uid ? 0 : -1; +#else + uid_t euid = geteuid(); + uid_t ruid = getuid(); + if (save) + *save = ruid; + if (ruid == uid && uid != 0) + if (setreuid(euid, uid)) + return -1; + else { + setreuid(0, -1); + if (setreuid(-1, uid)) { + setreuid(-1, 0); + setreuid(0, -1); + if (setreuid(-1, uid)) + return -1; + } + } +#endif } static int change_gid(gid_t gid, gid_t *save) { +#ifdef HAVE_SYS_FSUID_H gid_t tmp = setfsgid(gid); if (save) *save = tmp; return (gid_t) setfsgid(gid) == gid ? 0 : -1; +#else + gid_t egid = getegid(); + gid_t rgid = getgid(); + if (save) + *save = rgid; + if (rgid == gid) + if (setregid(egid, gid)) + return -1; + else { + setregid(0, -1); + if (setregid(-1, gid)) { + setregid(-1, 0); + setregid(0, -1); + if (setregid(-1, gid)) + return -1; + } + } +#endif } static int cleanup(struct pam_modutil_privs *p) 'right' method='get' action='/guix/log/gnu/packages/aux-files/linux-libre/5.2-arm64.conf'>
AgeCommit message (Expand)Author
2019-07-14gnu: linux-libre: Update to 5.2....* gnu/packages/linux.scm (%linux-libre-version): Update to 5.2. (%linux-libre-hash): Update hash. * linux-libre-5.1: Rename to ... * linux-libre-5.2: ... this. Use %linux-libre-5.2-patches. * linux-libre: Switch to linux-libre-5.2. * linux-libre-arm-veyron, linux-libre-arm-generic, linux-libre-arm-omap2plus: Use %linux-libre-5.2-patches. * linux-libre-headers-5.1: Rename to ... * linux-libre-headers-5.2: ... this. * %linux-libre-5.1-patches: Rename to ... * %linux-libre-5.2-patches: ... this. * gnu/packages/aux-files/linux-libre/5.1-arm-veyron.conf, gnu/packages/aux-files/linux-libre/5.1-arm.conf, gnu/packages/aux-files/linux-libre/5.1-arm64.conf, gnu/packages/aux-files/linux-libre/5.1-i686.conf, gnu/packages/aux-files/linux-libre/5.1-x86_64.conf: Delete files. * gnu/packages/aux-files/linux-libre/5.2-arm-veyron.conf, gnu/packages/aux-files/linux-libre/5.2-arm.conf, gnu/packages/aux-files/linux-libre/5.2-arm64.conf, gnu/packages/aux-files/linux-libre/5.2-i686.conf, gnu/packages/aux-files/linux-libre/5.2-x86_64.conf: New files. * Makefile.am (AUX_FILES): Update accordingly. Mark H Weaver