* for more details.
*/
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include "parser.h"
#include "confread.h"
#include "args.h"
+#include "files.h"
#include "interfaces.h"
/* strings containing a colon are interpreted as an IPv6 address */
static const char firewall_defaults[] = "ipsec _updown iptables";
+static bool daemon_exists(char *daemon, char *path)
+{
+ struct stat st;
+ if (stat(path, &st) != 0)
+ {
+ plog("Disabling %sstart option, '%s' not found", daemon, path);
+ return FALSE;
+ }
+ return TRUE;
+}
+
static void default_values(starter_config_t *cfg)
{
if (cfg == NULL)
continue;
}
}
+
+ /* verify the executables are actually available (some distros split
+ * packages but enabled both) */
+#ifdef START_CHARON
+ cfg->setup.charonstart = cfg->setup.charonstart &&
+ daemon_exists("charon", CHARON_CMD);
+#else
+ cfg->setup.charonstart = FALSE;
+#endif
+#ifdef START_PLUTO
+ cfg->setup.plutostart = cfg->setup.plutostart &&
+ daemon_exists("pluto", PLUTO_CMD);
+#else
+ cfg->setup.plutostart = FALSE;
+#endif
}
static void kw_end(starter_conn_t *conn, starter_end_t *end, kw_token_t token,