]> andersk Git - openssh.git/blobdiff - loginrec.c
- itojun@cvs.openbsd.org 2002/05/13 02:37:39
[openssh.git] / loginrec.c
index 5e9f96fbd31a1eb473a819a1c5ec443e2e0e8774..7aa102545fcaa3c260ae7daeada7f015626f31a9 100644 (file)
   symbols for the platform.
 
   Use logintest to check which symbols are defined before modifying
-  configure.in and loginrec.c. (You have to build logintest yourself
+  configure.ac and loginrec.c. (You have to build logintest yourself
   with 'make logintest' as it's not built by default.)
 
   Otherwise, patches to the specific method(s) are very helpful!
@@ -448,6 +448,7 @@ int
 login_utmp_only(struct logininfo *li)
 {
        li->type = LTYPE_LOGIN; 
+       login_set_current_time(li);
 # ifdef USE_UTMP
        utmp_write_entry(li);
 # endif
@@ -563,6 +564,11 @@ line_abbrevname(char *dst, const char *src, int dstsize)
        if (strncmp(src, "/dev/", 5) == 0)
                src += 5;
 
+#ifdef WITH_ABBREV_NO_TTY
+       if (strncmp(src, "tty", 3) == 0)
+               src += 3;
+#endif
+
        len = strlen(src);
 
        if (len > 0) {
@@ -700,6 +706,8 @@ construct_utmpx(struct logininfo *li, struct utmpx *utx)
        line_stripname(utx->ut_line, li->line, sizeof(utx->ut_line));
        set_utmpx_time(li, utx);
        utx->ut_pid = li->pid;
+       /* strncpy(): Don't necessarily want null termination */
+       strncpy(utx->ut_name, li->username, MIN_SIZEOF(utx->ut_name, li->username));
 
        if (li->type == LTYPE_LOGOUT)
                return;
@@ -709,8 +717,6 @@ construct_utmpx(struct logininfo *li, struct utmpx *utx)
         * for logouts.
         */
 
-       /* strncpy(): Don't necessarily want null termination */
-       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
@@ -941,9 +947,7 @@ utmpx_perform_logout(struct logininfo *li)
 {
        struct utmpx utx;
 
-       memset(&utx, '\0', sizeof(utx));
-       set_utmpx_time(li, &utx);
-       line_stripname(utx.ut_line, li->line, sizeof(utx.ut_line));
+       construct_utmpx(li, &utx);
 # ifdef HAVE_ID_IN_UTMPX
        line_abbrevname(utx.ut_id, li->line, sizeof(utx.ut_id));
 # endif
This page took 0.030894 seconds and 4 git commands to generate.