#include "includes.h"
-#if HAVE_UTMP_H
-# include <utmp.h>
-#endif
-#if HAVE_UTMPX_H
-# include <utmpx.h>
-#endif
-#if HAVE_LASTLOG_H
-# include <lastlog.h>
-#endif
-
#include "ssh.h"
#include "xmalloc.h"
#include "loginrec.h"
*/
/* Use strncpy because we don't necessarily want null termination */
- strncpy(ut->ut_user, li->username, MIN_SIZEOF(ut->ut_user, li->username));
+ strncpy(ut->ut_name, li->username, MIN_SIZEOF(ut->ut_name, li->username));
# ifdef HAVE_HOST_IN_UTMP
strncpy(ut->ut_host, li->hostname, MIN_SIZEOF(ut->ut_host, li->hostname));
# endif
}
(void)lseek(fd, (off_t)(tty * sizeof(struct utmp)), SEEK_SET);
- if (atomicio(write, fd, ut, sizeof(ut)) != sizeof(ut))
+ if (atomicio(write, fd, ut, sizeof(*ut)) != sizeof(*ut))
log("utmp_write_direct: error writing %s: %s",
UTMP_FILE, strerror(errno));
static int
wtmp_islogin(struct logininfo *li, struct utmp *ut)
{
- if (strncmp(li->username, ut->ut_user,
- MIN_SIZEOF(li->username, ut->ut_user)) == 0) {
+ if (strncmp(li->username, ut->ut_name,
+ MIN_SIZEOF(li->username, ut->ut_name)) == 0) {
# ifdef HAVE_TYPE_IN_UTMP
if (ut->ut_type & USER_PROCESS)
return 1;
static int
wtmpx_islogin(struct logininfo *li, struct utmpx *utx)
{
- if ( strncmp(li->username, utx->ut_user,
- MIN_SIZEOF(li->username, utx->ut_user)) == 0 ) {
+ if ( strncmp(li->username, utx->ut_name,
+ MIN_SIZEOF(li->username, utx->ut_name)) == 0 ) {
# ifdef HAVE_TYPE_IN_UTMPX
if (utx->ut_type == USER_PROCESS)
return 1;