diff options
author | Hans-Joerg Hoexer <hshoexer@cvs.openbsd.org> | 2005-05-28 18:48:13 +0000 |
---|---|---|
committer | Hans-Joerg Hoexer <hshoexer@cvs.openbsd.org> | 2005-05-28 18:48:13 +0000 |
commit | 2020a5ae8ff3130ac40d9057a1d82b7813b27acd (patch) | |
tree | f6a39e902ecf072c51fde907961ec5b370c3f896 /sbin/isakmpd | |
parent | 189b2720c2bdd6b4f4df6a15d3223de057ad4b9c (diff) |
Remove current state code, it's bogus. We'll redo this.
suggested by and ok moritz
Diffstat (limited to 'sbin/isakmpd')
-rw-r--r-- | sbin/isakmpd/monitor.c | 37 | ||||
-rw-r--r-- | sbin/isakmpd/monitor.h | 12 |
2 files changed, 5 insertions, 44 deletions
diff --git a/sbin/isakmpd/monitor.c b/sbin/isakmpd/monitor.c index 7fc242f0057..64c0bd79336 100644 --- a/sbin/isakmpd/monitor.c +++ b/sbin/isakmpd/monitor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: monitor.c,v 1.58 2005/05/28 18:38:38 moritz Exp $ */ +/* $OpenBSD: monitor.c,v 1.59 2005/05/28 18:48:12 hshoexer Exp $ */ /* * Copyright (c) 2003 Håkan Olsson. All rights reserved. @@ -60,7 +60,6 @@ struct monitor_state { volatile sig_atomic_t sigchlded = 0; extern volatile sig_atomic_t sigtermed; -static volatile sig_atomic_t cur_state = STATE_INIT; extern void set_slave_signals(void); @@ -77,8 +76,6 @@ static void m_priv_pfkey_open(void); static int m_priv_local_sanitize_path(char *, size_t, int); static int m_priv_check_sockopt(int, int); static int m_priv_check_bind(const struct sockaddr *, socklen_t); -static void m_priv_increase_state(int); -static void m_priv_test_state(int); static void set_monitor_signals(void); static void monitor_got_sigchld(int); @@ -453,13 +450,12 @@ monitor_loop(int debug) if (!debug) log_to(0); - while (cur_state < STATE_QUIT) { + for (;;) { /* * Currently, there is no need for us to hang around if the * child is in the process of shutting down. */ if (sigtermed) { - m_priv_increase_state(STATE_QUIT); kill(m_state.pid, SIGTERM); break; } @@ -471,7 +467,6 @@ monitor_loop(int debug) if (pid == m_state.pid && (WIFEXITED(status) || WIFSIGNALED(status))) { - m_priv_increase_state(STATE_QUIT); break; } } @@ -486,28 +481,24 @@ monitor_loop(int debug) case MONITOR_UI_INIT: LOG_DBG((LOG_MISC, 80, "monitor_loop: MONITOR_UI_INIT")); - m_priv_test_state(STATE_INIT); m_priv_ui_init(); break; case MONITOR_PFKEY_OPEN: LOG_DBG((LOG_MISC, 80, "monitor_loop: MONITOR_PFKEY_OPEN")); - m_priv_test_state(STATE_INIT); m_priv_pfkey_open(); break; case MONITOR_SETSOCKOPT: LOG_DBG((LOG_MISC, 80, "monitor_loop: MONITOR_SETSOCKOPT")); - m_priv_test_state(STATE_INIT); m_priv_setsockopt(); break; case MONITOR_BIND: LOG_DBG((LOG_MISC, 80, "monitor_loop: MONITOR_BIND")); - m_priv_test_state(STATE_INIT); m_priv_bind(); break; @@ -520,14 +511,11 @@ monitor_loop(int debug) case MONITOR_INIT_DONE: LOG_DBG((LOG_MISC, 80, "monitor_loop: MONITOR_INIT_DONE")); - m_priv_test_state(STATE_INIT); - m_priv_increase_state(STATE_RUNNING); break; case MONITOR_SHUTDOWN: LOG_DBG((LOG_MISC, 80, "monitor_loop: MONITOR_SHUTDOWN")); - m_priv_increase_state(STATE_QUIT); break; default: @@ -964,24 +952,3 @@ m_priv_req_readdir() return; } - -/* Increase state into less permissive mode */ -static void -m_priv_increase_state(int state) -{ - if (state <= cur_state) - log_print("m_priv_increase_state: attempt to decrease state " - "or match current state"); - if (state < STATE_INIT || state > STATE_QUIT) - log_print("m_priv_increase_state: attempt to switch to " - "invalid state"); - cur_state = state; -} - -static void -m_priv_test_state(int state) -{ - if (cur_state != state) - log_print("m_priv_test_state: Illegal state: %d != %d", - (int)cur_state, state); -} diff --git a/sbin/isakmpd/monitor.h b/sbin/isakmpd/monitor.h index 01f9d13a04f..f7146478268 100644 --- a/sbin/isakmpd/monitor.h +++ b/sbin/isakmpd/monitor.h @@ -1,4 +1,4 @@ -/* $OpenBSD: monitor.h,v 1.15 2005/05/28 17:42:50 moritz Exp $ */ +/* $OpenBSD: monitor.h,v 1.16 2005/05/28 18:48:12 hshoexer Exp $ */ /* * Copyright (c) 2003 Håkan Olsson. All rights reserved. @@ -30,8 +30,8 @@ #include <sys/types.h> #include <sys/stat.h> -#include <dirent.h> -#include <stdio.h> +//#include <dirent.h> +//#include <stdio.h> #define ISAKMPD_PRIVSEP_USER "_isakmpd" @@ -49,12 +49,6 @@ enum monitor_reqtypes { MONITOR_SHUTDOWN }; -enum priv_state { - STATE_INIT, /* just started */ - STATE_RUNNING, /* running */ - STATE_QUIT /* shutting down */ -}; - pid_t monitor_init(int); void monitor_loop(int); |