[dovecot-cvs] dovecot/src/imap-login client-authenticate.c, 1.18, 1.19 client.c, 1.25, 1.26 client.h, 1.8, 1.9

cras at procontrol.fi cras at procontrol.fi
Mon May 31 21:04:50 EEST 2004


Update of /home/cvs/dovecot/src/imap-login
In directory talvi:/tmp/cvs-serv4696/src/imap-login

Modified Files:
	client-authenticate.c client.c client.h 
Log Message:
Added %l, %r and %P variables and mail_log_prefix setting.



Index: client-authenticate.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap-login/client-authenticate.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- a/client-authenticate.c	30 May 2004 04:41:27 -0000	1.18
+++ b/client-authenticate.c	31 May 2004 18:04:47 -0000	1.19
@@ -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)

Index: client.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap-login/client.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- a/client.c	30 May 2004 04:41:27 -0000	1.25
+++ b/client.c	31 May 2004 18:04:47 -0000	1.26
@@ -348,7 +348,8 @@
 	}
 }
 
-struct client *client_create(int fd, struct ip_addr *ip, int ssl)
+struct client *client_create(int fd, int ssl, const struct ip_addr *local_ip,
+			     const struct ip_addr *ip)
 {
 	struct imap_client *client;
 	const char *addr;
@@ -373,6 +374,7 @@
 		(IPADDR_IS_V4(ip) && strncmp(addr, "127.", 4) == 0) ||
 		(IPADDR_IS_V6(ip) && strcmp(addr, "::1") == 0);
 
+	client->common.local_ip = *local_ip;
 	client->common.ip = *ip;
 	client->common.fd = fd;
 

Index: client.h
===================================================================
RCS file: /home/cvs/dovecot/src/imap-login/client.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- a/client.h	30 May 2004 04:41:27 -0000	1.8
+++ b/client.h	31 May 2004 18:04:47 -0000	1.9
@@ -29,7 +29,6 @@
 	unsigned int destroyed:1;
 };
 
-struct client *client_create(int fd, struct ip_addr *ip, int ssl);
 void client_destroy(struct imap_client *client, const char *reason);
 
 void client_send_line(struct imap_client *client, const char *line);



More information about the dovecot-cvs mailing list