Skip to content

Commit 2aed681

Browse files
committed
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?
1 parent 032639c commit 2aed681

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pp_sys.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5436,6 +5436,9 @@ PP(pp_gpwent)
54365436
I32 which = PL_op->op_type;
54375437
SV *sv;
54385438
struct passwd *pwent = NULL;
5439+
#ifdef __linux__
5440+
const Uid_t euid = geteuid();
5441+
#endif
54395442
/*
54405443
* We currently support only the SysV getsp* shadow password interface.
54415444
* The interface is declared in <shadow.h> and often one needs to link
@@ -5562,7 +5565,11 @@ PP(pp_gpwent)
55625565
* --jhi */
55635566
/* Some AIX setups falsely(?) detect some getspnam(), which
55645567
* has a different API than the Solaris/IRIX one. */
5568+
55655569
# if defined(HAS_GETSPNAM) && !defined(_AIX)
5570+
# ifdef __linux__
5571+
if (!PerlProc_geteuid())
5572+
# endif
55665573
{
55675574
dSAVE_ERRNO;
55685575
const struct spwd * const spwent = getspnam(pwent->pw_name);

0 commit comments

Comments
 (0)