summaryrefslogtreecommitdiff
path: root/mail/popper/files/patch-ai
blob: 9ffe31905f9e8af5a2207fcd4399780ced726c47 (plain) (blame)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
--- pop_dropcopy.c.orig	Sun Feb 18 12:27:19 2001
+++ pop_dropcopy.c	Sun Feb 18 12:29:39 2001
@@ -471,8 +471,10 @@
 		    *cp++ = '\n';
 		    *cp   = '\0';
 
-		    mp->length += strlen("X-UIDL: ") + strlen(mp->uidl_str) + 1;
-		    p->drop_size += strlen("X-UIDL: ") + strlen(mp->uidl_str)+1;
+		    i = strlen("X-UIDL: ") + (DIG_SIZE * 2) + 2;
+		    mp->length += i;
+		    p->drop_size += i;
+		    mp->lines++;
 
 	/* New UIDs do not dirty the mailspool if NO_STATUS is set.  They
 	   are just recalculated each time the popper is run or LMOS is
@@ -483,9 +485,11 @@
 #endif
 		}
 
-	    } else if (CONTENT_LENGTH && !strncmp(buffer, "Content-Length:", 15)) {
-		cont_len = atoi(buffer + 15);
-		MD5Update(&mdContext,(unsigned char *)buffer,strlen(buffer));
+	    } else if (!strncasecmp(buffer, "Content-Length:", 15)) {
+		if (CONTENT_LENGTH) {
+		    cont_len = atoi(buffer + 15);
+		    MD5Update(&mdContext,(unsigned char *)buffer,strlen(buffer));
+		}
 		continue;	/* not part of the message size */
 	    } else if (!uidl_found && (!strncasecmp("Received:", buffer, 9) ||
 				       !strncasecmp("Date:", buffer, 5) ||
@@ -504,8 +508,10 @@
 		    if( (len = strlen(cp)) > MIN_UIDL_LENGTH && len < MAX_UIDL_LENGTH ) {
 			uidl_found++;
 			mp->uidl_str = (char *)strdup(cp);
-			mp->length += nchar + 1;
-			p->drop_size += nchar + 1;
+			len += strlen("X-UIDL: ") + 1;
+			mp->length += len;
+			p->drop_size += len;
+			mp->lines++;
 		    }
 		}
 		continue;  /* Do not include this value in the message size */
@@ -717,8 +723,10 @@
 		    *cp++ = '\n';
 		    *cp   = '\0';
 
-		    mp->length += strlen("X-UIDL: ") + strlen(mp->uidl_str) + 1;
-		    p->drop_size += strlen("X-UIDL: ") + strlen(mp->uidl_str)+1;
+		    i = strlen("X-UIDL: ") + (DIG_SIZE * 2) + 2;
+		    mp->length += i;
+		    p->drop_size += i;
+		    mp->lines++;
 
 	/* New UIDs do not dirty the mailspool if NO_STATUS is set.  They
 	   are just recalculated each time the popper is run or LMOS is
@@ -729,11 +737,12 @@
 #endif
 		}
 
-	    } else if (CONTENT_LENGTH && !strncmp(buffer, "Content-Length:", 15)) {
-		cont_len = atoi(buffer + 15);
-		MD5Update(&mdContext,(unsigned char *)buffer,strlen(buffer));
+	    } else if (!strncasecmp(buffer, "Content-Length:", 15)) {
+		if (CONTENT_LENGTH) {
+		    cont_len = atoi(buffer + 15);
+		    MD5Update(&mdContext,(unsigned char *)buffer,strlen(buffer));
+		}
 		continue;  /* Not included in message size */
-
 	    } else if (!uidl_found && (!strncasecmp("Received:", buffer, 9) ||
 				       !strncasecmp("Date:", buffer, 5) ||
 				       !strncasecmp("Message-Id:",buffer, 11) ||
@@ -745,16 +754,16 @@
 		    int len;
 		    char *cp;
 
-		    uidl_found++;
-
 		    /* Skip over header */
 		    cp = &buffer[7];
                     while (*cp && (*cp == ' ' || *cp == '\t')) cp++;
 		    if( (len = strlen(cp)) > MIN_UIDL_LENGTH && len < MAX_UIDL_LENGTH ) {
 			uidl_found++;
 			mp->uidl_str = (char *)strdup(cp);
-			mp->length += nchar + 1;
-			p->drop_size += nchar + 1;
+			len += strlen("X-UIDL: ") + 1;
+			mp->length += len;
+			p->drop_size += len;
+			mp->lines++;
 		    }
 		}
 		continue;  /* Do not include this value in the message size */