diff options
-rw-r--r-- | pp_sys.c | 80 |
1 files changed, 37 insertions, 43 deletions
@@ -4773,44 +4773,41 @@ PP(pp_gpwent) struct passwd *pwent = NULL; /* We do not use HAS_GETSPENT in pp_gpwent() but leave it here in the case * somebody wants to write an XS to access the shadow passwords. --jhi */ -#ifdef HAS_GETSPNAM +# ifdef HAS_GETSPNAM struct spwd *spwent = NULL; -#endif +# endif switch (which) { case OP_GPWNAM: pwent = getpwnam(POPpx); -#ifdef HAS_GETSPNAM - if (pwent) - spwent = getspnam(pwent->pw_name); -#endif break; case OP_GPWUID: pwent = getpwuid((Uid_t)POPi); break; case OP_GPWENT: -#ifdef HAS_GETPWENT +# ifdef HAS_GETPWENT pwent = getpwent(); -#else +# else DIE(aTHX_ PL_no_fun, "getpwent"); -#endif -#ifdef HAS_GETSPNAM - if (pwent) - spwent = getspnam(pwent->pw_name); -#endif +# endif break; } +# ifdef HAS_GETSPNAM + if (GIMME != G_ARRAY && pwent) + spwent = getspnam(pwent->pw_name); +# endif + EXTEND(SP, 10); if (GIMME != G_ARRAY) { PUSHs(sv = sv_newmortal()); if (pwent) { if (which == OP_GPWNAM) -#if Uid_t_sign <= 0 +# if Uid_t_sign <= 0 sv_setiv(sv, (IV)pwent->pw_uid); -#else +# else sv_setuv(sv, (UV)pwent->pw_uid); -#endif +# endif else sv_setpv(sv, pwent->pw_name); } @@ -4822,7 +4819,6 @@ PP(pp_gpwent) sv_setpv(sv, pwent->pw_name); PUSHs(sv = sv_mortalcopy(&PL_sv_no)); -#ifdef PWPASSWD # ifdef HAS_GETSPNAM if (spwent) sv_setpv(sv, spwent->sp_pwdp); @@ -4831,72 +4827,70 @@ PP(pp_gpwent) # else sv_setpv(sv, pwent->pw_passwd); # endif -#endif -#ifndef INCOMPLETE_TAINTS +# ifndef INCOMPLETE_TAINTS /* passwd is tainted because user himself can diddle with it. */ SvTAINTED_on(sv); -#endif +# endif PUSHs(sv = sv_mortalcopy(&PL_sv_no)); -#if Uid_t_sign <= 0 +# if Uid_t_sign <= 0 sv_setiv(sv, (IV)pwent->pw_uid); -#else +# else sv_setuv(sv, (UV)pwent->pw_uid); -#endif +# endif PUSHs(sv = sv_mortalcopy(&PL_sv_no)); -#if Uid_t_sign <= 0 +# if Uid_t_sign <= 0 sv_setiv(sv, (IV)pwent->pw_gid); -#else +# else sv_setuv(sv, (UV)pwent->pw_gid); -#endif +# endif /* pw_change, pw_quota, and pw_age are mutually exclusive. */ PUSHs(sv = sv_mortalcopy(&PL_sv_no)); -#ifdef PWCHANGE +# ifdef PWCHANGE sv_setiv(sv, (IV)pwent->pw_change); -#else -# ifdef PWQUOTA - sv_setiv(sv, (IV)pwent->pw_quota); # else +# ifdef PWQUOTA + sv_setiv(sv, (IV)pwent->pw_quota); +# else # ifdef PWAGE sv_setpv(sv, pwent->pw_age); # endif # endif -#endif /* pw_class and pw_comment are mutually exclusive. */ PUSHs(sv = sv_mortalcopy(&PL_sv_no)); -#ifdef PWCLASS +# ifdef PWCLASS sv_setpv(sv, pwent->pw_class); -#else -# ifdef PWCOMMENT +# else +# ifdef PWCOMMENT sv_setpv(sv, pwent->pw_comment); +# endif # endif -#endif PUSHs(sv = sv_mortalcopy(&PL_sv_no)); -#ifdef PWGECOS +# ifdef PWGECOS sv_setpv(sv, pwent->pw_gecos); -#endif -#ifndef INCOMPLETE_TAINTS +# endif +# ifndef INCOMPLETE_TAINTS /* pw_gecos is tainted because user himself can diddle with it. */ SvTAINTED_on(sv); -#endif +# endif PUSHs(sv = sv_mortalcopy(&PL_sv_no)); sv_setpv(sv, pwent->pw_dir); PUSHs(sv = sv_mortalcopy(&PL_sv_no)); sv_setpv(sv, pwent->pw_shell); -#ifndef INCOMPLETE_TAINTS +# ifndef INCOMPLETE_TAINTS /* pw_shell is tainted because user himself can diddle with it. */ SvTAINTED_on(sv); -#endif +# endif -#ifdef PWEXPIRE +# ifdef PWEXPIRE PUSHs(sv = sv_mortalcopy(&PL_sv_no)); sv_setiv(sv, (IV)pwent->pw_expire); -#endif +# endif } RETURN; #else |