diff options
Diffstat (limited to 'monitor.c')
-rw-r--r-- | monitor.c | 40 |
1 files changed, 20 insertions, 20 deletions
@@ -25,7 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include "includes.h" | 27 | #include "includes.h" |
28 | RCSID("$OpenBSD: monitor.c,v 1.10 2002/05/12 23:53:45 djm Exp $"); | 28 | RCSID("$OpenBSD: monitor.c,v 1.11 2002/05/15 15:47:49 mouring Exp $"); |
29 | 29 | ||
30 | #include <openssl/dh.h> | 30 | #include <openssl/dh.h> |
31 | 31 | ||
@@ -240,7 +240,7 @@ monitor_permit_authentications(int permit) | |||
240 | } | 240 | } |
241 | 241 | ||
242 | Authctxt * | 242 | Authctxt * |
243 | monitor_child_preauth(struct monitor *monitor) | 243 | monitor_child_preauth(struct monitor *pmonitor) |
244 | { | 244 | { |
245 | struct mon_table *ent; | 245 | struct mon_table *ent; |
246 | int authenticated = 0; | 246 | int authenticated = 0; |
@@ -263,7 +263,7 @@ monitor_child_preauth(struct monitor *monitor) | |||
263 | 263 | ||
264 | /* The first few requests do not require asynchronous access */ | 264 | /* The first few requests do not require asynchronous access */ |
265 | while (!authenticated) { | 265 | while (!authenticated) { |
266 | authenticated = monitor_read(monitor, mon_dispatch, &ent); | 266 | authenticated = monitor_read(pmonitor, mon_dispatch, &ent); |
267 | if (authenticated) { | 267 | if (authenticated) { |
268 | if (!(ent->flags & MON_AUTHDECIDE)) | 268 | if (!(ent->flags & MON_AUTHDECIDE)) |
269 | fatal("%s: unexpected authentication from %d", | 269 | fatal("%s: unexpected authentication from %d", |
@@ -291,13 +291,13 @@ monitor_child_preauth(struct monitor *monitor) | |||
291 | debug("%s: %s has been authenticated by privileged process", | 291 | debug("%s: %s has been authenticated by privileged process", |
292 | __FUNCTION__, authctxt->user); | 292 | __FUNCTION__, authctxt->user); |
293 | 293 | ||
294 | mm_get_keystate(monitor); | 294 | mm_get_keystate(pmonitor); |
295 | 295 | ||
296 | return (authctxt); | 296 | return (authctxt); |
297 | } | 297 | } |
298 | 298 | ||
299 | void | 299 | void |
300 | monitor_child_postauth(struct monitor *monitor) | 300 | monitor_child_postauth(struct monitor *pmonitor) |
301 | { | 301 | { |
302 | if (compat20) { | 302 | if (compat20) { |
303 | mon_dispatch = mon_dispatch_postauth20; | 303 | mon_dispatch = mon_dispatch_postauth20; |
@@ -317,18 +317,18 @@ monitor_child_postauth(struct monitor *monitor) | |||
317 | } | 317 | } |
318 | 318 | ||
319 | for (;;) | 319 | for (;;) |
320 | monitor_read(monitor, mon_dispatch, NULL); | 320 | monitor_read(pmonitor, mon_dispatch, NULL); |
321 | } | 321 | } |
322 | 322 | ||
323 | void | 323 | void |
324 | monitor_sync(struct monitor *monitor) | 324 | monitor_sync(struct monitor *pmonitor) |
325 | { | 325 | { |
326 | /* The member allocation is not visible, so sync it */ | 326 | /* The member allocation is not visible, so sync it */ |
327 | mm_share_sync(&monitor->m_zlib, &monitor->m_zback); | 327 | mm_share_sync(&pmonitor->m_zlib, &pmonitor->m_zback); |
328 | } | 328 | } |
329 | 329 | ||
330 | int | 330 | int |
331 | monitor_read(struct monitor *monitor, struct mon_table *ent, | 331 | monitor_read(struct monitor *pmonitor, struct mon_table *ent, |
332 | struct mon_table **pent) | 332 | struct mon_table **pent) |
333 | { | 333 | { |
334 | Buffer m; | 334 | Buffer m; |
@@ -337,7 +337,7 @@ monitor_read(struct monitor *monitor, struct mon_table *ent, | |||
337 | 337 | ||
338 | buffer_init(&m); | 338 | buffer_init(&m); |
339 | 339 | ||
340 | mm_request_receive(monitor->m_sendfd, &m); | 340 | mm_request_receive(pmonitor->m_sendfd, &m); |
341 | type = buffer_get_char(&m); | 341 | type = buffer_get_char(&m); |
342 | 342 | ||
343 | debug3("%s: checking request %d", __FUNCTION__, type); | 343 | debug3("%s: checking request %d", __FUNCTION__, type); |
@@ -352,7 +352,7 @@ monitor_read(struct monitor *monitor, struct mon_table *ent, | |||
352 | if (!(ent->flags & MON_PERMIT)) | 352 | if (!(ent->flags & MON_PERMIT)) |
353 | fatal("%s: unpermitted request %d", __FUNCTION__, | 353 | fatal("%s: unpermitted request %d", __FUNCTION__, |
354 | type); | 354 | type); |
355 | ret = (*ent->f)(monitor->m_sendfd, &m); | 355 | ret = (*ent->f)(pmonitor->m_sendfd, &m); |
356 | buffer_free(&m); | 356 | buffer_free(&m); |
357 | 357 | ||
358 | /* The child may use this request only once, disable it */ | 358 | /* The child may use this request only once, disable it */ |
@@ -1003,7 +1003,7 @@ mm_session_close(Session *s) | |||
1003 | int | 1003 | int |
1004 | mm_answer_pty(int socket, Buffer *m) | 1004 | mm_answer_pty(int socket, Buffer *m) |
1005 | { | 1005 | { |
1006 | extern struct monitor *monitor; | 1006 | extern struct monitor *pmonitor; |
1007 | Session *s; | 1007 | Session *s; |
1008 | int res, fd0; | 1008 | int res, fd0; |
1009 | 1009 | ||
@@ -1015,7 +1015,7 @@ mm_answer_pty(int socket, Buffer *m) | |||
1015 | goto error; | 1015 | goto error; |
1016 | s->authctxt = authctxt; | 1016 | s->authctxt = authctxt; |
1017 | s->pw = authctxt->pw; | 1017 | s->pw = authctxt->pw; |
1018 | s->pid = monitor->m_pid; | 1018 | s->pid = pmonitor->m_pid; |
1019 | res = pty_allocate(&s->ptyfd, &s->ttyfd, s->tty, sizeof(s->tty)); | 1019 | res = pty_allocate(&s->ptyfd, &s->ttyfd, s->tty, sizeof(s->tty)); |
1020 | if (res == 0) | 1020 | if (res == 0) |
1021 | goto error; | 1021 | goto error; |
@@ -1252,7 +1252,7 @@ mm_answer_rsa_response(int socket, Buffer *m) | |||
1252 | int | 1252 | int |
1253 | mm_answer_term(int socket, Buffer *req) | 1253 | mm_answer_term(int socket, Buffer *req) |
1254 | { | 1254 | { |
1255 | extern struct monitor *monitor; | 1255 | extern struct monitor *pmonitor; |
1256 | int res, status; | 1256 | int res, status; |
1257 | 1257 | ||
1258 | debug3("%s: tearing down sessions", __FUNCTION__); | 1258 | debug3("%s: tearing down sessions", __FUNCTION__); |
@@ -1260,7 +1260,7 @@ mm_answer_term(int socket, Buffer *req) | |||
1260 | /* The child is terminating */ | 1260 | /* The child is terminating */ |
1261 | session_destroy_all(&mm_session_close); | 1261 | session_destroy_all(&mm_session_close); |
1262 | 1262 | ||
1263 | while (waitpid(monitor->m_pid, &status, 0) == -1) | 1263 | while (waitpid(pmonitor->m_pid, &status, 0) == -1) |
1264 | if (errno != EINTR) | 1264 | if (errno != EINTR) |
1265 | exit(1); | 1265 | exit(1); |
1266 | 1266 | ||
@@ -1271,7 +1271,7 @@ mm_answer_term(int socket, Buffer *req) | |||
1271 | } | 1271 | } |
1272 | 1272 | ||
1273 | void | 1273 | void |
1274 | monitor_apply_keystate(struct monitor *monitor) | 1274 | monitor_apply_keystate(struct monitor *pmonitor) |
1275 | { | 1275 | { |
1276 | if (compat20) { | 1276 | if (compat20) { |
1277 | set_newkeys(MODE_IN); | 1277 | set_newkeys(MODE_IN); |
@@ -1303,7 +1303,7 @@ monitor_apply_keystate(struct monitor *monitor) | |||
1303 | sizeof(outgoing_stream)); | 1303 | sizeof(outgoing_stream)); |
1304 | 1304 | ||
1305 | /* Update with new address */ | 1305 | /* Update with new address */ |
1306 | mm_init_compression(monitor->m_zlib); | 1306 | mm_init_compression(pmonitor->m_zlib); |
1307 | 1307 | ||
1308 | /* Network I/O buffers */ | 1308 | /* Network I/O buffers */ |
1309 | /* XXX inefficient for large buffers, need: buffer_init_from_string */ | 1309 | /* XXX inefficient for large buffers, need: buffer_init_from_string */ |
@@ -1353,7 +1353,7 @@ mm_get_kex(Buffer *m) | |||
1353 | /* This function requries careful sanity checking */ | 1353 | /* This function requries careful sanity checking */ |
1354 | 1354 | ||
1355 | void | 1355 | void |
1356 | mm_get_keystate(struct monitor *monitor) | 1356 | mm_get_keystate(struct monitor *pmonitor) |
1357 | { | 1357 | { |
1358 | Buffer m; | 1358 | Buffer m; |
1359 | u_char *blob, *p; | 1359 | u_char *blob, *p; |
@@ -1362,7 +1362,7 @@ mm_get_keystate(struct monitor *monitor) | |||
1362 | debug3("%s: Waiting for new keys", __FUNCTION__); | 1362 | debug3("%s: Waiting for new keys", __FUNCTION__); |
1363 | 1363 | ||
1364 | buffer_init(&m); | 1364 | buffer_init(&m); |
1365 | mm_request_receive_expect(monitor->m_sendfd, MONITOR_REQ_KEYEXPORT, &m); | 1365 | mm_request_receive_expect(pmonitor->m_sendfd, MONITOR_REQ_KEYEXPORT, &m); |
1366 | if (!compat20) { | 1366 | if (!compat20) { |
1367 | child_state.ssh1protoflags = buffer_get_int(&m); | 1367 | child_state.ssh1protoflags = buffer_get_int(&m); |
1368 | child_state.ssh1cipher = buffer_get_int(&m); | 1368 | child_state.ssh1cipher = buffer_get_int(&m); |
@@ -1372,7 +1372,7 @@ mm_get_keystate(struct monitor *monitor) | |||
1372 | goto skip; | 1372 | goto skip; |
1373 | } else { | 1373 | } else { |
1374 | /* Get the Kex for rekeying */ | 1374 | /* Get the Kex for rekeying */ |
1375 | *monitor->m_pkex = mm_get_kex(&m); | 1375 | *pmonitor->m_pkex = mm_get_kex(&m); |
1376 | } | 1376 | } |
1377 | 1377 | ||
1378 | blob = buffer_get_string(&m, &bloblen); | 1378 | blob = buffer_get_string(&m, &bloblen); |