fix three crashing bugs, bump PKGNAME

- searching address fields can crash sometimes
- auth process crashes if user doesn't have home directory set
- sme BODY and BODYSTRUCTURE replies missed data for message/rfc822 MIME
  parts causing clients to break
This commit is contained in:
jolan 2003-09-23 06:34:32 +00:00
parent 8ae374c948
commit 34678ea2bf
5 changed files with 135 additions and 2 deletions

View File

@ -1,8 +1,8 @@
# $OpenBSD: Makefile,v 1.2 2003/07/23 06:03:00 jolan Exp $
# $OpenBSD: Makefile,v 1.3 2003/09/23 06:34:32 jolan Exp $
COMMENT= "compact IMAP/POP3 server"
DISTNAME= dovecot-0.99.10
PKGNAME= ${DISTNAME}p0
PKGNAME= ${DISTNAME}p1
CATEGORIES= mail
MASTER_SITES= ${HOMEPAGE}

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-src_auth_master-connection_c,v 1.1 2003/09/23 06:34:32 jolan Exp $
--- src/auth/master-connection.c.orig 2003-05-26 10:27:13.000000000 -0500
+++ src/auth/master-connection.c 2003-09-23 00:45:29.000000000 -0500
@@ -55,7 +55,7 @@ fill_reply(const struct user_data *user,
reply.virtual_user_idx = reply_add(buf, user->virtual_user);
reply.mail_idx = reply_add(buf, user->mail);
- p = strstr(user->home, "/./");
+ p = user->home != NULL ? strstr(user->home, "/./") : NULL;
if (p == NULL) {
reply.home_idx = reply_add(buf, user->home);
reply.chroot_idx = reply_add(buf, NULL);

View File

@ -0,0 +1,68 @@
$OpenBSD: patch-src_lib-imap_imap-bodystructure_c,v 1.1 2003/09/23 06:34:32 jolan Exp $
--- src/lib-imap/imap-bodystructure.c.orig 2003-06-24 18:12:56.000000000 -0500
+++ src/lib-imap/imap-bodystructure.c 2003-09-23 00:45:51.000000000 -0500
@@ -365,18 +365,23 @@ static void part_write_body(struct messa
data = t_new(struct message_part_body_data, 1);
}
- /* "content type" "subtype" */
- str_append(str, NVL(data->content_type, "\"text\""));
- str_append_c(str, ' ');
- if (data->content_subtype != NULL)
- str_append(str, data->content_subtype);
+ if (part->flags & MESSAGE_PART_FLAG_MESSAGE_RFC822)
+ str_append(str, "\"message\" \"rfc822\"");
else {
- if (data->content_type == NULL ||
- strcasecmp(data->content_type, "\"text\"") == 0)
- str_append(str, "\"plain\"");
- else
- str_append(str, "\"unknown\"");
+ /* "content type" "subtype" */
+ str_append(str, NVL(data->content_type, "\"text\""));
+ str_append_c(str, ' ');
+ if (data->content_subtype != NULL)
+ str_append(str, data->content_subtype);
+ else {
+ if (data->content_type == NULL ||
+ strcasecmp(data->content_type, "\"text\"") == 0)
+ str_append(str, "\"plain\"");
+ else
+ str_append(str, "\"unknown\"");
+
+ }
}
/* ("content type param key" "value" ...) */
@@ -405,23 +410,18 @@ static void part_write_body(struct messa
} else if (part->flags & MESSAGE_PART_FLAG_MESSAGE_RFC822) {
/* message/rfc822 contains envelope + body + line count */
struct message_part_body_data *child_data;
+ struct message_part_envelope_data *env_data;
i_assert(part->children != NULL);
i_assert(part->children->next == NULL);
- child_data = part->children->context;
+ child_data = part->children->context;
+ env_data = child_data != NULL ? child_data->envelope : NULL;
+
+ str_append(str, " (");
+ imap_envelope_write_part_data(env_data, str);
+ str_append(str, ") ");
- str_append_c(str, ' ');
- if (child_data != NULL && child_data->envelope != NULL) {
- str_append_c(str, '(');
- imap_envelope_write_part_data(child_data->envelope,
- str);
- str_append_c(str, ')');
- } else {
- /* buggy message */
- str_append(str, "NIL");
- }
- str_append_c(str, ' ');
part_write_bodystructure(part->children, str, extended);
str_printfa(str, " %u", part->body_size.lines);
}

View File

@ -0,0 +1,18 @@
$OpenBSD: patch-src_lib-imap_imap-envelope_c,v 1.1 2003/09/23 06:34:32 jolan Exp $
--- src/lib-imap/imap-envelope.c.orig 2003-06-24 18:12:56.000000000 -0500
+++ src/lib-imap/imap-envelope.c 2003-09-23 00:45:51.000000000 -0500
@@ -173,6 +173,14 @@ static void imap_write_address(string_t
void imap_envelope_write_part_data(struct message_part_envelope_data *data,
string_t *str)
{
+ static const char *empty_envelope =
+ "NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL";
+
+ if (data == NULL) {
+ str_append(str, empty_envelope);
+ return;
+ }
+
str_append(str, NVL(data->date, "NIL"));
str_append_c(str, ' ');
str_append(str, NVL(data->subject, "NIL"));

View File

@ -0,0 +1,35 @@
$OpenBSD: patch-src_lib-mail_message-address_c,v 1.1 2003/09/23 06:34:32 jolan Exp $
--- src/lib-mail/message-address.c.orig 2003-03-20 09:46:34.000000000 -0600
+++ src/lib-mail/message-address.c 2003-09-23 00:45:01.000000000 -0500
@@ -252,14 +252,14 @@ void message_address_write(string_t *str
} else if ((addr->name == NULL || *addr->name == '\0') &&
addr->route == NULL) {
i_assert(addr->mailbox != NULL);
- i_assert(addr->domain != NULL);
str_append(str, addr->mailbox);
- str_append_c(str, '@');
- str_append(str, addr->domain);
+ if (addr->domain != NULL) {
+ str_append_c(str, '@');
+ str_append(str, addr->domain);
+ }
} else {
i_assert(addr->mailbox != NULL);
- i_assert(addr->domain != NULL);
if (addr->name != NULL) {
str_append(str, addr->name);
@@ -272,8 +272,10 @@ void message_address_write(string_t *str
str_append_c(str, ':');
}
str_append(str, addr->mailbox);
- str_append_c(str, '@');
- str_append(str, addr->domain);
+ if (addr->domain != NULL) {
+ str_append_c(str, '@');
+ str_append(str, addr->domain);
+ }
str_append_c(str, '>');
}