summaryrefslogtreecommitdiff
path: root/mail/cyrus-imapd/patches/patch-al
blob: 642918e523cea75fccabaf8c5f7bb288d269f6a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
$NetBSD: patch-al,v 1.3 2007/03/09 14:46:08 obache Exp $

--- imtest/imtest.c.orig	2006-01-21 05:31:23.000000000 +0900
+++ imtest/imtest.c
@@ -47,7 +47,9 @@
 #include <sys/time.h>
 #include <sys/types.h>
 #include <sys/ipc.h>
+#if !defined(__APPLE__)
 #include <sys/msg.h>
+#endif
 #include <sys/stat.h>
 #include <fcntl.h>
 
@@ -72,6 +74,10 @@
 #include <netinet/in.h>
 #include <netdb.h>
 
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+
 #include <sasl/sasl.h>
 #include <sasl/saslutil.h>
 
@@ -886,6 +892,12 @@ imt_stat getauthline(struct sasl_cmd_t *
     }
     
     if (*str != '\r') {
+	/* trim CRLF */
+	char *p = str + strlen(str) - 1;
+	if (p >= str && *p == '\n') *p-- = '\0';
+	if (p >= str && *p == '\r') *p-- = '\0';
+
+	/* alloc space for decoded response */
 	len = strlen(str) + 1;
 	*line = malloc(len);
 	if ((*line) == NULL) {