2007-10-07 17:14:02 +05:30
|
|
|
/*
|
|
|
|
* prototypes.h
|
|
|
|
*
|
|
|
|
* Missing function prototypes
|
|
|
|
*
|
|
|
|
* Juha Virtanen, <jiivee@hut.fi>; November 1995
|
|
|
|
*/
|
|
|
|
/*
|
2007-11-11 05:16:11 +05:30
|
|
|
* $Id$
|
2007-10-07 17:14:02 +05:30
|
|
|
*
|
|
|
|
* Added a macro to work around ancient (non-ANSI) compilers, just in case
|
|
|
|
* someone ever tries to compile this with SunOS cc... --marekm
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _PROTOTYPES_H
|
|
|
|
#define _PROTOTYPES_H
|
|
|
|
|
|
|
|
#include <sys/stat.h>
|
2007-10-07 17:15:23 +05:30
|
|
|
#if HAVE_UTMPX_H
|
|
|
|
#include <utmpx.h>
|
|
|
|
#else
|
2007-10-07 17:14:02 +05:30
|
|
|
#include <utmp.h>
|
2007-10-07 17:15:23 +05:30
|
|
|
#endif
|
2007-10-07 17:14:02 +05:30
|
|
|
#include <pwd.h>
|
|
|
|
#include <grp.h>
|
* lib/prototypes.h, configure.in, libmisc/Makefile.am,
libmisc/xgetXXbyYY.c, libmisc/xgetpwnam.c, libmisc/xgetpwuid.c,
libmisc/xgetgrnam.c, libmisc/xgetgrgid.c, libmisc/xgetspnam.c:
Added functions xgetpwnam(), xgetpwuid(), xgetgrnam(),
xgetgrgid(), and xgetspnam(). They allocate memory for the
returned structure and are more robust to successive calls. They
are implemented with the libc's getxxyyy_r() functions if
available.
* libmisc/limits.c, libmisc/entry.c, libmisc/chowntty.c,
libmisc/addgrps.c, libmisc/myname.c, libmisc/rlogin.c,
libmisc/pwdcheck.c, src/newgrp.c, src/login_nopam.c,
src/userdel.c, src/lastlog.c, src/grpck.c, src/gpasswd.c,
src/newusers.c, src/chpasswd.c, src/chfn.c, src/groupmems.c,
src/usermod.c, src/expiry.c, src/groupdel.c, src/chgpasswd.c,
src/su.c, src/useradd.c, src/groupmod.c, src/passwd.c, src/pwck.c,
src/groupadd.c, src/chage.c, src/login.c, src/suauth.c,
src/faillog.c, src/groups.c, src/chsh.c, src/id.c: Review all the
usage of one of the getpwnam(), getpwuid(), getgrnam(),
getgrgid(), and getspnam() functions. It was noticed on
http://bugs.debian.org/341230 that chfn and chsh use a passwd
structure after calling a pam function, which result in using
information from the passwd structure requested by pam, not the
original one. It is much easier to use the new xget... functions
to avoid these issues. I've checked which call to the original
get... functions could be left (reducing the scope of the
structure if possible), and I've left comments to ease future
reviews (e.g. /* local, no need for xgetpwnam */).
Note: the getpwent/getgrent calls should probably be checked also.
* src/groupdel.c, src/expiry.c: Fix typos in comments.
* src/groupmod.c: Re-indent.
* libmisc/Makefile.am, lib/groupmem.c, lib/groupio.c, lib/pwmem.c,
lib/pwio.c, lib/shadowmem.c, lib/shadowio.c: Move the __<xx>_dup
functions (used by the xget... functions) from the <xx>io.c files
to the new <xx>mem.c files. This avoid linking some utils against
the SELinux library.
2007-11-19 04:45:26 +05:30
|
|
|
#include "shadowio.h"
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
#include "defines.h"
|
|
|
|
|
|
|
|
/* addgrps.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern int add_groups (const char *);
|
|
|
|
extern void add_cons_grps (void);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* age.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern void agecheck (const struct passwd *, const struct spwd *);
|
|
|
|
extern int expire (const struct passwd *, const struct spwd *);
|
|
|
|
extern int isexpired (const struct passwd *, const struct spwd *);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* basename() renamed to Basename() to avoid libc name space confusion */
|
|
|
|
/* basename.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern char *Basename (char *str);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* chowndir.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern int chown_tree (const char *, uid_t, uid_t, gid_t, gid_t);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* chowntty.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern void chown_tty (const char *, const struct passwd *);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* console.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern int console (const char *);
|
|
|
|
extern int is_listed (const char *, const char *, int);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* copydir.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern int copy_tree (const char *, const char *, uid_t, gid_t);
|
|
|
|
extern int remove_tree (const char *);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* encrypt.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern char *pw_encrypt (const char *, const char *);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* entry.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern void pw_entry (const char *, struct passwd *);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* env.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern void addenv (const char *, const char *);
|
|
|
|
extern void initenv (void);
|
|
|
|
extern void set_env (int, char *const *);
|
|
|
|
extern void sanitize_env (void);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* fields.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern void change_field (char *, size_t, const char *);
|
|
|
|
extern int valid_field (const char *, const char *);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* fputsx.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern char *fgetsx (char *, int, FILE *);
|
|
|
|
extern int fputsx (const char *, FILE *);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* grent.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern int putgrent (const struct group *, FILE *);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* hushed.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern int hushed (const struct passwd *);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
2007-10-07 17:17:01 +05:30
|
|
|
/* audit_help.c */
|
|
|
|
#ifdef WITH_AUDIT
|
|
|
|
extern int audit_fd;
|
2007-10-07 17:17:22 +05:30
|
|
|
extern void audit_help_open (void);
|
|
|
|
extern void audit_logger (int type, const char *pgname, const char *op,
|
|
|
|
const char *name, unsigned int id, int result);
|
2007-10-07 17:17:01 +05:30
|
|
|
#endif
|
|
|
|
|
2007-10-07 17:14:02 +05:30
|
|
|
/* limits.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern void setup_limits (const struct passwd *);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* list.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern char **add_list (char **, const char *);
|
|
|
|
extern char **del_list (char **, const char *);
|
|
|
|
extern char **dup_list (char *const *);
|
|
|
|
extern int is_on_list (char *const *, const char *);
|
|
|
|
extern char **comma_to_list (const char *);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* login.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern void login_prompt (const char *, char *, int);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* mail.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern void mailcheck (void);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* motd.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern void motd (void);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* myname.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern struct passwd *get_my_pwent (void);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* obscure.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern int obscure (const char *, const char *, const struct passwd *);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* pam_pass.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern int do_pam_passwd (const char *, int, int);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* port.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern int isttytime (const char *, const char *, time_t);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* pwd2spwd.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern struct spwd *pwd_to_spwd (const struct passwd *);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* pwdcheck.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern void passwd_check (const char *, const char *, const char *);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* pwd_init.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern void pwd_init (void);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* rlogin.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern int do_rlogin (const char *, char *, int, char *, int);
|
2007-10-07 17:14:14 +05:30
|
|
|
|
|
|
|
/* salt.c */
|
2007-11-20 15:03:52 +05:30
|
|
|
extern char *crypt_make_salt (char *meth, void *arg);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* setugid.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern int setup_groups (const struct passwd *);
|
|
|
|
extern int change_uid (const struct passwd *);
|
|
|
|
extern int setup_uid_gid (const struct passwd *, int);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* setup.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern void setup (struct passwd *);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* setupenv.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern void setup_env (struct passwd *);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* shell.c */
|
2007-10-07 17:17:22 +05:30
|
|
|
extern int shell (const char *, const char *, char *const *);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* strtoday.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern long strtoday (const char *);
|
2007-10-07 17:14:14 +05:30
|
|
|
|
|
|
|
/* suauth.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern int check_su_auth (const char *, const char *);
|
2007-10-07 17:14:14 +05:30
|
|
|
|
|
|
|
/* sulog.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern void sulog (const char *, int, const char *, const char *);
|
2007-10-07 17:14:14 +05:30
|
|
|
|
|
|
|
/* sub.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern void subsystem (const struct passwd *);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* ttytype.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern void ttytype (const char *);
|
2007-10-07 17:14:14 +05:30
|
|
|
|
|
|
|
/* tz.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern char *tz (const char *);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* ulimit.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern void set_filesize_limit (int);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* utmp.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern void checkutmp (int);
|
|
|
|
extern void setutmp (const char *, const char *, const char *);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* valid.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern int valid (const char *, const struct passwd *);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/* xmalloc.c */
|
2007-10-07 17:16:07 +05:30
|
|
|
extern char *xmalloc (size_t);
|
|
|
|
extern char *xstrdup (const char *);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
* lib/prototypes.h, configure.in, libmisc/Makefile.am,
libmisc/xgetXXbyYY.c, libmisc/xgetpwnam.c, libmisc/xgetpwuid.c,
libmisc/xgetgrnam.c, libmisc/xgetgrgid.c, libmisc/xgetspnam.c:
Added functions xgetpwnam(), xgetpwuid(), xgetgrnam(),
xgetgrgid(), and xgetspnam(). They allocate memory for the
returned structure and are more robust to successive calls. They
are implemented with the libc's getxxyyy_r() functions if
available.
* libmisc/limits.c, libmisc/entry.c, libmisc/chowntty.c,
libmisc/addgrps.c, libmisc/myname.c, libmisc/rlogin.c,
libmisc/pwdcheck.c, src/newgrp.c, src/login_nopam.c,
src/userdel.c, src/lastlog.c, src/grpck.c, src/gpasswd.c,
src/newusers.c, src/chpasswd.c, src/chfn.c, src/groupmems.c,
src/usermod.c, src/expiry.c, src/groupdel.c, src/chgpasswd.c,
src/su.c, src/useradd.c, src/groupmod.c, src/passwd.c, src/pwck.c,
src/groupadd.c, src/chage.c, src/login.c, src/suauth.c,
src/faillog.c, src/groups.c, src/chsh.c, src/id.c: Review all the
usage of one of the getpwnam(), getpwuid(), getgrnam(),
getgrgid(), and getspnam() functions. It was noticed on
http://bugs.debian.org/341230 that chfn and chsh use a passwd
structure after calling a pam function, which result in using
information from the passwd structure requested by pam, not the
original one. It is much easier to use the new xget... functions
to avoid these issues. I've checked which call to the original
get... functions could be left (reducing the scope of the
structure if possible), and I've left comments to ease future
reviews (e.g. /* local, no need for xgetpwnam */).
Note: the getpwent/getgrent calls should probably be checked also.
* src/groupdel.c, src/expiry.c: Fix typos in comments.
* src/groupmod.c: Re-indent.
* libmisc/Makefile.am, lib/groupmem.c, lib/groupio.c, lib/pwmem.c,
lib/pwio.c, lib/shadowmem.c, lib/shadowio.c: Move the __<xx>_dup
functions (used by the xget... functions) from the <xx>io.c files
to the new <xx>mem.c files. This avoid linking some utils against
the SELinux library.
2007-11-19 04:45:26 +05:30
|
|
|
/* xgetpwnam.c */
|
|
|
|
extern struct passwd *xgetpwnam (const char *);
|
|
|
|
/* xgetpwuid.c */
|
|
|
|
extern struct passwd *xgetpwuid (uid_t);
|
|
|
|
/* xgetgrnam.c */
|
|
|
|
extern struct group *xgetgrnam (const char *);
|
|
|
|
/* xgetgrgid.c */
|
|
|
|
extern struct group *xgetgrgid (gid_t);
|
|
|
|
/* xgetspnam.c */
|
|
|
|
extern struct spwd *xgetspnam(const char *);
|
|
|
|
|
2007-10-07 17:16:07 +05:30
|
|
|
#endif /* _PROTOTYPES_H */
|