#include "connection.h"
#include "test-common.h"
#include "test-subprocess.h"
+#include "settings.h"
#include "smtp-server.h"
#include "smtp-client.h"
#include "smtp-client-connection.h"
struct test_server_data {
const struct smtp_server_settings *server_set;
+ struct settings_simple *settings;
};
static void test_open_server_fd(void)
i_close_fd(&fd_listen);
test_files_deinit();
main_deinit();
+
+ /* Cleanup the test settings in the server process as well.
+ See test_run_client_server() for the appropriate cleanup call in the
+ main process. */
+ settings_simple_deinit(data->settings);
return 0;
}
failure = NULL;
+ /* Add SSL settings by name into the basis of the SMTP server settings.
+ Otherwise the SMTP SNI mechanism will break when looking up the
+ relevant settings. */
+ const char *const settings[] = {
+ "ssl_ca", server_set->ssl->ca,
+ "ssl_cert", server_set->ssl->cert.cert,
+ "ssl_key", server_set->ssl->cert.key,
+ NULL,
+ };
+ struct settings_simple test_set;
+ settings_simple_init(&test_set, settings);
+ server_set->event_parent = test_set.event;
+
i_zero(&data);
data.server_set = server_set;
+ data.settings = &test_set;
test_files_init();
bind_port = 0;
test_subprocess_kill_all(SERVER_KILL_TIMEOUT_SECS);
test_files_deinit();
+
+ /* Cleanup the test settings in the main process.
+ Note: This needs to be called as well in the server process,
+ otherwise it will leak it's event and the looked up settings
+ struct. See test_run_server() for the appropriate cleanup call in
+ the server process. */
+ settings_simple_deinit(&test_set);
}
static void