diff options
| author | Tobias Brunner <tobias@strongswan.org> | 2015-05-05 18:11:50 +0200 |
|---|---|---|
| committer | Tobias Brunner <tobias@strongswan.org> | 2015-05-08 19:05:26 +0200 |
| commit | 95faeaa7edc6a03b1818a37fd0fb79b5d7420d68 (patch) | |
| tree | 3f2137c1df28d0e71b96f5bef40c35ea3660bef3 /src/starter | |
| parent | 5923abc6bf51da7831c170f42d7b88e5c3990361 (diff) | |
| download | strongswan-95faeaa7edc6a03b1818a37fd0fb79b5d7420d68.tar.bz2 strongswan-95faeaa7edc6a03b1818a37fd0fb79b5d7420d68.tar.xz | |
starter: Ensure the daemon executable exists when starting up
The only purpose of starter is to control the IKE daemon, so we
terminate it if the daemon executable is not found (e.g. because
DAEMON_NAME is incorrect).
This removes the charonstart setting (it was not actually configurable
anymore).
Diffstat (limited to 'src/starter')
| -rw-r--r-- | src/starter/confread.c | 16 | ||||
| -rw-r--r-- | src/starter/confread.h | 1 | ||||
| -rw-r--r-- | src/starter/starter.c | 9 |
3 files changed, 8 insertions, 18 deletions
diff --git a/src/starter/confread.c b/src/starter/confread.c index 3943f9abe..c3a0ac07f 100644 --- a/src/starter/confread.c +++ b/src/starter/confread.c @@ -50,17 +50,6 @@ static const char firewall_defaults[] = IPSEC_SCRIPT " _updown iptables"; */ extern kw_entry_t *in_word_set (char *str, unsigned int len); -static bool daemon_exists(char *daemon, char *path) -{ - struct stat st; - if (stat(path, &st) != 0) - { - DBG1(DBG_APP, "Disabling %sstart option, '%s' not found", daemon, path); - return FALSE; - } - return TRUE; -} - /** * Process deprecated keywords */ @@ -147,10 +136,6 @@ static void load_setup(starter_config_t *cfg, conf_parser_t *parser) } enumerator->destroy(enumerator); dict->destroy(dict); - - /* verify the executables are actually available */ - cfg->setup.charonstart = cfg->setup.charonstart && - daemon_exists(daemon_name, cmd); } /* @@ -718,7 +703,6 @@ starter_config_t* confread_load(const char *file) INIT(cfg, .setup = { .uniqueids = TRUE, - .charonstart = TRUE, } ); diff --git a/src/starter/confread.h b/src/starter/confread.h index 0eea98849..457327f18 100644 --- a/src/starter/confread.h +++ b/src/starter/confread.h @@ -193,7 +193,6 @@ typedef struct starter_config starter_config_t; struct starter_config { struct { - bool charonstart; char *charondebug; bool uniqueids; bool cachecrls; diff --git a/src/starter/starter.c b/src/starter/starter.c index 74b5b5286..a19298923 100644 --- a/src/starter/starter.c +++ b/src/starter/starter.c @@ -517,6 +517,13 @@ int main (int argc, char **argv) exit(status); } + if (stat(cmd, &stb) != 0) + { + DBG1(DBG_APP, "IKE daemon '%s' not found", cmd); + cleanup(); + exit(LSB_RC_FAILURE); + } + DBG1(DBG_APP, "Starting %sSwan "VERSION" IPsec [starter]...", lib->settings->get_bool(lib->settings, "charon.i_dont_care_about_security_and_use_aggressive_mode_psk", @@ -836,7 +843,7 @@ int main (int argc, char **argv) */ if (_action_ & FLAG_ACTION_START_CHARON) { - if (cfg->setup.charonstart && !starter_charon_pid()) + if (!starter_charon_pid()) { DBG2(DBG_APP, "Attempting to start %s...", daemon_name); if (starter_start_charon(cfg, no_fork, attach_gdb)) |
