- (djm) More SunOS 4.1.x fixes from Nate Itkin <nitkin@europa.com>

This commit is contained in:
Damien Miller 2000-08-15 10:01:22 +10:00
parent ef7ed5eadf
commit 348c9b7a95
6 changed files with 43 additions and 13 deletions

View File

@ -49,6 +49,7 @@ Marc G. Fournier <marc.fournier@acadiau.ca> - Solaris patches
Matt Richards <v2matt@btv.ibm.com> - AIX patches
Michael Stone <mstone@cs.loyola.edu> - Irix enhancements
Nalin Dahyabhai <nalin.dahyabhai@pobox.com> - PAM environment patch
Nate Itkin <nitkin@europa.com> - SunOS 4.1.x fixes
Niels Kristian Bech Jensen <nkbj@image.dk> - Assorted patches
Peter Kocks <peter.kocks@baygate.com> - Makefile fixes
Phil Hands <phil@hands.com> - Debian scripts, assorted patches

View File

@ -1,3 +1,6 @@
20000815
- (djm) More SunOS 4.1.x fixes from Nate Itkin <nitkin@europa.com>
20000813
- (djm) Add $(srcdir) to includes when compiling (for VPATH). Report from
Fabrice bacchella <fabrice.bacchella@marchfirst.fr>

View File

@ -221,10 +221,10 @@ if test -z "$no_libnsl" ; then
fi
# Checks for header files.
AC_CHECK_HEADERS(bstring.h endian.h floatingpoint.h lastlog.h limits.h login.h maillock.h netdb.h netgroup.h netinet/in_systm.h paths.h poll.h pty.h shadow.h security/pam_appl.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/select.h sys/stat.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h stddef.h time.h usersec.h util.h utmp.h utmpx.h)
AC_CHECK_HEADERS(bstring.h endian.h floatingpoint.h lastlog.h limits.h login.h maillock.h netdb.h netgroup.h netinet/in_systm.h paths.h poll.h pty.h shadow.h security/pam_appl.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/select.h sys/stat.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h stddef.h time.h ttyent.h usersec.h util.h utmp.h utmpx.h)
# Checks for library functions.
AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_af clock freeaddrinfo gai_strerror getaddrinfo getnameinfo getrusage inet_aton innetgr md5_crypt memmove mkdtemp on_exit openpty rresvport_af setenv seteuid setlogin setproctitle setreuid sigaction sigvec snprintf strerror strlcat strlcpy strsep vsnprintf vhangup _getpty __b64_ntop)
AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_af clock freeaddrinfo gai_strerror getaddrinfo getnameinfo getrusage getttyent inet_aton innetgr md5_crypt memmove mkdtemp on_exit openpty rresvport_af setenv seteuid setlogin setproctitle setreuid sigaction sigvec snprintf strerror strlcat strlcpy strsep vsnprintf vhangup _getpty __b64_ntop)
dnl checks for time functions
AC_CHECK_FUNCS(gettimeofday time)
dnl checks for libutil functions

View File

@ -70,6 +70,9 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg }
#ifdef HAVE_SYS_BSDTTY_H
# include <sys/bsdtty.h>
#endif
#ifdef HAVE_TTYENT_H
# include <ttyent.h>
#endif
#ifdef USE_PAM
# include <security/pam_appl.h>
#endif

View File

@ -160,7 +160,7 @@
#include "xmalloc.h"
#include "loginrec.h"
RCSID("$Id: loginrec.c,v 1.18 2000/08/09 06:34:28 djm Exp $");
RCSID("$Id: loginrec.c,v 1.19 2000/08/15 00:01:22 djm Exp $");
/**
** prototypes for helper functions in this file
@ -273,7 +273,7 @@ login_get_lastlog(struct logininfo *li, const int uid)
{
struct passwd *pw;
memset(li, '\0', sizeof(struct logininfo));
memset(li, '\0', sizeof(*li));
li->uid = uid;
/*
@ -311,7 +311,7 @@ logininfo *login_alloc_entry(int pid, const char *username,
{
struct logininfo *newli;
newli = (struct logininfo *) xmalloc (sizeof(struct logininfo));
newli = (struct logininfo *) xmalloc (sizeof(*newli));
(void)login_init_entry(newli, pid, username, hostname, line);
return newli;
}
@ -339,7 +339,7 @@ login_init_entry(struct logininfo *li, int pid, const char *username,
{
struct passwd *pw;
memset(li, 0, sizeof(struct logininfo));
memset(li, 0, sizeof(*li));
li->pid = pid;
@ -569,7 +569,7 @@ void
construct_utmp(struct logininfo *li,
struct utmp *ut)
{
memset(ut, '\0', sizeof(struct utmp));
memset(ut, '\0', sizeof(*ut));
/* First fill out fields used for both logins and logouts */
@ -643,7 +643,7 @@ set_utmpx_time(struct logininfo *li, struct utmpx *utx)
void
construct_utmpx(struct logininfo *li, struct utmpx *utx)
{
memset(utx, '\0', sizeof(struct utmpx));
memset(utx, '\0', sizeof(*utx));
# ifdef HAVE_ID_IN_UTMPX
line_abbrevname(utx->ut_id, li->line, sizeof(utx->ut_id));
# endif
@ -723,8 +723,30 @@ utmp_write_direct(struct logininfo *li, struct utmp *ut)
int tty;
/* FIXME: (ATL) ttyslot() needs local implementation */
#if defined(SUNOS4) && defined(HAVE_GETTTYENT)
register struct ttyent *ty;
tty=0;
setttyent();
while ((struct ttyent *)0 != (ty = getttyent())) {
tty++;
if (!strncmp(ty->ty_name, ut->ut_line, sizeof(ut->ut_line)))
break;
}
endttyent();
if((struct ttyent *)0 == ty) {
log("utmp_write_entry: tty not found");
return(1);
}
#else /* FIXME */
tty = ttyslot(); /* seems only to work for /dev/ttyp? style names */
#endif /* SUNOS4 && HAVE_GETTTYENT */
if (tty > 0 && (fd = open(UTMP_FILE, O_RDWR|O_CREAT, 0644)) >= 0) {
(void)lseek(fd, (off_t)(tty * sizeof(struct utmp)), SEEK_SET);
/*
@ -1031,7 +1053,7 @@ wtmp_get_entry(struct logininfo *li)
}
/* Seek to the start of the last struct utmp */
if (lseek(fd, (off_t)(0-sizeof(struct utmp)), SEEK_END) == -1) {
if (lseek(fd, (off_t)(0 - sizeof(struct utmp)), SEEK_END) == -1) {
/* Looks like we've got a fresh wtmp file */
close(fd);
return 0;
@ -1238,7 +1260,7 @@ syslogin_perform_login(struct logininfo *li)
{
struct utmp *ut;
if (! (ut = (struct utmp *)malloc(sizeof(struct utmp)))) {
if (! (ut = (struct utmp *)malloc(sizeof(*ut)))) {
log("syslogin_perform_login: couldn't malloc()");
return 0;
}
@ -1301,7 +1323,7 @@ static void
lastlog_construct(struct logininfo *li, struct lastlog *last)
{
/* clear the structure */
memset(last, '\0', sizeof(struct lastlog));
memset(last, '\0', sizeof(*last));
(void)line_stripname(last->ll_line, li->line, sizeof(last->ll_line));
strlcpy(last->ll_host, li->hostname,

View File

@ -601,8 +601,9 @@ do_exec_pty(Session *s, const char *command, struct passwd * pw)
}
}
/* Record that there was a login on that terminal. */
record_login(pid, s->tty, pw->pw_name, pw->pw_uid, hostname,
(struct sockaddr *)&from);
if (!options.use_login || command != NULL)
record_login(pid, s->tty, pw->pw_name, pw->pw_uid,
hostname, (struct sockaddr *)&from);
/* Check if .hushlogin exists. */
snprintf(line, sizeof line, "%.200s/.hushlogin", pw->pw_dir);