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
{
struct passwd *pw;
- memset(li, '\0', sizeof(struct logininfo));
+ memset(li, '\0', sizeof(*li));
li->uid = uid;
/*
{
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;
}
{
struct passwd *pw;
- memset(li, 0, sizeof(struct logininfo));
+ memset(li, 0, sizeof(*li));
li->pid = pid;
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 */
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
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);
/*
}
/* 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;
{
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;
}
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,
}
}
/* 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);