diff src/imap-login/client-authenticate.c @ 2097:4e77cb0aff21 HEAD

Added %l, %r and %P variables and mail_log_prefix setting.
author Timo Sirainen <tss@iki.fi>
date Mon, 31 May 2004 21:04:46 +0300
parents 4d0834aaa365
children 6b05e30c669a
line wrap: on
line diff
--- a/src/imap-login/client-authenticate.c	Mon May 31 00:15:19 2004 +0300
+++ b/src/imap-login/client-authenticate.c	Mon May 31 21:04:46 2004 +0300
@@ -107,8 +107,6 @@
 {
 	struct imap_client *client = context;
 	const char *error;
-	const void *ptr;
-	size_t size;
 
 	switch (auth_callback(request, reply, data, &client->common,
 			      master_callback, &error)) {
@@ -141,7 +139,8 @@
 int cmd_login(struct imap_client *client, struct imap_arg *args)
 {
 	const char *user, *pass, *error;
-	string_t *str;
+	struct auth_request_info info;
+	string_t *plain_login;
 
 	/* two arguments: username and password */
 	if (args[0].type != IMAP_ARG_ATOM && args[0].type != IMAP_ARG_STRING)
@@ -165,20 +164,26 @@
 	}
 
 	/* authorization ID \0 authentication ID \0 pass */
-	str = t_str_new(64);
-	str_append_c(str, '\0');
-	str_append(str, user);
-	str_append_c(str, '\0');
-	str_append(str, pass);
+	plain_login = t_str_new(64);
+	str_append_c(plain_login, '\0');
+	str_append(plain_login, user);
+	str_append_c(plain_login, '\0');
+	str_append(plain_login, pass);
+
+	memset(&info, 0, sizeof(info));
+	info.mech = "PLAIN";
+	info.protocol = "IMAP";
+	info.flags = client_get_auth_flags(client);
+	info.local_ip = client->common.local_ip;
+	info.remote_ip = client->common.ip;
+	info.initial_resp_data = str_data(plain_login);
+	info.initial_resp_size = str_len(plain_login);
 
 	client_ref(client);
 
 	client->common.auth_request =
-		auth_client_request_new(auth_client, "PLAIN", "IMAP",
-					client_get_auth_flags(client),
-					str_data(str), str_len(str),
-					login_callback,
-					client, &error);
+		auth_client_request_new(auth_client, &info,
+					login_callback, client, &error);
 	if (client->common.auth_request == NULL) {
 		client_send_tagline(client, t_strconcat(
 			"NO Login failed: ", error, NULL));
@@ -278,6 +283,7 @@
 {
 	const struct auth_mech_desc *mech;
 	const char *mech_name, *error;
+	struct auth_request_info info;
 
 	/* we want only one argument: authentication mechanism name */
 	if (args[0].type != IMAP_ARG_ATOM && args[0].type != IMAP_ARG_STRING)
@@ -302,12 +308,17 @@
 		return TRUE;
 	}
 
+	memset(&info, 0, sizeof(info));
+	info.mech = mech->name;
+	info.protocol = "IMAP";
+	info.flags = client_get_auth_flags(client);
+	info.local_ip = client->common.local_ip;
+	info.remote_ip = client->common.ip;
+
 	client_ref(client);
 	client->common.auth_request =
-		auth_client_request_new(auth_client, mech->name, "IMAP",
-					client_get_auth_flags(client),
-					NULL, 0, authenticate_callback,
-					client, &error);
+		auth_client_request_new(auth_client, &info,
+					authenticate_callback, client, &error);
 	if (client->common.auth_request != NULL) {
 		/* following input data will go to authentication */
 		if (client->common.io != NULL)