/usr/share/topal/patches/alpine-1.00.patch is in topal 75-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | diff -cr alpine-1.00.orig/alpine/send.c alpine-1.00.new/alpine/send.c
*** alpine-1.00.orig/alpine/send.c 2007-12-05 17:50:54.000000000 +0000
--- alpine-1.00.new/alpine/send.c 2008-01-07 15:19:45.000000000 +0000
***************
*** 4025,4030 ****
--- 4025,4047 ----
pbf = save_previous_pbuf;
g_rolenick = NULL;
+ /* Topal: Unmangle the body types. */
+ if ((*body)->type == TYPEMULTIPART
+ && (*body)->topal_hack == 1) {
+ /* This was a single part message which Topal mangled. */
+ dprint((9, "Topal: unmangling single part message\n"));
+ (*body)->type = TYPETEXT;
+ }
+ if ((*body)->type == TYPEMULTIPART
+ && (*body)->topal_hack != 1
+ && (*body)->nested.part->body.type == TYPEMULTIPART
+ && (*body)->nested.part->body.topal_hack == 1) {
+ /* Topal mangled a multipart message. So the first nested part
+ is really TYPETEXT. */
+ dprint((9, "Topal: unmangling first part of multipart message\n"));
+ (*body)->nested.part->body.type = TYPETEXT;
+ }
+
dprint((4, "=== send returning ===\n"));
}
***************
*** 5265,5286 ****
rfc822_parse_content_header(nb,
(char *) ucase((unsigned char *) buf+8),s);
if(nb->type == TYPETEXT
&& nb->subtype
&& (!b->subtype
|| strucmp(b->subtype, nb->subtype))){
! if(b->subtype)
! fs_give((void **) &b->subtype);
!
b->subtype = nb->subtype;
nb->subtype = NULL;
!
mail_free_body_parameter(&b->parameter);
b->parameter = nb->parameter;
nb->parameter = NULL;
mail_free_body_parameter(&nb->parameter);
}
!
mail_free_body(&nb);
}
--- 5282,5331 ----
rfc822_parse_content_header(nb,
(char *) ucase((unsigned char *) buf+8),s);
+ /* Topal: We're working on the first
+ text segment of the message. If
+ the filter returns something that
+ isn't TYPETEXT, then we need to
+ pretend (later on) that this is in
+ fact a TYPETEXT, because Topal has
+ already encoded it....
+
+ Original code path first, then an
+ alternate path.
+ */
if(nb->type == TYPETEXT
&& nb->subtype
&& (!b->subtype
|| strucmp(b->subtype, nb->subtype))){
! if(b->subtype)
! fs_give((void **) &b->subtype);
!
! b->subtype = nb->subtype;
! nb->subtype = NULL;
!
! mail_free_body_parameter(&b->parameter);
! b->parameter = nb->parameter;
! nb->parameter = NULL;
! mail_free_body_parameter(&nb->parameter);
! }
! else if(F_ON(F_ENABLE_TOPAL_HACK, ps_global)){
! /* Perhaps the type isn't TYPETEXT,
! and the hack is requested. So,
! let's mess with the types. */
! if(nb->type != TYPETEXT){
! b->type = nb->type;
b->subtype = nb->subtype;
nb->subtype = NULL;
!
! dprint((9, "Topal: mangling body!\n"));
mail_free_body_parameter(&b->parameter);
b->parameter = nb->parameter;
nb->parameter = NULL;
mail_free_body_parameter(&nb->parameter);
+ b->topal_hack = 1;
+ }
}
! /* Topal: end */
mail_free_body(&nb);
}
Only in alpine-1.00.new/imap: ip6
diff -cr alpine-1.00.orig/imap/src/c-client/mail.h alpine-1.00.new/imap/src/c-client/mail.h
*** alpine-1.00.orig/imap/src/c-client/mail.h 2007-11-19 23:32:35.000000000 +0000
--- alpine-1.00.new/imap/src/c-client/mail.h 2008-01-07 12:54:20.000000000 +0000
***************
*** 775,780 ****
--- 775,781 ----
unsigned long bytes; /* size of text in octets */
} size;
char *md5; /* MD5 checksum */
+ unsigned short topal_hack; /* set to 1 if topal has wrecked the sending */
void *sparep; /* spare pointer reserved for main program */
};
diff -cr alpine-1.00.orig/pith/conf.c alpine-1.00.new/pith/conf.c
*** alpine-1.00.orig/pith/conf.c 2007-12-13 19:31:13.000000000 +0000
--- alpine-1.00.new/pith/conf.c 2008-01-07 14:00:58.000000000 +0000
***************
*** 2778,2783 ****
--- 2778,2785 ----
F_SEND_WO_CONFIRM, h_config_send_wo_confirm, PREF_SEND, 0},
{"strip-whitespace-before-send", "Strip Whitespace Before Sending",
F_STRIP_WS_BEFORE_SEND, h_config_strip_ws_before_send, PREF_SEND, 0},
+ {"enable-topal-hack", "Enable Topal hack for OpenPGP/MIME messages",
+ F_ENABLE_TOPAL_HACK, h_config_enable_topal_hack, PREF_HIDDEN, 0},
{"warn-if-blank-subject", "Warn if Blank Subject",
F_WARN_ABOUT_NO_SUBJECT, h_config_warn_if_subj_blank, PREF_SEND, 0},
{"warn-if-blank-to-and-cc-and-newsgroups", "Warn if Blank To and CC and Newsgroups",
diff -cr alpine-1.00.orig/pith/conftype.h alpine-1.00.new/pith/conftype.h
*** alpine-1.00.orig/pith/conftype.h 2007-11-08 01:14:02.000000000 +0000
--- alpine-1.00.new/pith/conftype.h 2008-01-07 12:50:47.000000000 +0000
***************
*** 487,492 ****
--- 487,493 ----
F_MARK_FCC_SEEN,
F_MULNEWSRC_HOSTNAMES_AS_TYPED,
F_STRIP_WS_BEFORE_SEND,
+ F_ENABLE_TOPAL_HACK,
F_QUELL_FLOWED_TEXT,
F_COMPOSE_ALWAYS_DOWNGRADE,
F_SORT_DEFAULT_FCC_ALPHA,
diff -cr alpine-1.00.orig/pith/pine.hlp alpine-1.00.new/pith/pine.hlp
*** alpine-1.00.orig/pith/pine.hlp 2007-12-20 16:34:31.000000000 +0000
--- alpine-1.00.new/pith/pine.hlp 2008-01-07 12:47:42.000000000 +0000
***************
*** 3023,3028 ****
--- 3023,3029 ----
<li><a href="h_config_strip_sigdashes">FEATURE: <!--#echo var="FEAT_strip-from-sigdashes-on-reply"--></a>
<li><a href="h_config_forward_as_attachment">FEATURE: <!--#echo var="FEAT_forward-as-attachment"--></a>
<li><a href="h_config_strip_ws_before_send">FEATURE: <!--#echo var="FEAT_strip-whitespace-before-send"--></a>
+ <li><a href="h_config_enable_topal_hack">FEATURE: <!--#echo var="FEAT_enable-topal-hack"--></a>
<li><a href="h_config_quell_attach_ext_warn">FEATURE: <!--#echo var="FEAT_quell-attachment-extension-warn"--></a>
<li><a href="h_config_quell_attach_extra_prompt">FEATURE: <!--#echo var="FEAT_quell-attachment-extra-prompt"--></a>
<li><a href="h_config_no_bezerk_zone">FEATURE: <!--#echo var="FEAT_quell-berkeley-format-timezone"--></a>
***************
*** 27962,27967 ****
--- 27963,27983 ----
<End of help on this topic>
</BODY>
</HTML>
+ ====== h_config_enable_topal_hack =====
+ <HTML>
+ <HEAD>
+ <TITLE>FEATURE: <!--#echo var="FEAT_enable-topal-hack"--></TITLE>
+ </HEAD>
+ <BODY>
+ <H1>FEATURE: <!--#echo var="FEAT_enable-topal-hack"--></H1>
+ <P>
+ This feature allows Topal (and other sending-filters) to change the
+ MIME type of the email. This is potentially dangerous because it
+ pretends that multipart emails are plain emails.
+ <P>
+ <End of help on this topic>
+ </BODY>
+ </HTML>
====== h_config_del_from_dot =====
<HTML>
<HEAD>
diff -cr alpine-1.00.orig/pith/send.c alpine-1.00.new/pith/send.c
*** alpine-1.00.orig/pith/send.c 2007-12-01 01:10:52.000000000 +0000
--- alpine-1.00.new/pith/send.c 2008-01-07 15:18:45.000000000 +0000
***************
*** 108,114 ****
long pine_rfc822_output_body(BODY *,soutr_t,TCPSTREAM *);
int pine_write_body_header(BODY *, soutr_t, TCPSTREAM *);
int pine_write_header_line(char *, char *, STORE_S *);
! int pine_write_params(PARAMETER *, STORE_S *);
char *tidy_smtp_mess(char *, char *, char *, size_t);
int lmc_body_header_line(char *, int);
int lmc_body_header_finish(void);
--- 108,114 ----
long pine_rfc822_output_body(BODY *,soutr_t,TCPSTREAM *);
int pine_write_body_header(BODY *, soutr_t, TCPSTREAM *);
int pine_write_header_line(char *, char *, STORE_S *);
! int pine_write_params(PARAMETER *, STORE_S *, BODY *);
char *tidy_smtp_mess(char *, char *, char *, size_t);
int lmc_body_header_line(char *, int);
int lmc_body_header_finish(void);
***************
*** 1726,1732 ****
--- 1726,1734 ----
/* set up counts and such to keep track sent percentage */
send_bytes_sent = 0;
gf_filter_init(); /* zero piped byte count, 'n */
+ dprint((1, "Topal: HERE 1!\n"));
send_bytes_to_send = send_body_size(body); /* count body bytes */
+ dprint((1, "Topal: HERE 2!\n"));
ps_global->c_client_error[0] = error_buf[0] = '\0';
we_cancel = busy_cue(_("Sending mail"),
send_bytes_to_send ? sent_percent : NULL, 0);
***************
*** 1743,1748 ****
--- 1745,1753 ----
#endif
+ dprint((1, "Topal: HERE 3!\n"));
+
+
/*
* If the user's asked for it, and we find that the first text
* part (attachments all get b64'd) is non-7bit, ask for 8BITMIME.
***************
*** 1750,1755 ****
--- 1755,1761 ----
if(F_ON(F_ENABLE_8BIT, ps_global) && (bp = first_text_8bit(body)))
smtp_opts |= SOP_8BITMIME;
+ dprint((1, "Topal: HERE 3.1!\n"));
#ifdef DEBUG
#ifndef DEBUGJOURNAL
if(debug > 5 || (flags & CM_VERBOSE))
***************
*** 1813,1829 ****
--- 1819,1839 ----
}
}
+ dprint((1, "Topal: HERE 4!\n"));
+
/*
* Install our rfc822 output routine
*/
sending_hooks.rfc822_out = mail_parameters(NULL, GET_RFC822OUTPUT, NULL);
(void)mail_parameters(NULL, SET_RFC822OUTPUT, (void *)post_rfc822_output);
+ dprint((1, "Topal: HERE 5!\n"));
/*
* Allow for verbose posting
*/
(void) mail_parameters(NULL, SET_SMTPVERBOSE,
(void *) pine_smtp_verbose_out);
+ dprint((1, "Topal: HERE 6!\n"));
/*
* We do this because we want mm_log to put the error message into
***************
*** 1867,1872 ****
--- 1877,1883 ----
ps_global->noshow_error = 0;
+ dprint((1, "Topal: HERE 7!\n"));
TIME_STAMP("smtp open", 1);
if(sending_stream){
unsigned short save_encoding, added_encoding;
***************
*** 2429,2437 ****
BODY *
first_text_8bit(struct mail_bodystruct *body)
{
! if(body->type == TYPEMULTIPART) /* advance to first contained part */
body = &body->nested.part->body;
return((body->type == TYPETEXT && body->encoding != ENC7BIT)
? body : NULL);
}
--- 2440,2451 ----
BODY *
first_text_8bit(struct mail_bodystruct *body)
{
! /* Be careful of Topal changes... */
! if(body->type == TYPEMULTIPART
! && body->topal_hack != 1) /* advance to first contained part */
body = &body->nested.part->body;
+ /* Topal: this bit might not be correct, now. */
return((body->type == TYPETEXT && body->encoding != ENC7BIT)
? body : NULL);
}
***************
*** 2802,2820 ****
dprint((4, "-- pine_encode_body: %d\n", body ? body->type : 0));
if (body) switch (body->type) {
case TYPEMULTIPART: /* multi-part */
! if (!body->parameter) { /* cookie not set up yet? */
char tmp[MAILTMPLEN]; /* make cookie not in BASE64 or QUOTEPRINT*/
!
snprintf (tmp,sizeof(tmp),"%ld-%ld-%ld=:%ld",gethostid (),random (),(long) time (0),
(long) getpid ());
tmp[sizeof(tmp)-1] = '\0';
set_parameter(&body->parameter, "BOUNDARY", tmp);
}
- part = body->nested.part; /* encode body parts */
- do pine_encode_body (&part->body);
- while ((part = part->next) != NULL); /* until done */
break;
!
case TYPETEXT :
/*
* If the part is text we edited, then it is UTF-8.
--- 2816,2836 ----
dprint((4, "-- pine_encode_body: %d\n", body ? body->type : 0));
if (body) switch (body->type) {
case TYPEMULTIPART: /* multi-part */
! if (body->topal_hack != 1) { /* But only if Topal hasn't touched it! */
! if (!body->parameter) { /* cookie not set up yet? */
char tmp[MAILTMPLEN]; /* make cookie not in BASE64 or QUOTEPRINT*/
!
snprintf (tmp,sizeof(tmp),"%ld-%ld-%ld=:%ld",gethostid (),random (),(long) time (0),
(long) getpid ());
tmp[sizeof(tmp)-1] = '\0';
set_parameter(&body->parameter, "BOUNDARY", tmp);
+ }
+ part = body->nested.part; /* encode body parts */
+ do pine_encode_body (&part->body);
+ while ((part = part->next) != NULL); /* until done */
}
break;
!
case TYPETEXT :
/*
* If the part is text we edited, then it is UTF-8.
***************
*** 4171,4177 ****
dprint((4, "-- pine_rfc822_output_body: %d\n",
body ? body->type : 0));
! if(body->type == TYPEMULTIPART) { /* multipart gets special handling */
part = body->nested.part; /* first body part */
/* find cookie */
for (param = body->parameter; param && !cookie; param = param->next)
--- 4187,4195 ----
dprint((4, "-- pine_rfc822_output_body: %d\n",
body ? body->type : 0));
! if(body->type == TYPEMULTIPART
! && body->topal_hack != 1) { /* multipart gets special handling,
! unless Topal messed with it */
part = body->nested.part; /* first body part */
/* find cookie */
for (param = body->parameter; param && !cookie; param = param->next)
***************
*** 4261,4270 ****
* BEFORE applying any encoding (rfc1341: appendix G)...
* NOTE: almost all filters expect CRLF newlines
*/
! if(body->type == TYPETEXT
! && body->encoding != ENCBASE64
&& !so_attr((STORE_S *) body->contents.text.data, "rawbody", NULL)){
! gf_link_filter(gf_local_nvtnl, NULL);
}
switch (body->encoding) { /* all else needs filtering */
--- 4279,4292 ----
* BEFORE applying any encoding (rfc1341: appendix G)...
* NOTE: almost all filters expect CRLF newlines
*/
! if(((body->type == TYPETEXT
! && body->encoding != ENCBASE64)
! /* Or if Topal mucked with it... */
! | (body->type == TYPEMULTIPART && body->topal_hack == 1))
&& !so_attr((STORE_S *) body->contents.text.data, "rawbody", NULL)){
! if(body->topal_hack == 1)
! dprint((9, "Topal: Canonical conversion, although Topal has mangled...\n"));
! gf_link_filter(gf_local_nvtnl, NULL);
}
switch (body->encoding) { /* all else needs filtering */
***************
*** 4366,4372 ****
return(pwbh_finish(0, so));
if(body->parameter){
! if(!pine_write_params(body->parameter, so))
return(pwbh_finish(0, so));
}
else if(!so_puts(so, "; CHARSET=US-ASCII"))
--- 4388,4394 ----
return(pwbh_finish(0, so));
if(body->parameter){
! if(!pine_write_params(body->parameter, so, body))
return(pwbh_finish(0, so));
}
else if(!so_puts(so, "; CHARSET=US-ASCII"))
***************
*** 4445,4451 ****
&& so_puts(so, body->disposition.type)))
return(pwbh_finish(0, so));
! if(!pine_write_params(body->disposition.parameter, so))
return(pwbh_finish(0, so));
if(!so_puts(so, "\015\012"))
--- 4467,4473 ----
&& so_puts(so, body->disposition.type)))
return(pwbh_finish(0, so));
! if(!pine_write_params(body->disposition.parameter, so, body))
return(pwbh_finish(0, so));
if(!so_puts(so, "\015\012"))
***************
*** 4507,4513 ****
* pine_write_param - convert, encode and write MIME header-field parameters
*/
int
! pine_write_params(PARAMETER *param, STORE_S *so)
{
for(; param; param = param->next){
int rv;
--- 4529,4535 ----
* pine_write_param - convert, encode and write MIME header-field parameters
*/
int
! pine_write_params(PARAMETER *param, STORE_S *so, BODY *body)
{
for(; param; param = param->next){
int rv;
***************
*** 4516,4524 ****
cs = posting_characterset(param->value, NULL, HdrText);
cv = utf8_to_charset(param->value, cs, 0);
! rv = (so_puts(so, "; ")
! && rfc2231_output(so, param->attribute, cv, (char *) tspecials, cs));
!
if(cv && cv != param->value)
fs_give((void **) &cv);
--- 4538,4554 ----
cs = posting_characterset(param->value, NULL, HdrText);
cv = utf8_to_charset(param->value, cs, 0);
! if (body->topal_hack == 1
! && !struncmp(param->attribute, "protocol", 9)) {
! /* Did Topal introduce more parameters? */
! dprint((9, "Topal: parameter encoding of protocol, with Topal hack\n"));
! rv = (so_puts(so, "; \015\012\011")
! && rfc2231_output(so, param->attribute, cv, (char *) tspecials, cs));
! }
! else
! rv = (so_puts(so, "; ")
! && rfc2231_output(so, param->attribute, cv, (char *) tspecials, cs));
!
if(cv && cv != param->value)
fs_give((void **) &cv);
***************
*** 4625,4631 ****
long l = 0L;
PART *part;
! if(body->type == TYPEMULTIPART) { /* multipart gets special handling */
part = body->nested.part; /* first body part */
do /* for each part */
l += send_body_size(&part->body);
--- 4655,4663 ----
long l = 0L;
PART *part;
! if(body->type == TYPEMULTIPART
! && body->topal_hack != 1) { /* multipart gets special handling
! but again, be careful of Topal */
part = body->nested.part; /* first body part */
do /* for each part */
l += send_body_size(&part->body);
Only in alpine-1.00.orig/po: Makefile.in
Only in alpine-1.00.new/po: stamp-po
Only in alpine-1.00.new/regex: .deps
Only in alpine-1.00.new/regex: Makefile
diff -cr alpine-1.00.orig/web/src/alpined.d/compilation alpine-1.00.new/web/src/alpined.d/compilation
*** alpine-1.00.orig/web/src/alpined.d/compilation 2007-12-15 00:27:02.000000000 +0000
--- alpine-1.00.new/web/src/alpined.d/compilation 2008-01-07 13:57:51.000000000 +0000
***************
*** 1 ****
! 117
--- 1 ----
! 118
Only in alpine-1.00.new/web/src: Makefile
Only in alpine-1.00.new/web/src/pubcookie: .deps
Only in alpine-1.00.new/web/src/pubcookie: Makefile
|