From: Patrick O'Brien Date: Sat, 1 May 1999 19:41:17 +0000 (-0400) Subject: shadow password support for Solaris (needs Configure help to X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8c0bfa080e85353d7675b8b2fb1a04c6cc60cd5f;p=p5sagit%2Fp5-mst-13.2.git shadow password support for Solaris (needs Configure help to determine HAS_GETSPENT) Message-Id: <199905012341.TAA23989@optimus.cs.umd.edu> Subject: getpwent() under solaris p4raw-id: //depot/perl@3367 --- diff --git a/pp_sys.c b/pp_sys.c index a2c0b4c..1d1c849 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -17,6 +17,11 @@ #include "EXTERN.h" #include "perl.h" +#ifdef HAS_GETSPENT +/* Shadow password support for solaris - pdo@cs.umd.edu*/ +#include +#endif + /* XXX If this causes problems, set i_unistd=undef in the hint file. */ #ifdef I_UNISTD # include @@ -4548,6 +4553,9 @@ PP(pp_gpwent) register SV *sv; struct passwd *pwent; STRLEN n_a; +#ifdef HAS_GETSPENT + struct spwd *spwent; +#endif if (which == OP_GPWNAM) pwent = getpwnam(POPpx); @@ -4556,6 +4564,15 @@ PP(pp_gpwent) else pwent = (struct passwd *)getpwent(); +#ifdef HAS_GETSPENT + if (which == OP_GPWNAM) + spwent = getspnam(pwent->pw_name); + else if (which == OP_GPWUID) + spwent = getspnam(pwent->pw_name); + else + spwent = (struct spwd *)getspent(); +#endif + EXTEND(SP, 10); if (GIMME != G_ARRAY) { PUSHs(sv = sv_newmortal()); @@ -4574,8 +4591,15 @@ PP(pp_gpwent) PUSHs(sv = sv_mortalcopy(&PL_sv_no)); #ifdef PWPASSWD +#ifdef HAS_GETSPENT + if (spwent) + sv_setpv(sv, spwent->sp_pwdp); + else + sv_setpv(sv, pwent->pw_passwd); +#else sv_setpv(sv, pwent->pw_passwd); #endif +#endif PUSHs(sv = sv_mortalcopy(&PL_sv_no)); sv_setiv(sv, (IV)pwent->pw_uid); @@ -4638,6 +4662,9 @@ PP(pp_spwent) djSP; #if defined(HAS_PASSWD) && defined(HAS_SETPWENT) && !defined(CYGWIN32) setpwent(); +#ifdef HAS_GETSPENT + setspent(); +#endif RETPUSHYES; #else DIE(PL_no_func, "setpwent"); @@ -4649,6 +4676,9 @@ PP(pp_epwent) djSP; #if defined(HAS_PASSWD) && defined(HAS_ENDPWENT) endpwent(); +#ifdef HAS_GETSPENT + endspent(); +#endif RETPUSHYES; #else DIE(PL_no_func, "endpwent");