/* server */
static int
-test_authentication_failed_input_line(struct server_connection *conn,
+test_authentication_input_line(struct server_connection *conn,
const char *line ATTR_UNUSED)
{
switch (conn->state) {
return 0;
}
-static void test_server_authentication_failed(unsigned int index)
+static void test_server_authentication(unsigned int index)
{
- test_server_input_line = test_authentication_failed_input_line;
+ test_server_input_line = test_authentication_input_line;
test_server_run(index);
}
/* client */
-struct _authentication_failed {
+struct _authentication {
unsigned int count;
};
-struct _authentication_failed_peer {
- struct _authentication_failed *context;
+struct _authentication_peer {
+ struct _authentication *context;
unsigned int index;
struct smtp_client_connection *conn;
};
static void
-test_client_authentication_failed_login_cb(const struct smtp_reply *reply,
+test_client_authentication_login_cb(const struct smtp_reply *reply,
void *context)
{
- struct _authentication_failed_peer *pctx =
- (struct _authentication_failed_peer *)context;
+ struct _authentication_peer *pctx =
+ (struct _authentication_peer *)context;
if (debug) {
i_debug("LOGIN REPLY[%u]: %s",
}
static void
-test_client_authentication_failed_mail_from_cb(
+test_client_authentication_mail_from_cb(
const struct smtp_reply *reply,
- struct _authentication_failed_peer *pctx)
+ struct _authentication_peer *pctx)
{
if (debug) {
i_debug("MAIL FROM REPLY[%u]: %s",
}
static void
-test_client_authentication_failed_rcpt_to_cb(
+test_client_authentication_rcpt_to_cb(
const struct smtp_reply *reply,
- struct _authentication_failed_peer *pctx)
+ struct _authentication_peer *pctx)
{
if (debug) {
i_debug("RCPT TO REPLY[%u]: %s",
}
static void
-test_client_authentication_failed_rcpt_data_cb(
+test_client_authentication_rcpt_data_cb(
const struct smtp_reply *reply,
- struct _authentication_failed_peer *pctx)
+ struct _authentication_peer *pctx)
{
if (debug) {
i_debug("RCPT DATA REPLY[%u]: %s",
}
static void
-test_client_authentication_failed_data_cb(
+test_client_authentication_data_cb(
const struct smtp_reply *reply,
- struct _authentication_failed_peer *pctx)
+ struct _authentication_peer *pctx)
{
if (debug) {
i_debug("DATA REPLY[%u]: %s",
}
static void
-test_client_authentication_failed_finished(
- struct _authentication_failed_peer *pctx)
+test_client_authentication_finished(
+ struct _authentication_peer *pctx)
{
- struct _authentication_failed *ctx = pctx->context;
+ struct _authentication *ctx = pctx->context;
if (debug)
i_debug("FINISHED[%u]", pctx->index);
}
static void
-test_client_authentication_failed_submit(struct _authentication_failed *ctx,
+test_client_authentication_submit(struct _authentication *ctx,
unsigned int index)
{
- struct _authentication_failed_peer *pctx;
+ struct _authentication_peer *pctx;
struct smtp_client_settings smtp_set;
static const char *message =
"From: stephan@example.com\r\n"
"Frop!\r\n";
struct istream *input;
- pctx = i_new(struct _authentication_failed_peer, 1);
+ pctx = i_new(struct _authentication_peer, 1);
pctx->context = ctx;
pctx->index = index;
pctx->conn, &((struct smtp_address){
.localpart = "sender",
.domain = "example.com"}), NULL, 0,
- test_client_authentication_failed_finished, pctx);
+ test_client_authentication_finished, pctx);
smtp_client_connection_connect(
- pctx->conn, test_client_authentication_failed_login_cb,
+ pctx->conn, test_client_authentication_login_cb,
(void *)pctx);
smtp_client_transaction_start(
- pctx->trans, test_client_authentication_failed_mail_from_cb,
+ pctx->trans, test_client_authentication_mail_from_cb,
pctx);
smtp_client_connection_unref(&pctx->conn);
pctx->trans, &((struct smtp_address){
.localpart = "rcpt",
.domain = "example.com"}), NULL,
- test_client_authentication_failed_rcpt_to_cb,
- test_client_authentication_failed_rcpt_data_cb, pctx);
+ test_client_authentication_rcpt_to_cb,
+ test_client_authentication_rcpt_data_cb, pctx);
input = i_stream_create_from_data(message, strlen(message));
i_stream_set_name(input, "message");
smtp_client_transaction_send(
pctx->trans, input,
- test_client_authentication_failed_data_cb, pctx);
+ test_client_authentication_data_cb, pctx);
i_stream_unref(&input);
}
static bool
-test_client_authentication_failed(const struct smtp_client_settings *client_set)
+test_client_authentication(const struct smtp_client_settings *client_set)
{
- struct _authentication_failed *ctx;
+ struct _authentication *ctx;
unsigned int i;
test_expect_errors(2);
- ctx = i_new(struct _authentication_failed, 1);
+ ctx = i_new(struct _authentication, 1);
ctx->count = 2;
smtp_client = smtp_client_init(client_set);
for (i = 0; i < ctx->count; i++)
- test_client_authentication_failed_submit(ctx, i);
+ test_client_authentication_submit(ctx, i);
return TRUE;
}
/* test */
-static void test_authentication_failed(void)
+static void test_authentication(void)
{
struct smtp_client_settings smtp_client_set;
test_client_defaults(&smtp_client_set);
- test_begin("authentication failed");
+ test_begin("authentication");
test_run_client_server(&smtp_client_set,
- test_client_authentication_failed,
- test_server_authentication_failed, 2, NULL);
+ test_client_authentication,
+ test_server_authentication, 2, NULL);
test_end();
}
test_dns_service_failure,
test_dns_timeout,
test_dns_lookup_failure,
- test_authentication_failed,
+ test_authentication,
test_transaction_timeout,
#ifdef HAVE_OPENSSL
test_invalid_ssl_certificate,