Skip to content

Commit

Permalink
skip shadow call when euid > 0 on linux
Browse files Browse the repository at this point in the history
maybe __linux__ is not restrictive enough
and we could consider using a hint sh file
to enable it only on some specific distro?
  • Loading branch information
atoomic committed Jul 16, 2018
1 parent 032639c commit 2aed681
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pp_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <shadow.h> and often one needs to link
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 2aed681

Please sign in to comment.