changeset 13033:ac006833cd66

pop3: If mail storage couldn't be initialized, send -ERR to client before disconnecting.
author Timo Sirainen <tss@iki.fi>
date Mon, 16 May 2011 17:34:42 +0300
parents f786d95dc5c0
children d20588657ddc
files src/pop3/main.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/pop3/main.c	Mon May 16 17:29:40 2011 +0300
+++ b/src/pop3/main.c	Mon May 16 17:34:42 2011 +0300
@@ -14,6 +14,7 @@
 #include "master-login.h"
 #include "master-interface.h"
 #include "var-expand.h"
+#include "mail-error.h"
 #include "mail-user.h"
 #include "mail-storage-service.h"
 
@@ -88,14 +89,18 @@
 			 int fd_in, int fd_out, const buffer_t *input_buf,
 			 const char **error_r)
 {
+	const char *lookup_error_str =
+		"-ERR [IN-USE] "MAIL_ERRSTR_CRITICAL_MSG"\r\n";
 	struct mail_storage_service_user *user;
 	struct mail_user *mail_user;
 	struct client *client;
 	const struct pop3_settings *set;
 
 	if (mail_storage_service_lookup_next(storage_service, input,
-					     &user, &mail_user, error_r) <= 0)
+					     &user, &mail_user, error_r) <= 0) {
+		(void)write(fd_out, lookup_error_str, strlen(lookup_error_str));
 		return -1;
+	}
 	restrict_access_allow_coredumps(TRUE);
 
 	set = mail_storage_service_user_get_set(user)[1];