From 5f8e52cbeb9e9126071643f52fba8e67e6d49242 Mon Sep 17 00:00:00 2001 From: Hans-Joerg Hoexer Date: Mon, 8 Nov 2004 12:34:01 +0000 Subject: more monitor cleanup: remove dead code, some debug messages, prototype monitor_close() to void. ok ho@ --- sbin/isakmpd/monitor.c | 73 +++++++++++--------------------------------------- sbin/isakmpd/monitor.h | 10 +++---- 2 files changed, 19 insertions(+), 64 deletions(-) (limited to 'sbin/isakmpd') diff --git a/sbin/isakmpd/monitor.c b/sbin/isakmpd/monitor.c index 7caa4dd2561..ec6481f9f88 100644 --- a/sbin/isakmpd/monitor.c +++ b/sbin/isakmpd/monitor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: monitor.c,v 1.31 2004/11/08 12:23:31 hshoexer Exp $ */ +/* $OpenBSD: monitor.c,v 1.32 2004/11/08 12:34:00 hshoexer Exp $ */ /* * Copyright (c) 2003 Håkan Olsson. All rights reserved. @@ -328,45 +328,6 @@ monitor_stat(const char *path, struct stat *sb) return r; } -int -monitor_socket(int domain, int type, int protocol) -{ - int s; - int32_t err; - - if (m_write_int32(m_state.s, MONITOR_GET_SOCKET)) - goto errout; - - if (m_write_int32(m_state.s, (int32_t)domain)) - goto errout; - - if (m_write_int32(m_state.s, (int32_t)type)) - goto errout; - - if (m_write_int32(m_state.s, (int32_t)protocol)) - goto errout; - - if (m_read_int32(m_state.s, &err)) - goto errout; - - if (err != 0) { - errno = (int)err; - return -1; - } - /* Read result. */ - s = mm_receive_fd(m_state.s); - if (s < 0) { - log_error("monitor_socket: mm_receive_fd () failed: %s", - strerror(errno)); - return -1; - } - return s; - -errout: - log_error("monitor_socket: problem talking to privileged process"); - return -1; -} - int monitor_setsockopt(int s, int level, int optname, const void *optval, socklen_t optlen) @@ -519,13 +480,11 @@ monitor_readdir(struct monitor_dirents *direntries) return NULL; } -int +void monitor_closedir(struct monitor_dirents *direntries) { free(direntries->dirents); free(direntries); - - return 0; } void @@ -634,48 +593,48 @@ monitor_loop(int debug) case MONITOR_UI_INIT: LOG_DBG((LOG_MISC, 80, - "%s: MONITOR_UI_INIT", - __func__)); + "monitor_loop: " + "MONITOR_UI_INIT")); m_priv_test_state(STATE_INIT); m_priv_ui_init(m_state.s); break; case MONITOR_PFKEY_OPEN: LOG_DBG((LOG_MISC, 80, - "%s: MONITOR_PFKEY_OPEN", - __func__)); + "monitor_loop: " + "MONITOR_PFKEY_OPEN")); m_priv_test_state(STATE_INIT); m_priv_pfkey_open(m_state.s); break; case MONITOR_GET_SOCKET: LOG_DBG((LOG_MISC, 80, - "%s: MONITOR_GET_SOCKET", - __func__)); + "monitor_loop: " + "MONITOR_GET_SOCKET")); m_priv_test_state(STATE_INIT); m_priv_getsocket(m_state.s); break; case MONITOR_SETSOCKOPT: LOG_DBG((LOG_MISC, 80, - "%s: MONITOR_SETSOCKOPT", - __func__)); + "monitor_loop: " + "MONITOR_SETSOCKOPT")); m_priv_test_state(STATE_INIT); m_priv_setsockopt(m_state.s); break; case MONITOR_BIND: LOG_DBG((LOG_MISC, 80, - "%s: MONITOR_BIND", - __func__)); + "monitor_loop: " + "MONITOR_BIND")); m_priv_test_state(STATE_INIT); m_priv_bind(m_state.s); break; case MONITOR_INIT_DONE: LOG_DBG((LOG_MISC, 80, - "%s: MONITOR_INIT_DONE", - __func__)); + "monitor_loop: " + "MONITOR_INIT_DONE")); m_priv_test_state(STATE_INIT); m_priv_increase_state( STATE_RUNNING); @@ -683,8 +642,8 @@ monitor_loop(int debug) case MONITOR_SHUTDOWN: LOG_DBG((LOG_MISC, 80, - "%s: MONITOR_SHUTDOWN", - __func__)); + "monitor_loop: " + "MONITOR_SHUTDOWN")); m_priv_increase_state( STATE_QUIT); break; diff --git a/sbin/isakmpd/monitor.h b/sbin/isakmpd/monitor.h index caea4ff052f..6bff7a25782 100644 --- a/sbin/isakmpd/monitor.h +++ b/sbin/isakmpd/monitor.h @@ -1,4 +1,4 @@ -/* $OpenBSD: monitor.h,v 1.11 2004/06/26 06:07:03 hshoexer Exp $ */ +/* $OpenBSD: monitor.h,v 1.12 2004/11/08 12:34:00 hshoexer Exp $ */ /* * Copyright (c) 2003 Håkan Olsson. All rights reserved. @@ -70,13 +70,11 @@ int mm_receive_fd(int); FILE *monitor_fopen(const char *, const char *); int monitor_open(const char *, int, mode_t); int monitor_stat(const char *, struct stat *); -int monitor_socket(int, int, int); int monitor_setsockopt(int, int, int, const void *, socklen_t); int monitor_bind(int, const struct sockaddr *, socklen_t); -int monitor_mkfifo(const char *, mode_t); struct monitor_dirents *monitor_opendir(const char *); struct dirent *monitor_readdir(struct monitor_dirents *); -int monitor_closedir(struct monitor_dirents *); +void monitor_closedir(struct monitor_dirents *); void monitor_init_done(void); void monitor_ui_init(void); @@ -88,17 +86,15 @@ void monitor_exit(int); #define monitor_fopen fopen #define monitor_open open #define monitor_stat stat -#define monitor_socket socket #define monitor_setsockopt setsockopt #define monitor_bind bind -#define monitor_mkfifo mkfifo #define monitor_opendir opendir #define monitor_readdir readdir #define monitor_closedir closedir #define monitor_ui_init ui_init -#define monitor_exit exit #define monitor_pf_key_v2_open pf_key_v2_open +#define monitor_exit exit #endif /* USE_PRIVSEP */ #endif /* _MONITOR_H_ */ -- cgit v1.2.3