1
diff -cr alpine.orig/alpine-1.10/alpine/send.c alpine.new/alpine-1.10/alpine/send.c
2
*** alpine.orig/alpine-1.10/alpine/send.c 2008-02-08 17:43:23.000000000 +0000
3
--- alpine.new/alpine-1.10/alpine/send.c 2008-06-19 09:24:42.000000000 +0100
7
pbf = save_previous_pbuf;
10
+ /* Topal: Unmangle the body types. */
11
+ if ((*body)->type == TYPEMULTIPART
12
+ && (*body)->topal_hack == 1) {
13
+ /* This was a single part message which Topal mangled. */
14
+ dprint((9, "Topal: unmangling single part message\n"));
15
+ (*body)->type = TYPETEXT;
17
+ if ((*body)->type == TYPEMULTIPART
18
+ && (*body)->topal_hack != 1
19
+ && (*body)->nested.part->body.type == TYPEMULTIPART
20
+ && (*body)->nested.part->body.topal_hack == 1) {
21
+ /* Topal mangled a multipart message. So the first nested part
22
+ is really TYPETEXT. */
23
+ dprint((9, "Topal: unmangling first part of multipart message\n"));
24
+ (*body)->nested.part->body.type = TYPETEXT;
27
dprint((4, "=== send returning ===\n"));
33
rfc822_parse_content_header(nb,
34
(char *) ucase((unsigned char *) buf+8),s);
35
if(nb->type == TYPETEXT
38
|| strucmp(b->subtype, nb->subtype))){
40
! fs_give((void **) &b->subtype);
42
b->subtype = nb->subtype;
45
mail_free_body_parameter(&b->parameter);
46
b->parameter = nb->parameter;
48
mail_free_body_parameter(&nb->parameter);
56
rfc822_parse_content_header(nb,
57
(char *) ucase((unsigned char *) buf+8),s);
58
+ /* Topal: We're working on the first
59
+ text segment of the message. If
60
+ the filter returns something that
61
+ isn't TYPETEXT, then we need to
62
+ pretend (later on) that this is in
63
+ fact a TYPETEXT, because Topal has
64
+ already encoded it....
66
+ Original code path first, then an
69
if(nb->type == TYPETEXT
72
|| strucmp(b->subtype, nb->subtype))){
74
! fs_give((void **) &b->subtype);
76
! b->subtype = nb->subtype;
79
! mail_free_body_parameter(&b->parameter);
80
! b->parameter = nb->parameter;
81
! nb->parameter = NULL;
82
! mail_free_body_parameter(&nb->parameter);
84
! else if(F_ON(F_ENABLE_TOPAL_HACK, ps_global)){
85
! /* Perhaps the type isn't TYPETEXT,
86
! and the hack is requested. So,
87
! let's mess with the types. */
88
! if(nb->type != TYPETEXT){
90
b->subtype = nb->subtype;
93
! dprint((9, "Topal: mangling body!\n"));
94
mail_free_body_parameter(&b->parameter);
95
b->parameter = nb->parameter;
97
mail_free_body_parameter(&nb->parameter);
105
Only in alpine.new/alpine-1.10/alpine: send.c.orig
106
diff -cr alpine.orig/alpine-1.10/imap/src/c-client/mail.h alpine.new/alpine-1.10/imap/src/c-client/mail.h
107
*** alpine.orig/alpine-1.10/imap/src/c-client/mail.h 2008-02-15 19:04:45.000000000 +0000
108
--- alpine.new/alpine-1.10/imap/src/c-client/mail.h 2008-06-19 09:24:42.000000000 +0100
112
unsigned long bytes; /* size of text in octets */
114
char *md5; /* MD5 checksum */
115
+ unsigned short topal_hack; /* set to 1 if topal has wrecked the sending */
116
void *sparep; /* spare pointer reserved for main program */
119
diff -cr alpine.orig/alpine-1.10/pith/conf.c alpine.new/alpine-1.10/pith/conf.c
120
*** alpine.orig/alpine-1.10/pith/conf.c 2008-03-14 18:15:38.000000000 +0000
121
--- alpine.new/alpine-1.10/pith/conf.c 2008-06-19 09:26:41.000000000 +0100
125
F_SEND_WO_CONFIRM, h_config_send_wo_confirm, PREF_SEND, 0},
126
{"strip-whitespace-before-send", "Strip Whitespace Before Sending",
127
F_STRIP_WS_BEFORE_SEND, h_config_strip_ws_before_send, PREF_SEND, 0},
128
+ {"enable-topal-hack", "Enable Topal hack for OpenPGP/MIME messages",
129
+ F_ENABLE_TOPAL_HACK, h_config_enable_topal_hack, PREF_HIDDEN, 0},
130
{"warn-if-blank-fcc", "Warn if Blank Fcc",
131
F_WARN_ABOUT_NO_FCC, h_config_warn_if_fcc_blank, PREF_SEND, 0},
132
{"warn-if-blank-subject", "Warn if Blank Subject",
133
Only in alpine.new/alpine-1.10/pith: conf.c.orig
134
diff -cr alpine.orig/alpine-1.10/pith/conftype.h alpine.new/alpine-1.10/pith/conftype.h
135
*** alpine.orig/alpine-1.10/pith/conftype.h 2008-03-14 18:15:38.000000000 +0000
136
--- alpine.new/alpine-1.10/pith/conftype.h 2008-06-19 09:24:42.000000000 +0100
141
F_MULNEWSRC_HOSTNAMES_AS_TYPED,
142
F_STRIP_WS_BEFORE_SEND,
143
+ F_ENABLE_TOPAL_HACK,
145
F_COMPOSE_ALWAYS_DOWNGRADE,
146
F_SORT_DEFAULT_FCC_ALPHA,
147
Only in alpine.new/alpine-1.10/pith: conftype.h.orig
148
diff -cr alpine.orig/alpine-1.10/pith/pine.hlp alpine.new/alpine-1.10/pith/pine.hlp
149
*** alpine.orig/alpine-1.10/pith/pine.hlp 2008-03-14 18:34:08.000000000 +0000
150
--- alpine.new/alpine-1.10/pith/pine.hlp 2008-06-19 09:24:42.000000000 +0100
154
<li><a href="h_config_strip_sigdashes">FEATURE: <!--#echo var="FEAT_strip-from-sigdashes-on-reply"--></a>
155
<li><a href="h_config_forward_as_attachment">FEATURE: <!--#echo var="FEAT_forward-as-attachment"--></a>
156
<li><a href="h_config_strip_ws_before_send">FEATURE: <!--#echo var="FEAT_strip-whitespace-before-send"--></a>
157
+ <li><a href="h_config_enable_topal_hack">FEATURE: <!--#echo var="FEAT_enable-topal-hack"--></a>
158
<li><a href="h_config_quell_attach_ext_warn">FEATURE: <!--#echo var="FEAT_quell-attachment-extension-warn"--></a>
159
<li><a href="h_config_quell_attach_extra_prompt">FEATURE: <!--#echo var="FEAT_quell-attachment-extra-prompt"--></a>
160
<li><a href="h_config_no_bezerk_zone">FEATURE: <!--#echo var="FEAT_quell-berkeley-format-timezone"--></a>
164
<End of help on this topic>
167
+ ====== h_config_enable_topal_hack =====
170
+ <TITLE>FEATURE: <!--#echo var="FEAT_enable-topal-hack"--></TITLE>
173
+ <H1>FEATURE: <!--#echo var="FEAT_enable-topal-hack"--></H1>
175
+ This feature allows Topal (and other sending-filters) to change the
176
+ MIME type of the email. This is potentially dangerous because it
177
+ pretends that multipart emails are plain emails.
179
+ <End of help on this topic>
182
====== h_config_del_from_dot =====
185
Only in alpine.new/alpine-1.10/pith: pine.hlp.orig
186
diff -cr alpine.orig/alpine-1.10/pith/send.c alpine.new/alpine-1.10/pith/send.c
187
*** alpine.orig/alpine-1.10/pith/send.c 2008-02-15 02:11:48.000000000 +0000
188
--- alpine.new/alpine-1.10/pith/send.c 2008-06-19 09:24:42.000000000 +0100
191
long pine_rfc822_output_body(BODY *,soutr_t,TCPSTREAM *);
192
int pine_write_body_header(BODY *, soutr_t, TCPSTREAM *);
193
int pine_write_header_line(char *, char *, STORE_S *);
194
! int pine_write_params(PARAMETER *, STORE_S *);
195
char *tidy_smtp_mess(char *, char *, char *, size_t);
196
int lmc_body_header_line(char *, int);
197
int lmc_body_header_finish(void);
199
long pine_rfc822_output_body(BODY *,soutr_t,TCPSTREAM *);
200
int pine_write_body_header(BODY *, soutr_t, TCPSTREAM *);
201
int pine_write_header_line(char *, char *, STORE_S *);
202
! int pine_write_params(PARAMETER *, STORE_S *, BODY *);
203
char *tidy_smtp_mess(char *, char *, char *, size_t);
204
int lmc_body_header_line(char *, int);
205
int lmc_body_header_finish(void);
209
/* set up counts and such to keep track sent percentage */
211
gf_filter_init(); /* zero piped byte count, 'n */
212
+ dprint((1, "Topal: HERE 1!\n"));
213
send_bytes_to_send = send_body_size(body); /* count body bytes */
214
+ dprint((1, "Topal: HERE 2!\n"));
215
ps_global->c_client_error[0] = error_buf[0] = '\0';
216
we_cancel = busy_cue(_("Sending mail"),
217
send_bytes_to_send ? sent_percent : NULL, 0);
224
+ dprint((1, "Topal: HERE 3!\n"));
228
* If the user's asked for it, and we find that the first text
229
* part (attachments all get b64'd) is non-7bit, ask for 8BITMIME.
233
if(F_ON(F_ENABLE_8BIT, ps_global) && (bp = first_text_8bit(body)))
234
smtp_opts |= SOP_8BITMIME;
236
+ dprint((1, "Topal: HERE 3.1!\n"));
239
if(debug > 5 || (flags & CM_VERBOSE))
246
+ dprint((1, "Topal: HERE 4!\n"));
249
* Install our rfc822 output routine
251
sending_hooks.rfc822_out = mail_parameters(NULL, GET_RFC822OUTPUT, NULL);
252
(void)mail_parameters(NULL, SET_RFC822OUTPUT, (void *)post_rfc822_output);
253
+ dprint((1, "Topal: HERE 5!\n"));
256
* Allow for verbose posting
258
(void) mail_parameters(NULL, SET_SMTPVERBOSE,
259
(void *) pine_smtp_verbose_out);
260
+ dprint((1, "Topal: HERE 6!\n"));
263
* We do this because we want mm_log to put the error message into
268
ps_global->noshow_error = 0;
270
+ dprint((1, "Topal: HERE 7!\n"));
271
TIME_STAMP("smtp open", 1);
273
unsigned short save_encoding, added_encoding;
277
first_text_8bit(struct mail_bodystruct *body)
279
! if(body->type == TYPEMULTIPART) /* advance to first contained part */
280
body = &body->nested.part->body;
282
return((body->type == TYPETEXT && body->encoding != ENC7BIT)
287
first_text_8bit(struct mail_bodystruct *body)
289
! /* Be careful of Topal changes... */
290
! if(body->type == TYPEMULTIPART
291
! && body->topal_hack != 1) /* advance to first contained part */
292
body = &body->nested.part->body;
294
+ /* Topal: this bit might not be correct, now. */
295
return((body->type == TYPETEXT && body->encoding != ENC7BIT)
300
dprint((4, "-- pine_encode_body: %d\n", body ? body->type : 0));
301
if (body) switch (body->type) {
302
case TYPEMULTIPART: /* multi-part */
303
! if (!body->parameter) { /* cookie not set up yet? */
304
char tmp[MAILTMPLEN]; /* make cookie not in BASE64 or QUOTEPRINT*/
306
snprintf (tmp,sizeof(tmp),"%ld-%ld-%ld=:%ld",gethostid (),random (),(long) time (0),
308
tmp[sizeof(tmp)-1] = '\0';
309
set_parameter(&body->parameter, "BOUNDARY", tmp);
311
- part = body->nested.part; /* encode body parts */
312
- do pine_encode_body (&part->body);
313
- while ((part = part->next) != NULL); /* until done */
318
* If the part is text we edited, then it is UTF-8.
320
dprint((4, "-- pine_encode_body: %d\n", body ? body->type : 0));
321
if (body) switch (body->type) {
322
case TYPEMULTIPART: /* multi-part */
323
! if (body->topal_hack != 1) { /* But only if Topal hasn't touched it! */
324
! if (!body->parameter) { /* cookie not set up yet? */
325
char tmp[MAILTMPLEN]; /* make cookie not in BASE64 or QUOTEPRINT*/
327
snprintf (tmp,sizeof(tmp),"%ld-%ld-%ld=:%ld",gethostid (),random (),(long) time (0),
329
tmp[sizeof(tmp)-1] = '\0';
330
set_parameter(&body->parameter, "BOUNDARY", tmp);
332
+ part = body->nested.part; /* encode body parts */
333
+ do pine_encode_body (&part->body);
334
+ while ((part = part->next) != NULL); /* until done */
340
* If the part is text we edited, then it is UTF-8.
344
dprint((4, "-- pine_rfc822_output_body: %d\n",
345
body ? body->type : 0));
346
! if(body->type == TYPEMULTIPART) { /* multipart gets special handling */
347
part = body->nested.part; /* first body part */
349
for (param = body->parameter; param && !cookie; param = param->next)
352
dprint((4, "-- pine_rfc822_output_body: %d\n",
353
body ? body->type : 0));
354
! if(body->type == TYPEMULTIPART
355
! && body->topal_hack != 1) { /* multipart gets special handling,
356
! unless Topal messed with it */
357
part = body->nested.part; /* first body part */
359
for (param = body->parameter; param && !cookie; param = param->next)
362
* BEFORE applying any encoding (rfc1341: appendix G)...
363
* NOTE: almost all filters expect CRLF newlines
365
! if(body->type == TYPETEXT
366
! && body->encoding != ENCBASE64
367
&& !so_attr((STORE_S *) body->contents.text.data, "rawbody", NULL)){
368
! gf_link_filter(gf_local_nvtnl, NULL);
371
switch (body->encoding) { /* all else needs filtering */
373
* BEFORE applying any encoding (rfc1341: appendix G)...
374
* NOTE: almost all filters expect CRLF newlines
376
! if(((body->type == TYPETEXT
377
! && body->encoding != ENCBASE64)
378
! /* Or if Topal mucked with it... */
379
! | (body->type == TYPEMULTIPART && body->topal_hack == 1))
380
&& !so_attr((STORE_S *) body->contents.text.data, "rawbody", NULL)){
381
! if(body->topal_hack == 1)
382
! dprint((9, "Topal: Canonical conversion, although Topal has mangled...\n"));
383
! gf_link_filter(gf_local_nvtnl, NULL);
386
switch (body->encoding) { /* all else needs filtering */
389
return(pwbh_finish(0, so));
392
! if(!pine_write_params(body->parameter, so))
393
return(pwbh_finish(0, so));
395
else if(!so_puts(so, "; CHARSET=US-ASCII"))
397
return(pwbh_finish(0, so));
400
! if(!pine_write_params(body->parameter, so, body))
401
return(pwbh_finish(0, so));
403
else if(!so_puts(so, "; CHARSET=US-ASCII"))
406
&& so_puts(so, body->disposition.type)))
407
return(pwbh_finish(0, so));
409
! if(!pine_write_params(body->disposition.parameter, so))
410
return(pwbh_finish(0, so));
412
if(!so_puts(so, "\015\012"))
414
&& so_puts(so, body->disposition.type)))
415
return(pwbh_finish(0, so));
417
! if(!pine_write_params(body->disposition.parameter, so, body))
418
return(pwbh_finish(0, so));
420
if(!so_puts(so, "\015\012"))
423
* pine_write_param - convert, encode and write MIME header-field parameters
426
! pine_write_params(PARAMETER *param, STORE_S *so)
428
for(; param; param = param->next){
431
* pine_write_param - convert, encode and write MIME header-field parameters
434
! pine_write_params(PARAMETER *param, STORE_S *so, BODY *body)
436
for(; param; param = param->next){
441
cs = posting_characterset(param->value, NULL, HdrText);
442
cv = utf8_to_charset(param->value, cs, 0);
443
! rv = (so_puts(so, "; ")
444
! && rfc2231_output(so, param->attribute, cv, (char *) tspecials, cs));
446
if(cv && cv != param->value)
447
fs_give((void **) &cv);
451
cs = posting_characterset(param->value, NULL, HdrText);
452
cv = utf8_to_charset(param->value, cs, 0);
453
! if (body->topal_hack == 1
454
! && !struncmp(param->attribute, "protocol", 9)) {
455
! /* Did Topal introduce more parameters? */
456
! dprint((9, "Topal: parameter encoding of protocol, with Topal hack\n"));
457
! rv = (so_puts(so, "; \015\012\011")
458
! && rfc2231_output(so, param->attribute, cv, (char *) tspecials, cs));
461
! rv = (so_puts(so, "; ")
462
! && rfc2231_output(so, param->attribute, cv, (char *) tspecials, cs));
464
if(cv && cv != param->value)
465
fs_give((void **) &cv);
472
! if(body->type == TYPEMULTIPART) { /* multipart gets special handling */
473
part = body->nested.part; /* first body part */
474
do /* for each part */
475
l += send_body_size(&part->body);
480
! if(body->type == TYPEMULTIPART
481
! && body->topal_hack != 1) { /* multipart gets special handling
482
! but again, be careful of Topal */
483
part = body->nested.part; /* first body part */
484
do /* for each part */
485
l += send_body_size(&part->body);
486
Only in alpine.new/alpine-1.10/pith: send.c.orig
487
Only in alpine.new/alpine-1.10/web/src/alpined.d: compilation.orig