]> andersk Git - openssh.git/blobdiff - monitor.c
- (tim) [configure.ac] updwtmpx() on OpenServer seems to add duplicate entry.
[openssh.git] / monitor.c
index f9806e01cda227cf68dc5468062982f175690c48..b7463400e688f0a3cf230ecd734b3744c8339e8a 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -25,7 +25,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: monitor.c,v 1.59 2004/06/21 17:36:31 avsm Exp $");
+RCSID("$OpenBSD: monitor.c,v 1.61 2004/07/17 05:31:41 dtucker Exp $");
 
 #include <openssl/dh.h>
 
@@ -79,6 +79,7 @@ extern u_char session_id[];
 extern Buffer input, output;
 extern Buffer auth_debug;
 extern int auth_debug_init;
+extern Buffer loginmsg;
 
 /* State exported from the child */
 
@@ -551,7 +552,7 @@ mm_answer_sign(int sock, Buffer *m)
 int
 mm_answer_pwnamallow(int sock, Buffer *m)
 {
-       char *login;
+       char *username;
        struct passwd *pwent;
        int allowed = 0;
 
@@ -560,13 +561,13 @@ mm_answer_pwnamallow(int sock, Buffer *m)
        if (authctxt->attempt++ != 0)
                fatal("%s: multiple attempts for getpwnam", __func__);
 
-       login = buffer_get_string(m, NULL);
+       username = buffer_get_string(m, NULL);
 
-       pwent = getpwnamallow(login);
+       pwent = getpwnamallow(username);
 
-       authctxt->user = xstrdup(login);
-       setproctitle("%s [priv]", pwent ? login : "unknown");
-       xfree(login);
+       authctxt->user = xstrdup(username);
+       setproctitle("%s [priv]", pwent ? username : "unknown");
+       xfree(username);
 
        buffer_clear(m);
 
@@ -1230,10 +1231,6 @@ mm_answer_pty(int sock, Buffer *m)
 
        buffer_put_int(m, 1);
        buffer_put_cstring(m, s->tty);
-       mm_request_send(sock, MONITOR_ANS_PTY, m);
-
-       mm_send_fd(sock, s->ptyfd);
-       mm_send_fd(sock, s->ttyfd);
 
        /* We need to trick ttyslot */
        if (dup2(s->ttyfd, 0) == -1)
@@ -1244,6 +1241,15 @@ mm_answer_pty(int sock, Buffer *m)
        /* Now we can close the file descriptor again */
        close(0);
 
+       /* send messages generated by record_login */
+       buffer_put_string(m, buffer_ptr(&loginmsg), buffer_len(&loginmsg));
+       buffer_clear(&loginmsg);
+
+       mm_request_send(sock, MONITOR_ANS_PTY, m);
+
+       mm_send_fd(sock, s->ptyfd);
+       mm_send_fd(sock, s->ttyfd);
+
        /* make sure nothing uses fd 0 */
        if ((fd0 = open(_PATH_DEVNULL, O_RDONLY)) < 0)
                fatal("%s: open(/dev/null): %s", __func__, strerror(errno));
This page took 0.040772 seconds and 4 git commands to generate.