| 6 |
details. |
details. |
| 7 |
|
|
| 8 |
Process Cypherpunk remailer messages |
Process Cypherpunk remailer messages |
| 9 |
$Id: rem1.c,v 1.3 2001/12/14 19:35:24 rabbi Exp $ */ |
$Id: rem1.c,v 1.7 2002/09/18 23:26:17 rabbi Exp $ */ |
| 10 |
|
|
| 11 |
|
|
| 12 |
#include "mix3.h" |
#include "mix3.h" |
| 72 |
buf_free(iv); |
buf_free(iv); |
| 73 |
buf_free(out); |
buf_free(out); |
| 74 |
} |
} |
| 75 |
#endif |
#endif /* USE_IDEA */ |
| 76 |
|
|
| 77 |
#define N(X) (isdigit(X) ? (X)-'0' : 0) |
#define N(X) (isdigit(X) ? (X)-'0' : 0) |
| 78 |
|
|
| 99 |
int encrypted = 0; |
int encrypted = 0; |
| 100 |
int type = -1; |
int type = -1; |
| 101 |
int latent = 0; |
int latent = 0; |
| 102 |
int remix = 0; |
int remix = 0, repgp = 0; |
| 103 |
int inflate = 0; |
int inflate = 0; |
| 104 |
|
|
| 105 |
field = buf_new(); |
field = buf_new(); |
| 135 |
else if (PGP && bufieq(field, "encrypted")) |
else if (PGP && bufieq(field, "encrypted")) |
| 136 |
encrypted = 1; |
encrypted = 1; |
| 137 |
else if (bufieq(field, "remix-to")) { |
else if (bufieq(field, "remix-to")) { |
| 138 |
remix = 1; |
remix = 1; repgp = 0; |
| 139 |
|
buf_set(remixto, content); |
| 140 |
|
if (type == -1) |
| 141 |
|
type = MSG_MAIL; |
| 142 |
|
} else if (bufieq(field, "encrypt-to")) { |
| 143 |
|
repgp = remix = 1; |
| 144 |
buf_set(remixto, content); |
buf_set(remixto, content); |
| 145 |
if (type == -1) |
if (type == -1) |
| 146 |
type = MSG_MAIL; |
type = MSG_MAIL; |
| 149 |
bufieq(field, "remail-to") || |
bufieq(field, "remail-to") || |
| 150 |
bufieq(field, "anon-send-to")) { |
bufieq(field, "anon-send-to")) { |
| 151 |
if (bufieq(field, "remail-to")) |
if (bufieq(field, "remail-to")) |
| 152 |
remix = 0; |
repgp = remix = 0; |
| 153 |
if (to->length > 0) |
if (to->length > 0) |
| 154 |
buf_appendc(to, ','); |
buf_appendc(to, ','); |
| 155 |
buf_cat(to, content); |
buf_cat(to, content); |
| 222 |
#if USE_NSUB |
#if USE_NSUB |
| 223 |
else if (bufieq(field, "subject")) |
else if (bufieq(field, "subject")) |
| 224 |
buf_set(subject, content); |
buf_set(subject, content); |
| 225 |
#endif |
#endif /* USE_NSUB */ |
| 226 |
} |
} |
| 227 |
|
|
| 228 |
if (cutmarks->length > 0) { |
if (cutmarks->length > 0) { |
| 271 |
hdr = 0; |
hdr = 0; |
| 272 |
goto header; |
goto header; |
| 273 |
} |
} |
| 274 |
#endif |
#endif /* USE_PGP */ |
| 275 |
if (testto->length == 0) |
if (testto->length == 0) |
| 276 |
errlog(ERRORMSG, "Can't decrypt PGP message.\n"); |
errlog(ERRORMSG, "Can't decrypt PGP message.\n"); |
| 277 |
buf_appends(test, "Can't decrypt PGP message.\n"); |
buf_appends(test, "Can't decrypt PGP message.\n"); |
| 281 |
#if 0 |
#if 0 |
| 282 |
if (err == -1) |
if (err == -1) |
| 283 |
goto end; |
goto end; |
| 284 |
#endif |
#endif /* 0 */ |
| 285 |
|
|
| 286 |
if (isline(line, HDRMARK) && (hdr == 0 || hdr == 1)) { |
if (isline(line, HDRMARK) && (hdr == 0 || hdr == 1)) { |
| 287 |
buf_getline(in, NULL); |
buf_getline(in, NULL); |
| 320 |
#ifdef USE_IDEA |
#ifdef USE_IDEA |
| 321 |
if (esub->length > 0) |
if (esub->length > 0) |
| 322 |
t1_esub(esub, subject); |
t1_esub(esub, subject); |
| 323 |
#endif |
#endif /* USE_IDEA */ |
| 324 |
buf_appendf(out, "Subject: %b\n", subject); |
buf_appendf(out, "Subject: %b\n", subject); |
| 325 |
} |
} |
| 326 |
buf_cat(out, header); |
buf_cat(out, header); |
| 328 |
|
|
| 329 |
#if 0 |
#if 0 |
| 330 |
inflate -= in->length; |
inflate -= in->length; |
| 331 |
#endif |
#endif /* 0 */ |
| 332 |
if (inflate > 0) { |
if (inflate > 0) { |
| 333 |
buf_setrnd(temp, inflate * 3 / 4); |
buf_setrnd(temp, inflate * 3 / 4); |
| 334 |
encode(temp, 64); |
encode(temp, 64); |
| 373 |
buf_appends(out, EKMARK); |
buf_appends(out, EKMARK); |
| 374 |
buf_nl(out); |
buf_nl(out); |
| 375 |
buf_cat(out, temp); |
buf_cat(out, temp); |
| 376 |
#else |
#else /* end of USE_PGP */ |
| 377 |
err = -1; |
err = -1; |
| 378 |
#endif |
#endif /* Else if not USE_PGP */ |
| 379 |
} |
} |
| 380 |
|
|
| 381 |
if (type == -1) { |
if (type == -1) { |
| 447 |
err = 1; |
err = 1; |
| 448 |
if (bufieq(to, REMAILERADDR)) /* don't remix to ourselves */ |
if (bufieq(to, REMAILERADDR)) /* don't remix to ourselves */ |
| 449 |
remix = 0; |
remix = 0; |
| 450 |
if (remix) { |
if (remix && remixto->length == 0) |
| 451 |
if (remixto->length) { |
buf_set(remixto, to); |
| 452 |
err = mix_encrypt(type, out, remixto->data, 1, line); |
if (remix && !repgp) |
| 453 |
if (err != 0) |
err = mix_encrypt(type, out, remixto->data, 1, line); |
| 454 |
errlog(NOTICE, "Can't remix-to %b -- %b\n", remixto, line); |
if (err != 0) { |
| 455 |
} else /* transparent remixing */ { |
if (remix == 1 && !repgp) |
| 456 |
err = mix_encrypt(type, out, to->data, 1, line); |
errlog(NOTICE, "Can't remix -- %b\n", line); |
| 457 |
if (err != 0) { |
else { |
| 458 |
errlog(DEBUGINFO, "Can't transparently remix to %b\n", to); |
if (remixto->length) |
| 459 |
|
err = t1_encrypt(type, out, remixto->data, 0, 0, line); |
| 460 |
|
if (err != 0 && repgp) |
| 461 |
|
errlog(NOTICE, "Can't repgp -- %b\n", line); |
| 462 |
|
else |
| 463 |
err = mix_pool(out, type, latent * 60); |
err = mix_pool(out, type, latent * 60); |
|
} |
|
| 464 |
} |
} |
|
} else { |
|
|
err = mix_pool(out, type, latent * 60); |
|
| 465 |
} |
} |
| 466 |
} |
} |
| 467 |
|
|