summaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2003-10-02 16:12:36 +1000
committerDarren Tucker <dtucker@zip.com.au>2003-10-02 16:12:36 +1000
commit3e33cecf71860f73656a73b754cc7b7b9ec0b0ce (patch)
tree4c993022225dc70faeb42e23ff3323fd1deb717a /monitor.c
parentb210aa2cfa546d8c31f8c725d1de3050c747bd6e (diff)
- markus@cvs.openbsd.org 2003/09/23 20:17:11
[Makefile.in auth1.c auth2.c auth.c auth.h auth-krb5.c canohost.c cleanup.c clientloop.c fatal.c gss-serv.c log.c log.h monitor.c monitor.h monitor_wrap.c monitor_wrap.h packet.c serverloop.c session.c session.h ssh-agent.c sshd.c] replace fatal_cleanup() and linked list of fatal callbacks with static cleanup_exit() function. re-refine cleanup_exit() where appropriate, allocate sshd's authctxt eary to allow simpler cleanup in sshd. tested by many, ok deraadt@
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/monitor.c b/monitor.c
index e5656470d..eaf66f7c8 100644
--- a/monitor.c
+++ b/monitor.c
@@ -25,7 +25,7 @@
25 */ 25 */
26 26
27#include "includes.h" 27#include "includes.h"
28RCSID("$OpenBSD: monitor.c,v 1.49 2003/08/28 12:54:34 markus Exp $"); 28RCSID("$OpenBSD: monitor.c,v 1.50 2003/09/23 20:17:11 markus Exp $");
29 29
30#include <openssl/dh.h> 30#include <openssl/dh.h>
31 31
@@ -272,14 +272,17 @@ monitor_permit_authentications(int permit)
272 } 272 }
273} 273}
274 274
275Authctxt * 275void
276monitor_child_preauth(struct monitor *pmonitor) 276monitor_child_preauth(Authctxt *_authctxt, struct monitor *pmonitor)
277{ 277{
278 struct mon_table *ent; 278 struct mon_table *ent;
279 int authenticated = 0; 279 int authenticated = 0;
280 280
281 debug3("preauth child monitor started"); 281 debug3("preauth child monitor started");
282 282
283 authctxt = _authctxt;
284 memset(authctxt, 0, sizeof(*authctxt));
285
283 if (compat20) { 286 if (compat20) {
284 mon_dispatch = mon_dispatch_proto20; 287 mon_dispatch = mon_dispatch_proto20;
285 288
@@ -292,8 +295,6 @@ monitor_child_preauth(struct monitor *pmonitor)
292 monitor_permit(mon_dispatch, MONITOR_REQ_SESSKEY, 1); 295 monitor_permit(mon_dispatch, MONITOR_REQ_SESSKEY, 1);
293 } 296 }
294 297
295 authctxt = authctxt_new();
296
297 /* The first few requests do not require asynchronous access */ 298 /* The first few requests do not require asynchronous access */
298 while (!authenticated) { 299 while (!authenticated) {
299 authenticated = monitor_read(pmonitor, mon_dispatch, &ent); 300 authenticated = monitor_read(pmonitor, mon_dispatch, &ent);
@@ -333,8 +334,6 @@ monitor_child_preauth(struct monitor *pmonitor)
333 __func__, authctxt->user); 334 __func__, authctxt->user);
334 335
335 mm_get_keystate(pmonitor); 336 mm_get_keystate(pmonitor);
336
337 return (authctxt);
338} 337}
339 338
340static void 339static void
@@ -1185,7 +1184,7 @@ mm_record_login(Session *s, struct passwd *pw)
1185 if (getpeername(packet_get_connection_in(), 1184 if (getpeername(packet_get_connection_in(),
1186 (struct sockaddr *) & from, &fromlen) < 0) { 1185 (struct sockaddr *) & from, &fromlen) < 0) {
1187 debug("getpeername: %.100s", strerror(errno)); 1186 debug("getpeername: %.100s", strerror(errno));
1188 fatal_cleanup(); 1187 cleanup_exit(255);
1189 } 1188 }
1190 } 1189 }
1191 /* Record that there was a login on that tty from the remote host. */ 1190 /* Record that there was a login on that tty from the remote host. */
@@ -1200,7 +1199,6 @@ mm_session_close(Session *s)
1200 debug3("%s: session %d pid %ld", __func__, s->self, (long)s->pid); 1199 debug3("%s: session %d pid %ld", __func__, s->self, (long)s->pid);
1201 if (s->ttyfd != -1) { 1200 if (s->ttyfd != -1) {
1202 debug3("%s: tty %s ptyfd %d", __func__, s->tty, s->ptyfd); 1201 debug3("%s: tty %s ptyfd %d", __func__, s->tty, s->ptyfd);
1203 fatal_remove_cleanup(session_pty_cleanup2, (void *)s);
1204 session_pty_cleanup2(s); 1202 session_pty_cleanup2(s);
1205 } 1203 }
1206 s->used = 0; 1204 s->used = 0;
@@ -1225,7 +1223,6 @@ mm_answer_pty(int socket, Buffer *m)
1225 res = pty_allocate(&s->ptyfd, &s->ttyfd, s->tty, sizeof(s->tty)); 1223 res = pty_allocate(&s->ptyfd, &s->ttyfd, s->tty, sizeof(s->tty));
1226 if (res == 0) 1224 if (res == 0)
1227 goto error; 1225 goto error;
1228 fatal_add_cleanup(session_pty_cleanup2, (void *)s);
1229 pty_setowner(authctxt->pw, s->tty); 1226 pty_setowner(authctxt->pw, s->tty);
1230 1227
1231 buffer_put_int(m, 1); 1228 buffer_put_int(m, 1);