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

Collapse All | Expand All

(-)monitor.c (-3 / +5 lines)
Lines 1236-1255 mm_session_close(Session *s) Link Here
1236
int
1236
int
1237
mm_answer_pty(int sock, Buffer *m)
1237
mm_answer_pty(int sock, Buffer *m)
1238
{
1238
{
1239
	extern struct monitor *pmonitor;
1240
	Session *s;
1239
	Session *s;
1241
	int res, fd0;
1240
	int res, fd0;
1241
	pid_t pid;
1242
1242
1243
	debug3("%s entering", __func__);
1243
	debug3("%s entering", __func__);
1244
1244
1245
	pid = (pid_t)buffer_get_int(m);
1245
	buffer_clear(m);
1246
	buffer_clear(m);
1246
	s = session_new();
1247
	s = session_new();
1247
	if (s == NULL)
1248
	if (s == NULL)
1248
		goto error;
1249
		goto error;
1249
	s->authctxt = authctxt;
1250
	s->authctxt = authctxt;
1250
	s->pw = authctxt->pw;
1251
	s->pw = authctxt->pw;
1251
	s->pid = pmonitor->m_pid;
1252
	s->pid = pid;
1252
	res = pty_allocate(&s->ptyfd, &s->ttyfd, s->tty, sizeof(s->tty));
1253
	res = pty_allocate(&s->ptyfd, &s->ttyfd, s->tty, sizeof(s->tty),
1254
	    s->pid);
1253
	if (res == 0)
1255
	if (res == 0)
1254
		goto error;
1256
		goto error;
1255
	pty_setowner(authctxt->pw, s->tty);
1257
	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 1754-1760 session_pty_req(Session *s) Link Here
1754
1754
1755
	/* Allocate a pty and open it. */
1755
	/* Allocate a pty and open it. */
1756
	debug("Allocating pty.");
1756
	debug("Allocating pty.");
1757
	if (!PRIVSEP(pty_allocate(&s->ptyfd, &s->ttyfd, s->tty, sizeof(s->tty)))) {
1757
	if (!PRIVSEP(pty_allocate(&s->ptyfd, &s->ttyfd, s->tty, sizeof(s->tty),
1758
	    s->pid))) {
1758
		if (s->term)
1759
		if (s->term)
1759
			xfree(s->term);
1760
			xfree(s->term);
1760
		s->term = NULL;
1761
		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