summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorPatrick O'Brien <pdo@cs.umd.edu>1999-05-01 15:41:17 -0400
committerGurusamy Sarathy <gsar@cpan.org>1999-05-10 09:55:51 +0000
commit8c0bfa080e85353d7675b8b2fb1a04c6cc60cd5f (patch)
tree98ee070e34766de99e675c55b26f2ff6245c7176 /pp_sys.c
parent2aea4d4064eddefd1fbe7babfc1d07fc273740b9 (diff)
downloadperl-8c0bfa080e85353d7675b8b2fb1a04c6cc60cd5f.tar.gz
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
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/pp_sys.c b/pp_sys.c
index a2c0b4cf2d..1d1c849271 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 <shadow.h>
+#endif
+
/* XXX If this causes problems, set i_unistd=undef in the hint file. */
#ifdef I_UNISTD
# include <unistd.h>
@@ -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");