[dovecot-cvs] dovecot/src/pop3 commands.c, 1.17, 1.18 common.h, 1.2, 1.3 main.c, 1.12, 1.13

cras at dovecot.org cras at dovecot.org
Sat Jul 10 20:24:11 EEST 2004


Update of /home/cvs/dovecot/src/pop3
In directory talvi:/tmp/cvs-serv6888/src/pop3

Modified Files:
	commands.c common.h main.c 
Log Message:
Split client_workarounds to imap_ and pop3_ ones. Added outlook-no-nuls POP3
workaround.



Index: commands.c
===================================================================
RCS file: /home/cvs/dovecot/src/pop3/commands.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- commands.c	23 Jun 2004 18:33:22 -0000	1.17
+++ commands.c	10 Jul 2004 17:24:09 -0000	1.18
@@ -242,6 +242,10 @@
 				add = '.';
 				i++;
 				break;
+			} else if (data[i] == '\0' &&
+				   (client_workarounds &
+				    WORKAROUND_OUTLOOK_NO_NULS) != 0) {
+				add = '\x80';
 			}
 		}
 
@@ -252,6 +256,10 @@
 			if (o_stream_send(output, &add, 1) < 0)
 				return;
 			last = add;
+			if (client_workarounds & WORKAROUND_OUTLOOK_NO_NULS) {
+				if (i < size && data[i] == '\0')
+					i++;
+			}
 		} else {
 			last = data[i-1];
 		}

Index: common.h
===================================================================
RCS file: /home/cvs/dovecot/src/pop3/common.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- common.h	26 Jul 2003 18:29:02 -0000	1.2
+++ common.h	10 Jul 2004 17:24:09 -0000	1.3
@@ -4,11 +4,12 @@
 #include "lib.h"
 #include "client.h"
 
-/* max. number of IMAP argument elements to accept. The maximum memory usage
-   for command from user is around MAX_INBUF_SIZE * MAX_IMAP_ARG_ELEMENTS */
-#define MAX_IMAP_ARG_ELEMENTS 128
+enum client_workarounds {
+	WORKAROUND_OUTLOOK_NO_NULS		= 0x01
+};
 
 extern struct ioloop *ioloop;
+extern enum client_workarounds client_workarounds;
 
 extern void (*hook_mail_storage_created)(struct mail_storage **storage);
 extern void (*hook_client_created)(struct client **client);

Index: main.c
===================================================================
RCS file: /home/cvs/dovecot/src/pop3/main.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- main.c	23 Jun 2004 17:48:35 -0000	1.12
+++ main.c	10 Jul 2004 17:24:09 -0000	1.13
@@ -16,6 +16,16 @@
 #define IS_STANDALONE() \
         (getenv("LOGGED_IN") == NULL)
 
+struct client_workaround_list {
+	const char *name;
+	enum client_workarounds num;
+};
+
+struct client_workaround_list client_workaround_list[] = {
+	{ "outlook-no-nuls", WORKAROUND_OUTLOOK_NO_NULS },
+	{ NULL, 0 }
+};
+
 struct ioloop *ioloop;
 
 void (*hook_mail_storage_created)(struct mail_storage **storage) = NULL;
@@ -23,12 +33,35 @@
 
 static struct module *modules;
 static char log_prefix[128]; /* syslog() needs this to be permanent */
+enum client_workarounds client_workarounds = 0;
 
 static void sig_quit(int signo __attr_unused__)
 {
 	io_loop_stop(ioloop);
 }
 
+static void parse_workarounds(void)
+{
+        struct client_workaround_list *list;
+	const char *env, *const *str;
+
+	env = getenv("POP3_CLIENT_WORKAROUNDS");
+	if (env == NULL)
+		return;
+
+	for (str = t_strsplit_spaces(env, " "); *str != NULL; str++) {
+		list = client_workaround_list;
+		for (; list->name != NULL; list++) {
+			if (strcasecmp(*str, list->name) == 0) {
+				client_workarounds |= list->num;
+				break;
+			}
+		}
+		if (list->name == NULL)
+			i_fatal("Unknown client workaround: %s", *str);
+	}
+}
+
 static void open_logfile(void)
 {
 	const char *user;
@@ -95,6 +128,7 @@
 		if (mail != NULL)
 			mail = t_strconcat("maildir:", mail, NULL);
 	}
+        parse_workarounds();
 
 	storage = mail_storage_create_with_data(mail, getenv("USER"),
 						NULL, '\0');



More information about the dovecot-cvs mailing list