diff --git a/src/modules/system/passwords.c b/src/modules/system/passwords.c index 4bcafe7147ce7a54d34e9a1e672bb3d56ec8e0a2..e647773867ac9425081c79db399f2a8574472334 100644 --- a/src/modules/system/passwords.c +++ b/src/modules/system/passwords.c @@ -1,5 +1,5 @@ /* - * $Id: passwords.c,v 1.27 1999/05/26 17:56:56 grubba Exp $ + * $Id: passwords.c,v 1.28 1999/05/27 18:31:30 grubba Exp $ * * Password handling for Pike. * @@ -22,7 +22,7 @@ #include "system_machine.h" #include "system.h" -RCSID("$Id: passwords.c,v 1.27 1999/05/26 17:56:56 grubba Exp $"); +RCSID("$Id: passwords.c,v 1.28 1999/05/27 18:31:30 grubba Exp $"); #include "module_support.h" #include "interpret.h" @@ -123,7 +123,7 @@ void push_pwent(struct passwd *ent) SAFE_PUSH_TEXT(ent->pw_name); #if defined(HAVE_GETSPNAM) || defined(HAVE_GETSPNAM_R) - if(!strcmp(ent->pw_passwd, "x") && !getuid()) + if(!strcmp(ent->pw_passwd, "x")) { /* 64-bit Solaris 7 SIGSEGV's with an access to address 0xffffffff * if the user is not root: @@ -148,9 +148,24 @@ void push_pwent(struct passwd *ent) * /grubba 1999-05-26 */ static char buffer[2048]; + THREADS_ALLOW_UID(); + +#ifdef HAVE_SOLARIS_GETSPNAM_R foo = getspnam_r(ent->pw_name, &bar, buffer, sizeof(buffer)); +#else /* !HAVE_SOLARIS_GETSPNAM_R */ + /* Assume Linux-style getspnam_r(). + * It would be nice if the function was documented... + * /grubba 1999-05-27 + */ + foo = NULL; + if (getspnam_r(ent->pw_name, &bar, buffer, sizeof(buffer), &foo) < 0) { + foo = NULL; + } +#endif /* HAVE_SOLARIS_GETSPNAM_R */ + THREADS_DISALLOW_UID(); + #else /* !HAVE_GETSPNAM_R */ /* getspnam() is MT-unsafe! * /grubba 1999-05-26