* lib/prototypes.h, libmisc/addgrps.c: restrict add_groups() to

ifndef USE_PAM.
	* lib/prototypes.h: Remove the declaration of add_cons_grps(). The
	function does not exist.
	* libmisc/age.c (setup_uid_gid): is_console is never set ifndef
	USE_PAM. Change the prototype of setup_uid_gid() when USE_PAM is
	not defined. This permits to remove add_groups from PAM builds.
	setup_uid_gid is already subject to HAVE_INITGROUPS.
	* libmisc/pwd2spwd.c (pwd_to_spwd): pwd_to_spwd() is not used in
	PAM builds.
This commit is contained in:
nekral-guest
2009-04-05 22:29:42 +00:00
parent 021066a980
commit a51954203e
5 changed files with 39 additions and 6 deletions

View File

@@ -32,7 +32,7 @@
#include <config.h>
#ifdef HAVE_SETGROUPS
#if defined (HAVE_SETGROUPS) && ! defined (USE_PAM)
#include "prototypes.h"
#include "defines.h"
@@ -121,5 +121,7 @@ int add_groups (const char *list)
return 0;
}
#endif
#else /* HAVE_SETGROUPS && !USE_PAM */
extern int errno; /* warning: ANSI C forbids an empty source file */
#endif /* HAVE_SETGROUPS && !USE_PAM */

View File

@@ -60,7 +60,7 @@ int expire (const struct passwd *pw, const struct spwd *sp)
pid_t pid;
if (NULL == sp) {
sp = pwd_to_spwd (pw);
return 0;
}
/*
@@ -126,7 +126,12 @@ int expire (const struct passwd *pw, const struct spwd *sp)
* passwd to work just like it would had they executed
* it from the command line while logged in.
*/
if (setup_uid_gid (pw, 0) != 0) {
#if defined(HAVE_INITGROUPS) && ! defined(USE_PAM)
if (setup_uid_gid (pw, false) != 0)
#else
if (setup_uid_gid (pw) != 0)
#endif
{
_exit (126);
}
@@ -161,7 +166,7 @@ void agecheck (const struct passwd *pw, const struct spwd *sp)
long remain;
if (NULL == sp) {
sp = pwd_to_spwd (pw);
return;
}
/*

View File

@@ -34,6 +34,8 @@
#ident "$Id$"
#ifndef USE_PAM
#include <sys/types.h>
#include "prototypes.h"
#include "defines.h"
@@ -83,3 +85,7 @@ struct spwd *pwd_to_spwd (const struct passwd *pw)
return &sp;
}
#else /* USE_PAM */
extern int errno; /* warning: ANSI C forbids an empty source file */
#endif /* !USE_PAM */