From 569a3b8e59fefd6a6c2c4c9377669b93fd84363c Mon Sep 17 00:00:00 2001 From: nekral-guest Date: Sun, 6 Jan 2008 11:59:01 +0000 Subject: [PATCH] * libmisc/console.c, libmisc/ulimit.c, lib/sgetgrent.c, lib/sgetpwent.c: Include "prototypes.h" to make sure the exported prototypes are the ones used for the definition of functions. * lib/prototypes.h: Added prototypes for __gr_del_entry(), __gr_get_db(), __gr_get_head(), __gr_set_changed(), __gr_dup(), __pw_del_entry(), __pw_get_db(), __pw_get_head(), __pw_dup(), sgetgrent(), sgetpwent(), __sgr_del_entry(), __sgr_dup(), __sgr_get_head(), __sgr_set_changed(), __spw_get_head(), __spw_del_entry(), __spw_dup(). * lib/prototypes.h: Removed prototype for is_listed(). * lib/prototypes.h: Added name of the check_su_auth()'s parameters. * lib/groupio.h: Removed prototypes for __gr_dup() and __gr_set_changed(). * lib/sgroupio.c: Removed prototypes for putsgent(), sgetsgent(), and __gr_get_db(). * lib/sgroupio.h: Removed prototypes for __sgr_dup() and __sgr_set_changed(). * lib/shadowio.c: Removed prototype for __pw_get_db(). * lib/pwio.c: Removed prototype for sgetpwent() and putpwent(). * lib/shadowio.h: Removed prototypes for __spw_dup() and __spw_set_changed(). * lib/pwio.h: Removed prototypes for __pw_dup() and __pw_set_changed(). * lib/commonio.h: Add protection against multiple inclusions. * lib/prototypes.h: Include commonio.h (needed for the __xx_del_entry() functions). --- ChangeLog | 30 ++++++++++++++++++++++++++++++ lib/commonio.h | 4 ++++ lib/prototypes.h | 44 ++++++++++++++++++++++++++++++++++++++++---- lib/pwio.c | 2 -- lib/pwio.h | 2 -- lib/sgetgrent.c | 3 +++ lib/sgetpwent.c | 3 +++ lib/sgroupio.c | 4 ---- lib/sgroupio.h | 2 -- lib/shadowio.c | 2 -- lib/shadowio.h | 2 -- libmisc/console.c | 1 + libmisc/ulimit.c | 2 ++ 13 files changed, 83 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2f1a336f..43483993 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,33 @@ +2008-01-06 Nicolas François + + * libmisc/console.c, libmisc/ulimit.c, lib/sgetgrent.c, + lib/sgetpwent.c: Include "prototypes.h" to make + sure the exported prototypes are the ones used for the definition + of functions. + * lib/prototypes.h: Added prototypes for __gr_del_entry(), + __gr_get_db(), __gr_get_head(), __gr_set_changed(), __gr_dup(), + __pw_del_entry(), __pw_get_db(), __pw_get_head(), __pw_dup(), + sgetgrent(), sgetpwent(), __sgr_del_entry(), __sgr_dup(), + __sgr_get_head(), __sgr_set_changed(), __spw_get_head(), + __spw_del_entry(), __spw_dup(). + * lib/prototypes.h: Removed prototype for is_listed(). + * lib/prototypes.h: Added name of the check_su_auth()'s parameters. + * lib/groupio.h: Removed prototypes for __gr_dup() and + __gr_set_changed(). + * lib/sgroupio.c: Removed prototypes for putsgent(), sgetsgent(), + and __gr_get_db(). + * lib/sgroupio.h: Removed prototypes for __sgr_dup() and + __sgr_set_changed(). + * lib/shadowio.c: Removed prototype for __pw_get_db(). + * lib/pwio.c: Removed prototype for sgetpwent() and putpwent(). + * lib/shadowio.h: Removed prototypes for __spw_dup() and + __spw_set_changed(). + * lib/pwio.h: Removed prototypes for __pw_dup() and + __pw_set_changed(). + * lib/commonio.h: Add protection against multiple inclusions. + * lib/prototypes.h: Include commonio.h (needed for the + __xx_del_entry() functions). + 2008-01-05 Nicolas François * man/groupadd.8.xml, man/groupmod.8.xml: Add documentation for diff --git a/lib/commonio.h b/lib/commonio.h index ae9deb92..ced92a3b 100644 --- a/lib/commonio.h +++ b/lib/commonio.h @@ -1,4 +1,6 @@ /* $Id$ */ +#ifndef _COMMONIO_H +#define _COMMONIO_H #ifdef WITH_SELINUX #include @@ -117,3 +119,5 @@ extern int commonio_sort_wrt (struct commonio_db *shadow, struct commonio_db *passwd); extern int commonio_sort (struct commonio_db *db, int (*cmp) (const void *, const void *)); + +#endif diff --git a/lib/prototypes.h b/lib/prototypes.h index c5a73019..97a81a35 100644 --- a/lib/prototypes.h +++ b/lib/prototypes.h @@ -1,7 +1,7 @@ /* * prototypes.h * - * lib and libmisc function prototypes + * prototypes of libmisc functions, and private lib functions. * * $Id$ * @@ -22,6 +22,7 @@ #include #include "defines.h" +#include "commonio.h" /* addgrps.c */ extern int add_groups (const char *); @@ -44,7 +45,6 @@ extern void chown_tty (const char *, const struct passwd *); /* console.c */ extern int console (const char *); -extern int is_listed (const char *, const char *, int); /* copydir.c */ extern int copy_tree (const char *src_root, const char *dst_root, @@ -74,6 +74,15 @@ extern int getlong(const char *numstr, long int *result); extern char *fgetsx (char *, int, FILE *); extern int fputsx (const char *, FILE *); +/* groupio.c */ +extern void __gr_del_entry (const struct commonio_entry *ent); +extern struct commonio_db *__gr_get_db (void); +extern struct commonio_entry *__gr_get_head (void); +extern void __gr_set_changed (void); + +/* groupmem.c */ +extern struct group *__gr_dup (const struct group *grent); + /* hushed.c */ extern int hushed (const struct passwd *); @@ -131,11 +140,19 @@ extern void passwd_check (const char *, const char *, const char *); /* pwd_init.c */ extern void pwd_init (void); +/* pwio.c */ +extern void __pw_del_entry (const struct commonio_entry *ent); +extern struct commonio_db *__pw_get_db (void); +extern struct commonio_entry *__pw_get_head (void); + +/* pwmem.c */ +extern struct passwd *__pw_dup (const struct passwd *pwent); + /* rlogin.c */ extern int do_rlogin (const char *, char *, int, char *, int); /* salt.c */ -extern char *crypt_make_salt (char *meth, void *arg); +extern char *crypt_make_salt (const char *meth, void *arg); /* setugid.c */ extern int setup_groups (const struct passwd *); @@ -148,6 +165,25 @@ extern void setup (struct passwd *); /* setupenv.c */ extern void setup_env (struct passwd *); +/* sgetgrent.c */ +extern struct group *sgetgrent (const char *buf); + +/* sgetpwent.c */ +extern struct passwd *sgetpwent (const char *buf); + +/* sgroupio.c */ +extern void __sgr_del_entry (const struct commonio_entry *ent); +extern struct sgrp *__sgr_dup (const struct sgrp *sgent); +extern struct commonio_entry *__sgr_get_head (void); +extern void __sgr_set_changed (void); + +/* shadowio.c */ +extern struct commonio_entry *__spw_get_head (void); +extern void __spw_del_entry (const struct commonio_entry *ent); + +/* shadowmem.c */ +extern struct spwd *__spw_dup (const struct spwd *spent); + /* shell.c */ extern int shell (const char *, const char *, char *const *); @@ -155,7 +191,7 @@ extern int shell (const char *, const char *, char *const *); extern long strtoday (const char *); /* suauth.c */ -extern int check_su_auth (const char *, const char *); +extern int check_su_auth (const char *actual_id, const char *wanted_id); /* sulog.c */ extern void sulog (const char *, int, const char *, const char *); diff --git a/lib/pwio.c b/lib/pwio.c index cbedb04b..8dd6d61a 100644 --- a/lib/pwio.c +++ b/lib/pwio.c @@ -9,8 +9,6 @@ #include #include "commonio.h" #include "pwio.h" -extern struct passwd *sgetpwent (const char *); -extern int putpwent (const struct passwd *, FILE *); static void *passwd_dup (const void *ent) { diff --git a/lib/pwio.h b/lib/pwio.h index 20118cfb..e060ed05 100644 --- a/lib/pwio.h +++ b/lib/pwio.h @@ -1,5 +1,3 @@ -extern struct passwd *__pw_dup (const struct passwd *); -extern void __pw_set_changed (void); extern int pw_close (void); extern const struct passwd *pw_locate (const char *); extern int pw_lock (void); diff --git a/lib/sgetgrent.c b/lib/sgetgrent.c index 83b95449..4189fb1b 100644 --- a/lib/sgetgrent.c +++ b/lib/sgetgrent.c @@ -34,7 +34,10 @@ #include #include #include "defines.h" +#include "prototypes.h" + #define NFIELDS 4 + /* * list - turn a comma-separated string into an array of (char *)'s * diff --git a/lib/sgetpwent.c b/lib/sgetpwent.c index 3dce6765..bf1ed614 100644 --- a/lib/sgetpwent.c +++ b/lib/sgetpwent.c @@ -35,7 +35,10 @@ #include "defines.h" #include #include +#include "prototypes.h" + #define NFIELDS 7 + /* * sgetpwent - convert a string to a (struct passwd) * diff --git a/lib/sgroupio.c b/lib/sgroupio.c index dad92f4c..1fd09e27 100644 --- a/lib/sgroupio.c +++ b/lib/sgroupio.c @@ -9,8 +9,6 @@ #include "defines.h" #include "commonio.h" #include "sgroupio.h" -extern int putsgent (const struct sgrp *, FILE *); -extern struct sgrp *sgetsgent (const char *); struct sgrp *__sgr_dup (const struct sgrp *sgent) { @@ -194,8 +192,6 @@ void __sgr_del_entry (const struct commonio_entry *ent) /* Sort with respect to group ordering. */ int sgr_sort () { - extern struct commonio_db *__gr_get_db (); - return commonio_sort_wrt (&gshadow_db, __gr_get_db ()); } #else diff --git a/lib/sgroupio.h b/lib/sgroupio.h index 90693b0f..095e5839 100644 --- a/lib/sgroupio.h +++ b/lib/sgroupio.h @@ -1,5 +1,3 @@ -extern struct sgrp *__sgr_dup (const struct sgrp *); -extern void __sgr_set_changed (void); extern int sgr_close (void); extern int sgr_file_present (void); extern const struct sgrp *sgr_locate (const char *); diff --git a/lib/shadowio.c b/lib/shadowio.c index 61b76ac1..12395c42 100644 --- a/lib/shadowio.c +++ b/lib/shadowio.c @@ -141,7 +141,5 @@ void __spw_del_entry (const struct commonio_entry *ent) /* Sort with respect to passwd ordering. */ int spw_sort () { - extern struct commonio_db *__pw_get_db (); - return commonio_sort_wrt (&shadow_db, __pw_get_db ()); } diff --git a/lib/shadowio.h b/lib/shadowio.h index d5866079..3dfdd67e 100644 --- a/lib/shadowio.h +++ b/lib/shadowio.h @@ -1,5 +1,3 @@ -extern struct spwd *__spw_dup (const struct spwd *); -extern void __spw_set_changed (void); extern int spw_close (void); extern int spw_file_present (void); extern const struct spwd *spw_locate (const char *); diff --git a/libmisc/console.c b/libmisc/console.c index 388587c4..073d0d8a 100644 --- a/libmisc/console.c +++ b/libmisc/console.c @@ -31,6 +31,7 @@ #include "defines.h" #include #include "getdef.h" +#include "prototypes.h" #ident "$Id$" diff --git a/libmisc/ulimit.c b/libmisc/ulimit.c index 549c2d38..35b3adee 100644 --- a/libmisc/ulimit.c +++ b/libmisc/ulimit.c @@ -16,6 +16,8 @@ /* XXX - is the above ok or should it be on ultrix? */ #include #endif +#include "prototypes.h" + void set_filesize_limit (int blocks) { #if HAVE_ULIMIT_H