View | Details | Raw Unified | Return to bug 980 | Differences between
and this patch

Collapse All | Expand All

(-)monitor.c (-3 / +6 lines)
Lines 1230-1255 mm_session_close(Session *s) Link Here
1230
		debug3("%s: tty %s ptyfd %d",  __func__, s->tty, s->ptyfd);
1230
		debug3("%s: tty %s ptyfd %d",  __func__, s->tty, s->ptyfd);
1231
		session_pty_cleanup2(s);
1231
		session_pty_cleanup2(s);
1232
	}
1232
	}
1233
	record_logout(s->pid, s->tty, s->authctxt->pw->pw_name);
1233
	s->used = 0;
1234
	s->used = 0;
1234
}
1235
}
1235
1236
1236
int
1237
int
1237
mm_answer_pty(int sock, Buffer *m)
1238
mm_answer_pty(int sock, Buffer *m)
1238
{
1239
{
1239
	extern struct monitor *pmonitor;
1240
	Session *s;
1240
	Session *s;
1241
	int res, fd0;
1241
	int res, fd0;
1242
	pid_t pid;
1242
1243
1243
	debug3("%s entering", __func__);
1244
	debug3("%s entering", __func__);
1244
1245
1246
	pid = (pid_t)buffer_get_int(m);
1245
	buffer_clear(m);
1247
	buffer_clear(m);
1246
	s = session_new();
1248
	s = session_new();
1247
	if (s == NULL)
1249
	if (s == NULL)
1248
		goto error;
1250
		goto error;
1249
	s->authctxt = authctxt;
1251
	s->authctxt = authctxt;
1250
	s->pw = authctxt->pw;
1252
	s->pw = authctxt->pw;
1251
	s->pid = pmonitor->m_pid;
1253
	s->pid = pid;
1252
	res = pty_allocate(&s->ptyfd, &s->ttyfd, s->tty, sizeof(s->tty));
1254
	res = pty_allocate(&s->ptyfd, &s->ttyfd, s->tty, sizeof(s->tty),
1255
	    s->pid);
1253
	if (res == 0)
1256
	if (res == 0)
1254
		goto error;
1257
		goto error;
1255
	pty_setowner(authctxt->pw, s->tty);
1258
	pty_setowner(authctxt->pw, s->tty);
(-)monitor_wrap.c (-1 / +2 lines)
Lines 641-653 mm_send_keystate(struct monitor *monitor Link Here
641
}
641
}
642
642
643
int
643
int
644
mm_pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen)
644
mm_pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen, pid_t pid)
645
{
645
{
646
	Buffer m;
646
	Buffer m;
647
	char *p, *msg;
647
	char *p, *msg;
648
	int success = 0;
648
	int success = 0;
649
649
650
	buffer_init(&m);
650
	buffer_init(&m);
651
	buffer_put_int(&m, (int)pid);
651
	mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PTY, &m);
652
	mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PTY, &m);
652
653
653
	debug3("%s: waiting for MONITOR_ANS_PTY", __func__);
654
	debug3("%s: waiting for MONITOR_ANS_PTY", __func__);
(-)monitor_wrap.h (-1 / +1 lines)
Lines 82-88 void mm_audit_run_command(const char *); Link Here
82
82
83
struct Session;
83
struct Session;
84
void mm_terminate(void);
84
void mm_terminate(void);
85
int mm_pty_allocate(int *, int *, char *, int);
85
int mm_pty_allocate(int *, int *, char *, int, pid_t);
86
void mm_session_pty_cleanup2(struct Session *);
86
void mm_session_pty_cleanup2(struct Session *);
87
87
88
/* SSHv1 interfaces */
88
/* SSHv1 interfaces */
(-)session.c (-1 / +2 lines)
Lines 1759-1765 session_pty_req(Session *s) Link Here
1759
1759
1760
	/* Allocate a pty and open it. */
1760
	/* Allocate a pty and open it. */
1761
	debug("Allocating pty.");
1761
	debug("Allocating pty.");
1762
	if (!PRIVSEP(pty_allocate(&s->ptyfd, &s->ttyfd, s->tty, sizeof(s->tty)))) {
1762
	if (!PRIVSEP(pty_allocate(&s->ptyfd, &s->ttyfd, s->tty, sizeof(s->tty),
1763
	    s->pid))) {
1763
		if (s->term)
1764
		if (s->term)
1764
			xfree(s->term);
1765
			xfree(s->term);
1765
		s->term = NULL;
1766
		s->term = NULL;
(-)sshpty.c (-1 / +1 lines)
Lines 38-44 RCSID("$OpenBSD: sshpty.c,v 1.12 2004/06 Link Here
38
 */
38
 */
39
39
40
int
40
int
41
pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen)
41
pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen, pid_t pid)
42
{
42
{
43
	/* openpty(3) exists in OSF/1 and some other os'es */
43
	/* openpty(3) exists in OSF/1 and some other os'es */
44
	char *name;
44
	char *name;
(-)sshpty.h (-1 / +1 lines)
Lines 21-27 struct termios get_saved_tio(void); Link Here
21
void	 leave_raw_mode(void);
21
void	 leave_raw_mode(void);
22
void	 enter_raw_mode(void);
22
void	 enter_raw_mode(void);
23
23
24
int	 pty_allocate(int *, int *, char *, int);
24
int	 pty_allocate(int *, int *, char *, int, pid_t);
25
void	 pty_release(const char *);
25
void	 pty_release(const char *);
26
void	 pty_make_controlling_tty(int *, const char *);
26
void	 pty_make_controlling_tty(int *, const char *);
27
void	 pty_change_window_size(int, int, int, int, int);
27
void	 pty_change_window_size(int, int, int, int, int);

Return to bug 980