[dovecot-cvs] dovecot/src/imap client.c,1.29,1.30 cmd-fetch.c,1.15,1.16 cmd-list.c,1.23,1.24 cmd-store.c,1.12,1.13

cras at procontrol.fi cras at procontrol.fi
Wed Jun 4 20:35:13 EEST 2003


Update of /home/cvs/dovecot/src/imap
In directory danu:/tmp/cvs-serv2496

Modified Files:
	client.c cmd-fetch.c cmd-list.c cmd-store.c 
Log Message:
Give more verbose protocol level errors + some fixes.



Index: client.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap/client.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- client.c	23 May 2003 14:40:50 -0000	1.29
+++ client.c	4 Jun 2003 16:35:11 -0000	1.30
@@ -143,7 +143,7 @@
 
 void client_send_command_error(struct client *client, const char *msg)
 {
-	const char *error;
+	const char *error, *cmd;
 	int fatal;
 
 	if (msg == NULL) {
@@ -153,7 +153,16 @@
 			return;
 		}
 	}
-	error = t_strconcat("BAD Error in IMAP command: ", msg, NULL);
+
+	if (client->cmd_tag == NULL)
+		error = t_strconcat("BAD Error in IMAP tag: ", msg, NULL);
+	else if (client->cmd_name == NULL)
+		error = t_strconcat("BAD Error in IMAP command: ", msg, NULL);
+	else {
+		cmd = str_ucase(t_strdup_noconst(client->cmd_name));
+		error = t_strconcat("BAD Error in IMAP command ",
+				    cmd, ": ", msg, NULL);
+	}
 
 	client->cmd_error = TRUE;
 	client_send_tagline(client, error);
@@ -242,11 +251,12 @@
 	for (i = 0; i < data_size; i++) {
 		if (data[i] == '\n') {
 			client->input_skip_line = FALSE;
-			i_stream_skip(client->input, i+1);
+			i++;
 			break;
 		}
 	}
 
+	i_stream_skip(client->input, i);
 	return !client->input_skip_line;
 }
 
@@ -296,8 +306,7 @@
 
 	if (client->cmd_func == NULL) {
 		/* unknown command */
-		client_send_command_error(client, t_strconcat(
-			"Unknown command '", client->cmd_name, "'", NULL));
+		client_send_command_error(client, "Unknown command.");
 		client->input_skip_line = TRUE;
 		_client_reset_command(client);
 	} else {

Index: cmd-fetch.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap/cmd-fetch.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- cmd-fetch.c	21 Feb 2003 18:13:14 -0000	1.15
+++ cmd-fetch.c	4 Jun 2003 16:35:11 -0000	1.16
@@ -324,7 +324,7 @@
 	messageset = imap_arg_string(&args[0]);
 	if (messageset == NULL ||
 	    (args[1].type != IMAP_ARG_LIST && args[1].type != IMAP_ARG_ATOM)) {
-		client_send_command_error(client, "Invalid FETCH arguments.");
+		client_send_command_error(client, "Invalid arguments.");
 		return TRUE;
 	}
 

Index: cmd-list.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap/cmd-list.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- cmd-list.c	2 Apr 2003 02:05:38 -0000	1.23
+++ cmd-list.c	4 Jun 2003 16:35:11 -0000	1.24
@@ -304,7 +304,7 @@
 	mask = imap_arg_string(&args[1]);
 
 	if (ref == NULL || mask == NULL) {
-		client_send_command_error(client, "Invalid FETCH arguments.");
+		client_send_command_error(client, "Invalid arguments.");
 		return TRUE;
 	}
 

Index: cmd-store.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap/cmd-store.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- cmd-store.c	21 Feb 2003 18:13:14 -0000	1.12
+++ cmd-store.c	4 Jun 2003 16:35:11 -0000	1.13
@@ -51,7 +51,7 @@
 	item = imap_arg_string(&args[1]);
 
 	if (messageset == NULL || item == NULL) {
-		client_send_command_error(client, "Invalid STORE arguments.");
+		client_send_command_error(client, "Invalid arguments.");
 		return TRUE;
 	}
 



More information about the dovecot-cvs mailing list