From 4ab4858d5473c816cc526b296ae9da6c6956219d Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 26 Feb 2013 01:02:35 +0100 Subject: Experimental support for accepting connections from unknown peers --- src/config.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/config.c') diff --git a/src/config.c b/src/config.c index c866b14..001cc2e 100644 --- a/src/config.c +++ b/src/config.c @@ -549,6 +549,7 @@ static void count_peers(fastd_context_t *ctx, fastd_config_t *conf) { OPTION_ARG(option_on_down, "--on-down", "", "Sets a shell command to execute before interface destruction") \ OPTION_ARG(option_on_establish, "--on-establish", "", "Sets a shell command to execute when a new connection is established") \ OPTION_ARG(option_on_disestablish, "--on-disestablish", "", "Sets a shell command to execute when a connection is lost") \ + OPTION_ARG(option_on_verify, "--on-verify", "", "Sets a shell command to execute to check an connection attempt by an unknown peer") \ OPTION(option_generate_key, "--generate-key", "Generates a new keypair") \ OPTION(option_show_key, "--show-key", "Shows the public key corresponding to the configured secret") \ OPTION(option_machine_readable, "--machine-readable", "Suppresses output of explaining text in the --show-key and --generate-key commands") @@ -781,6 +782,14 @@ static void option_on_disestablish(fastd_context_t *ctx, fastd_config_t *conf, c conf->on_disestablish_dir = get_current_dir_name(); } +static void option_on_verify(fastd_context_t *ctx, fastd_config_t *conf, const char *arg) { + free(conf->on_verify); + free(conf->on_verify_dir); + + conf->on_verify = strdup(arg); + conf->on_verify_dir = get_current_dir_name(); +} + static void option_daemon(fastd_context_t *ctx, fastd_config_t *conf) { conf->daemon = true; } @@ -1062,6 +1071,8 @@ void fastd_config_release(fastd_context_t *ctx, fastd_config_t *conf) { free(conf->on_establish_dir); free(conf->on_disestablish); free(conf->on_disestablish_dir); + free(conf->on_verify); + free(conf->on_verify_dir); free(conf->protocol_config); free(conf->log_syslog_ident); } -- cgit v1.2.3