| 6 |
details. |
details. |
| 7 |
|
|
| 8 |
Process remailer messages |
Process remailer messages |
| 9 |
$Id: rem.c,v 1.28 2002/09/18 23:26:17 rabbi Exp $ */ |
$Id: rem.c,v 1.30 2002/10/09 20:53:31 weaselp Exp $ */ |
| 10 |
|
|
| 11 |
|
|
| 12 |
#include "mix3.h" |
#include "mix3.h" |
| 103 |
else if (bufieq(content, "remailer-key")) |
else if (bufieq(content, "remailer-key")) |
| 104 |
type = REQUESTKEY; |
type = REQUESTKEY; |
| 105 |
else if (bufieq(content, "remailer-adminkey")) |
else if (bufieq(content, "remailer-adminkey")) |
| 106 |
type = REQUESTOPKEY; |
type = REQUESTOPKEY; |
| 107 |
else if (bufieq(content, "remailer-conf")) |
else if (bufieq(content, "remailer-conf")) |
| 108 |
type = REQUESTCONF; |
type = REQUESTCONF; |
| 109 |
else if (bufileft(content, "destination-block")) |
else if (bufileft(content, "destination-block")) |
| 123 |
bufieq(field, "encrypt-to")) |
bufieq(field, "encrypt-to")) |
| 124 |
type = CPUNKMSG; |
type = CPUNKMSG; |
| 125 |
else if (bufieq(field, "content-transfer-encoding") |
else if (bufieq(field, "content-transfer-encoding") |
| 126 |
&& bufieq(content, "quoted-printable")) { |
&& bufieq(content, "quoted-printable")) { |
| 127 |
quoted_printable = 1; |
quoted_printable = 1; |
| 128 |
} |
} |
| 129 |
|
|
| 130 |
} |
} |
| 131 |
hdrend: |
hdrend: |
| 132 |
if (quoted_printable) |
if (quoted_printable) |
| 300 |
struct stat sb; |
struct stat sb; |
| 301 |
|
|
| 302 |
d = opendir(POOLDIR); |
d = opendir(POOLDIR); |
| 303 |
errlog(NOTICE, "Checking for old parts.\n"); |
errlog(DEBUGINFO, "Checking for old parts.\n"); |
| 304 |
if (d != NULL) |
if (d != NULL) |
| 305 |
for (;;) { |
for (;;) { |
| 306 |
e = readdir(d); |
e = readdir(d); |
| 307 |
if (e == NULL) |
if (e == NULL) |
| 308 |
break; |
break; |
| 309 |
if (e->d_name[0] == 'p' || e->d_name[0] == 'e' || e->d_name[0] == 't') { |
if (e->d_name[0] == 'p' || e->d_name[0] == 'e' || e->d_name[0] == 't') { |
| 310 |
path=malloc(strlen(POOLDIR)+strlen(e->d_name)+strlen(DIRSEPSTR)+1); |
path=malloc(strlen(POOLDIR)+strlen(e->d_name)+strlen(DIRSEPSTR)+1); |
| 311 |
if (path) { |
if (path) { |
| 312 |
strcpy(path, POOLDIR); |
strcpy(path, POOLDIR); |
| 313 |
strcat(path, DIRSEPSTR); |
strcat(path, DIRSEPSTR); |
| 314 |
strcat(path, e->d_name); |
strcat(path, e->d_name); |
| 315 |
if (stat(path, &sb) == 0 && time(NULL) - sb.st_mtime > PACKETEXP) { |
if (stat(path, &sb) == 0 && time(NULL) - sb.st_mtime > PACKETEXP) { |
| 316 |
if (e->d_name[0] == 'p') { |
if (e->d_name[0] == 'p') { |
| 317 |
errlog(NOTICE, "Expiring incomplete partial message %s.\n", |
errlog(NOTICE, "Expiring incomplete partial message %s.\n", |
| 318 |
e->d_name); |
e->d_name); |
| 319 |
} |
} |
| 320 |
else if (e->d_name[0] == 'e') { |
else if (e->d_name[0] == 'e') { |
| 321 |
errlog(NOTICE, "Expiring old error message %s.\n", |
errlog(NOTICE, "Expiring old error message %s.\n", |
| 322 |
e->d_name); |
e->d_name); |
| 323 |
} |
} |
| 324 |
else if (e->d_name[0] == 't') { |
else if (e->d_name[0] == 't') { |
| 325 |
errlog(NOTICE, "Expiring moldy temporary message %s.\n", |
errlog(NOTICE, "Expiring moldy temporary message %s.\n", |
| 326 |
e->d_name); |
e->d_name); |
| 327 |
} |
} |
| 328 |
unlink(path); |
unlink(path); |
| 329 |
} |
} |
| 330 |
free(path); |
free(path); |
| 331 |
} |
} |
| 332 |
} |
} |
| 333 |
} |
} |
| 417 |
if (bufieq(field, "from")) |
if (bufieq(field, "from")) |
| 418 |
buf_set(from, content); |
buf_set(from, content); |
| 419 |
else if (bufieq(field, "subject")) |
else if (bufieq(field, "subject")) |
| 420 |
buf_cat(message, content); |
buf_cat(message, content); |
| 421 |
/* Append the subject to the message body so destination block requests |
/* Append the subject to the message body so destination block requests |
| 422 |
in the subject line work too (we process the body a few lines down) */ |
in the subject line work too (we process the body a few lines down) */ |
| 423 |
while (buf_getline(message, line) != -1) |
while (buf_getline(message, line) != -1) |
| 424 |
if (bufifind(line, "destination-block")) { |
if (bufifind(line, "destination-block")) { |
| 461 |
errlog(LOG, "Ignoring blocking request: %b is a regex.\n", addr); |
errlog(LOG, "Ignoring blocking request: %b is a regex.\n", addr); |
| 462 |
} else { |
} else { |
| 463 |
if (strchr(line->data, '@') && strchr(strchr(line->data, '@'), '.')) { |
if (strchr(line->data, '@') && strchr(strchr(line->data, '@'), '.')) { |
| 464 |
strcpy( destblklst, DESTBLOCK ); |
strcpy( destblklst, DESTBLOCK ); |
| 465 |
destblk = strtok( destblklst, " " ); |
destblk = strtok( destblklst, " " ); |
| 466 |
f = mix_openfile( destblk, "a" ); |
f = mix_openfile( destblk, "a" ); |
| 467 |
free( destblklst ); |
free( destblklst ); |
| 468 |
if (f != NULL) { |
if (f != NULL) { |
| 469 |
lock(f); |
lock(f); |
| 470 |
|
|