* libmisc/utmp.c: Reworked. Get rid of Linux specific stuff. Get rid

of global utent/utxent variables. Only reuse the ut_id and maybe
	the ut_host fields from utmp.
	* lib/prototypes.h, libmisc/utmp.c: Removed checkutmp(),
	setutmp(), setutmpx().
	* lib/prototypes.h, libmisc/utmp.c: Added get_current_utmp(),
	prepare_utmp(), prepare_utmpx(), setutmp(), setutmpx().
	* libmisc/utmp.c (is_my_tty): Only compare the name of the utmp
	line with ttyname(). (No stat of the two terminals to compare the
	devices).
	* libmisc/utmp.c: Use getaddrinfo() to get the address of the
	host.
	* configure.in: Check for getaddrinfo().
	* configure.in: Use AC_CHECK_MEMBERS to check for the existence of
	fields in the utmp/utmpx structures.
	* configure.in: Reject systems with utmpx support but no ut_id
	field in utmp. This could be fixed later if needed.
	* src/login.c: Use the new utmp functions. This also simplifies
	the failtmp() handling.
	* src/login.c: passwd_free() renamed to pw_free() and
	shadow_free() renamed to spw_free()
This commit is contained in:
nekral-guest
2009-04-21 22:39:14 +00:00
parent fcfa81283e
commit 82c1a583f8
4 changed files with 384 additions and 421 deletions

View File

@ -345,8 +345,19 @@ extern char *tz (const char *);
extern int set_filesize_limit (int blocks);
/* utmp.c */
extern void checkutmp (bool picky);
extern int setutmp (const char *, const char *, const char *);
extern struct utmp *get_current_utmp (void);
extern struct utmp *prepare_utmp (const char *name,
const char *line,
const char *host,
struct utmp *ut);
extern int setutmp (struct utmp *ut);
#ifdef HAVE_UTMPX_H
extern struct utmpx *prepare_utmpx (const char *name,
const char *line,
const char *host,
struct utmp *ut);
extern int setutmpx (struct utmpx *utx);
#endif
/* valid.c */
extern bool valid (const char *, const struct passwd *);