version 1.60, 2004/06/22 05:05:45 |
version 1.61, 2004/07/17 05:31:41 |
|
|
extern Buffer input, output; |
extern Buffer input, output; |
extern Buffer auth_debug; |
extern Buffer auth_debug; |
extern int auth_debug_init; |
extern int auth_debug_init; |
|
extern Buffer loginmsg; |
|
|
/* State exported from the child */ |
/* State exported from the child */ |
|
|
|
|
|
|
buffer_put_int(m, 1); |
buffer_put_int(m, 1); |
buffer_put_cstring(m, s->tty); |
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 */ |
/* We need to trick ttyslot */ |
if (dup2(s->ttyfd, 0) == -1) |
if (dup2(s->ttyfd, 0) == -1) |
fatal("%s: dup2", __func__); |
fatal("%s: dup2", __func__); |
|
|
|
|
/* Now we can close the file descriptor again */ |
/* Now we can close the file descriptor again */ |
close(0); |
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 */ |
/* make sure nothing uses fd 0 */ |
if ((fd0 = open(_PATH_DEVNULL, O_RDONLY)) < 0) |
if ((fd0 = open(_PATH_DEVNULL, O_RDONLY)) < 0) |