]> andersk Git - openssh.git/blobdiff - loginrec.c
- (djm) utmp direct write & SunOS 4 patch from Charles Levert
[openssh.git] / loginrec.c
index 83d4b2b0c7c82d3dd5cf68c5fef9bae4de8ce094..7e7d7dd0c0f1cb831f8ee59344030b9a482cef3c 100644 (file)
 
 #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"
@@ -616,7 +606,7 @@ construct_utmp(struct logininfo *li,
         */
 
        /* 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
@@ -680,7 +670,7 @@ construct_utmpx(struct logininfo *li, struct utmpx *utx)
         */
 
        /* strncpy(): Don't necessarily want null termination */
-       strncpy(utx->ut_user, li->username, MIN_SIZEOF(utx->ut_user, li->username));
+       strncpy(utx->ut_name, li->username, MIN_SIZEOF(utx->ut_name, li->username));
 # ifdef HAVE_HOST_IN_UTMPX
        strncpy(utx->ut_host, li->hostname, MIN_SIZEOF(utx->ut_host, li->hostname));
 # endif
@@ -740,17 +730,17 @@ utmp_write_direct(struct logininfo *li, struct utmp *ut)
                /*
                 * Prevent luser from zero'ing out ut_host.
                 * If the new ut_line is empty but the old one is not
-                * and ut_line and ut_user match, preserve the old ut_line.
+                * and ut_line and ut_name match, preserve the old ut_line.
                 */
                if (atomicio(read, fd, &old_ut, sizeof(old_ut)) == sizeof(old_ut) && 
                        (ut->ut_host[0] == '\0') && (old_ut.ut_host[0] != '\0') && 
                        (strncmp(old_ut.ut_line, ut->ut_line, sizeof(ut->ut_line)) == 0) && 
-                       (strncmp(old_ut.ut_user, ut->ut_user, sizeof(ut->ut_user)) == 0)) {
+                       (strncmp(old_ut.ut_name, ut->ut_name, sizeof(ut->ut_name)) == 0)) {
                        (void)memcpy(ut->ut_host, old_ut.ut_host, sizeof(ut->ut_host));
                }
                
                (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));
       
@@ -1006,8 +996,8 @@ wtmp_write_entry(struct logininfo *li)
 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;
@@ -1161,8 +1151,8 @@ wtmpx_write_entry(struct logininfo *li)
 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;
This page took 0.039638 seconds and 4 git commands to generate.