diff options
author | Hans-Joerg Hoexer <hshoexer@cvs.openbsd.org> | 2006-03-20 16:43:23 +0000 |
---|---|---|
committer | Hans-Joerg Hoexer <hshoexer@cvs.openbsd.org> | 2006-03-20 16:43:23 +0000 |
commit | b668ce81c0061c6c3b0f62d1cfb2b3ae10d9527a (patch) | |
tree | 449c50ae1aefc6174d3ee81413a158ff42d83de0 /sbin/isakmpd/monitor.c | |
parent | 476bf8f7fcedcb4bc23b900715716f3fac897fdb (diff) |
make sure the command fifo is ready before isakmpd returns. This
resolves a startup race when interacting with ipsecctl. Suggested
by and discussed with moritz@
ok moritz@
Diffstat (limited to 'sbin/isakmpd/monitor.c')
-rw-r--r-- | sbin/isakmpd/monitor.c | 58 |
1 files changed, 4 insertions, 54 deletions
diff --git a/sbin/isakmpd/monitor.c b/sbin/isakmpd/monitor.c index 84686c61268..ad98eb42478 100644 --- a/sbin/isakmpd/monitor.c +++ b/sbin/isakmpd/monitor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: monitor.c,v 1.63 2006/01/02 10:42:51 hshoexer Exp $ */ +/* $OpenBSD: monitor.c,v 1.64 2006/03/20 16:43:22 hshoexer Exp $ */ /* * Copyright (c) 2003 Håkan Olsson. All rights reserved. @@ -70,11 +70,10 @@ static void m_priv_getfd(void); static void m_priv_setsockopt(void); static void m_priv_req_readdir(void); static void m_priv_bind(void); -static void m_priv_ui_init(void); 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 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 set_monitor_signals(void); static void sig_pass_to_chld(int); @@ -167,25 +166,6 @@ monitor_exit(int code) exit(code); } -void -monitor_ui_init(void) -{ - int err, cmd; - - cmd = MONITOR_UI_INIT; - must_write(&cmd, sizeof cmd); - - must_read(&err, sizeof err); - if (err != 0) - log_fatal("monitor_ui_init: parent could not create FIFO " - "\"%s\"", ui_fifo); - - ui_socket = mm_receive_fd(m_state.s); - if (ui_socket < 0) - log_fatal("monitor_ui_init: parent could not create FIFO " - "\"%s\"", ui_fifo); -} - int monitor_pf_key_v2_open(void) { @@ -452,12 +432,6 @@ monitor_loop(int debug) m_priv_getfd(); break; - case MONITOR_UI_INIT: - LOG_DBG((LOG_MISC, 80, - "monitor_loop: MONITOR_UI_INIT")); - m_priv_ui_init(); - break; - case MONITOR_PFKEY_OPEN: LOG_DBG((LOG_MISC, 80, "monitor_loop: MONITOR_PFKEY_OPEN")); @@ -504,30 +478,6 @@ monitor_loop(int debug) /* Privileged: called by monitor_loop. */ static void -m_priv_ui_init(void) -{ - int err = 0; - - ui_init(); - - if (ui_socket < 0) - err = -1; - - must_write(&err, sizeof err); - - if (ui_socket >= 0 && mm_send_fd(m_state.s, ui_socket)) { - log_error("m_priv_ui_init: read/write operation failed"); - close(ui_socket); - return; - } - - /* In case of stdin, we do not close the socket. */ - if (ui_socket > 0) - close(ui_socket); -} - -/* Privileged: called by monitor_loop. */ -static void m_priv_pfkey_open(void) { int fd, err = 0; |