From 2aed68110f69e7b44ac068552bcfc2b5f8e066a7 Mon Sep 17 00:00:00 2001 From: Nicolas R Date: Mon, 16 Jul 2018 11:26:59 -0600 Subject: [PATCH] skip shadow call when euid > 0 on linux maybe __linux__ is not restrictive enough and we could consider using a hint sh file to enable it only on some specific distro? --- pp_sys.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pp_sys.c b/pp_sys.c index 4ae475d460fa1..7b393c703c156 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -5436,6 +5436,9 @@ PP(pp_gpwent) I32 which = PL_op->op_type; SV *sv; struct passwd *pwent = NULL; +#ifdef __linux__ + const Uid_t euid = geteuid(); +#endif /* * We currently support only the SysV getsp* shadow password interface. * The interface is declared in and often one needs to link @@ -5562,7 +5565,11 @@ PP(pp_gpwent) * --jhi */ /* Some AIX setups falsely(?) detect some getspnam(), which * has a different API than the Solaris/IRIX one. */ + # if defined(HAS_GETSPNAM) && !defined(_AIX) +# ifdef __linux__ + if (!PerlProc_geteuid()) +# endif { dSAVE_ERRNO; const struct spwd * const spwent = getspnam(pwent->pw_name);