]> andersk Git - openssh.git/commitdiff
[loginrec.c session.c sshlogin.c sshlogin.h] Bug 84
authortim <tim>
Mon, 25 Feb 2002 01:56:46 +0000 (01:56 +0000)
committertim <tim>
Mon, 25 Feb 2002 01:56:46 +0000 (01:56 +0000)
patch by wknox@mitre.org (William Knox).
[sshlogin.h] declare record_utmp_only for session.c

ChangeLog
loginrec.c
session.c
sshlogin.c
sshlogin.h

index e4b0acc8a7809efba59ee0470f2c07b8818fea0c..259d32aab204074319558dfad726edeede3d6390 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,9 @@
    coming).
  - (bal) Part two.. Drop unused AIX header, fix up missing char *cp.  All
    that is left is handling aix_usrinfo().
+ - (tim) [loginrec.c session.c sshlogin.c sshlogin.h] Bug 84
+   patch by wknox@mitre.org (William Knox).
+   [sshlogin.h] declare record_utmp_only for session.c
 
 20020221
  - (bal) Minor session.c fixup for cygwin.  mispelt 'is_winnt' variable.
index 87c336df082200b7fbdee95c88529858528617b9..1805f3ee836ec1f67f543c5687fda0cd801b6364 100644 (file)
@@ -701,6 +701,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;
@@ -710,8 +712,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
@@ -942,9 +942,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
index be6843ab142da943937f214542098fe74441c7f4..bf1a3ecf721c75c96fe9e99fba9ca845d9da0607 100644 (file)
--- a/session.c
+++ b/session.c
@@ -1677,7 +1677,7 @@ session_pty_cleanup(void *session)
 
        /* Record that the user has logged out. */
        if (s->pid != 0)
-               record_logout(s->pid, s->tty);
+               record_logout(s->pid, s->tty, s->pw->pw_name);
 
        /* Release the pseudo-tty. */
        pty_release(s->tty);
index 2fb96bb6cb9c4bfc60151f9a9f95787a182b9bb8..78c51abd6793df415c5147cdcf1f8524230fbc7e 100644 (file)
@@ -94,11 +94,11 @@ record_utmp_only(pid_t pid, const char *ttyname, const char *user,
 /* Records that the user has logged out. */
 
 void
-record_logout(pid_t pid, const char *ttyname)
+record_logout(pid_t pid, const char *ttyname, const char *user)
 {
   struct logininfo *li;
 
-  li = login_alloc_entry(pid, NULL, NULL, ttyname);
+  li = login_alloc_entry(pid, user, NULL, ttyname);
   login_logout(li);
   login_free_entry(li);
 }
index 79d42a98222385880924b54c10af640f4cccf242..bd30278e0e7d8d294f6469d33a5c66ea9e57d43c 100644 (file)
 void
 record_login(pid_t, const char *, const char *, uid_t,
     const char *, struct sockaddr *);
-void   record_logout(pid_t, const char *);
+void   record_logout(pid_t, const char *, const char *);
 u_long         get_last_login_time(uid_t, const char *, char *, u_int);
 
+#ifdef LOGIN_NEEDS_UTMPX
+void   record_utmp_only(pid_t, const char *, const char *, const char *,
+               struct sockaddr *);
+#endif
+
 #endif
This page took 1.902632 seconds and 5 git commands to generate.