summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
Diffstat (limited to 'sbin')
-rw-r--r--sbin/isakmpd/isakmpd.c4
-rw-r--r--sbin/isakmpd/monitor.c19
-rw-r--r--sbin/isakmpd/monitor.h4
3 files changed, 19 insertions, 8 deletions
diff --git a/sbin/isakmpd/isakmpd.c b/sbin/isakmpd/isakmpd.c
index 9a6166ad676..6d0f6cf246f 100644
--- a/sbin/isakmpd/isakmpd.c
+++ b/sbin/isakmpd/isakmpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isakmpd.c,v 1.64 2004/06/14 09:55:41 ho Exp $ */
+/* $OpenBSD: isakmpd.c,v 1.65 2004/06/20 15:03:35 ho Exp $ */
/* $EOM: isakmpd.c,v 1.54 2000/10/05 09:28:22 niklas Exp $ */
/*
@@ -402,7 +402,7 @@ main(int argc, char *argv[])
tzset();
#if defined (USE_PRIVSEP)
- if (monitor_init()) {
+ if (monitor_init(debug)) {
/* The parent, with privileges enters infinite monitor loop. */
monitor_loop(debug);
exit(0); /* Never reached. */
diff --git a/sbin/isakmpd/monitor.c b/sbin/isakmpd/monitor.c
index 7db75043a53..f26a75cbea2 100644
--- a/sbin/isakmpd/monitor.c
+++ b/sbin/isakmpd/monitor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: monitor.c,v 1.22 2004/06/14 09:55:41 ho Exp $ */
+/* $OpenBSD: monitor.c,v 1.23 2004/06/20 15:03:35 ho Exp $ */
/*
* Copyright (c) 2003 Håkan Olsson. All rights reserved.
@@ -89,7 +89,7 @@ static void m_priv_test_state(int);
/* Setup monitor context, fork, drop child privs. */
pid_t
-monitor_init(void)
+monitor_init(int debug)
{
struct passwd *pw;
int p[2];
@@ -130,6 +130,17 @@ monitor_init(void)
setproctitle("monitor [priv]");
}
+
+ /* With "-dd", stop and wait here. For gdb "attach" etc. */
+ if (debug > 1) {
+ log_print("monitor_init: stopped %s PID %d fd %d%s",
+ m_state.pid ? "priv" : "child", getpid(), m_state.s,
+ m_state.pid ? ", waiting for SIGCONT" : "");
+ kill(getpid(), SIGSTOP); /* Wait here for SIGCONT. */
+ if (m_state.pid)
+ kill(m_state.pid, SIGCONT); /* Continue child. */
+ }
+
return m_state.pid;
}
@@ -515,14 +526,14 @@ sig_pass_to_chld(int sig)
/* This function is where the privileged process waits(loops) indefinitely. */
void
-monitor_loop(int debugging)
+monitor_loop(int debug)
{
pid_t pid;
fd_set *fds;
size_t fdsn;
int n, maxfd;
- if (!debugging)
+ if (!debug)
log_to(0);
maxfd = m_state.s + 1;
diff --git a/sbin/isakmpd/monitor.h b/sbin/isakmpd/monitor.h
index 2d20f5eb0f0..39f20b39c47 100644
--- a/sbin/isakmpd/monitor.h
+++ b/sbin/isakmpd/monitor.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: monitor.h,v 1.8 2004/04/15 18:39:26 deraadt Exp $ */
+/* $OpenBSD: monitor.h,v 1.9 2004/06/20 15:03:35 ho Exp $ */
/*
* Copyright (c) 2003 Håkan Olsson. All rights reserved.
@@ -59,7 +59,7 @@ struct monitor_dirents {
struct dirent **dirents;
};
-pid_t monitor_init(void);
+pid_t monitor_init(int);
void monitor_loop(int);
int mm_send_fd(int, int);