|
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); |