]> granicus.if.org Git - shadow/commitdiff
* lib/prototypes.h, libmisc/addgrps.c: restrict add_groups() to
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 5 Apr 2009 22:29:42 +0000 (22:29 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 5 Apr 2009 22:29:42 +0000 (22:29 +0000)
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.

ChangeLog
lib/prototypes.h
libmisc/addgrps.c
libmisc/age.c
libmisc/pwd2spwd.c

index db4c63c1b640f5cb9fb36da9f97820eba39458b8..cff4162d03e6e5f48e95b36b1d040187cd0d477c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2009-04-06  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * 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.
+
 2009-04-05  Nicolas François  <nicolas.francois@centraliens.net>
 
        * src/passwd.c: do_update_age is only used ifndef USE_PAM. Make it
index bf86ca28a468ac6536e0a813b0762de22da5d3db..dbb7801aeea869ef6c14989ec8c065be010ca1f8 100644 (file)
@@ -60,8 +60,9 @@
 extern char *Prog;
 
 /* addgrps.c */
+#if defined (HAVE_SETGROUPS) && ! defined (USE_PAM)
 extern int add_groups (const char *);
-extern void add_cons_grps (void);
+#endif
 
 /* age.c */
 extern void agecheck (const struct passwd *, const struct spwd *);
@@ -231,7 +232,9 @@ extern void do_pam_passwd (const char *user, bool silent, bool change_expired);
 extern bool isttytime (const char *, const char *, time_t);
 
 /* pwd2spwd.c */
+#ifdef USE_PAM
 extern struct spwd *pwd_to_spwd (const struct passwd *);
+#endif
 
 /* pwdcheck.c */
 #ifndef USE_PAM
@@ -259,7 +262,11 @@ extern char *crypt_make_salt (const char *meth, void *arg);
 /* setugid.c */
 extern int setup_groups (const struct passwd *info);
 extern int change_uid (const struct passwd *info);
+#if (defined HAVE_INITGROUPS) && (! defined USE_PAM)
 extern int setup_uid_gid (const struct passwd *info, bool is_console);
+#else
+extern int setup_uid_gid (const struct passwd *info);
+#endif
 
 /* setup.c */
 extern void setup (struct passwd *);
index 80ac01871a7583bce4628831fa621e2238626b6e..1d0356fa64ffc7b5c3b7cd68aeb7afbcf1444efd 100644 (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 */
 
index 25463a67a1ed7232a06bb7781a79fbb4ecc41d37..de69ae307bb5cbdf3d0bfa3c900df035825adc29 100644 (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;
        }
 
        /*
index e75eb4e55b86c0bf5f262a705d8c51708a9bb38e..c1b9b29ac873ac11c731446a6625443251594d92 100644 (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 */
+