31#define WHO "ezmlm-return"
39static void die_usage() {
logmsg(
WHO,100,USAGE,
"ezmlm-return [-dD] dir"); }
42static void die_trash() {
logmsg(
WHO,99,WARN,
"trash address"); }
49char strnum[FMT_ULONG];
74 if (mkdir(s,0755) == -1)
83 unsigned long wdir,wfile;
93 wfile =
when - 10000 * wdir;
100 if (!stralloc_catb(&
fndate,strnum,fmt_ulong(strnum,wfile)))
die_nomem();
102 if (!stralloc_catb(&
fndate,strnum,fmt_ulong(strnum,(
unsigned long) getpid())))
131 unsigned long ddir,dfile;
147 if (!stralloc_catb(&
fndate,strnum,fmt_ulong(strnum,dfile)))
die_nomem();
149 if (!stralloc_catb(&
fndate,strnum,fmt_ulong(strnum,(
unsigned long) getpid())))
207 switch (buffer_copy(&
bo,&
bi)) {
248 unsigned long listno = 0L;
262 if (!
dir) die_usage();
266 }
else if (
dir[1] ==
'D') {
271 if (!
dir) die_usage();
274 sender = env_get(
"SENDER");
277 action = env_get(
"DEFAULT");
280 if (chdir(
dir) == -1)
283 switch (openreadclose(
"key",&key,32)) {
289 if (str_start(
action,
"receipt-")) {
294 if (ch &&
action[1] ==
'-') {
297 case 'm': flagmaster = 1;
action += 2;
break;
308 if (!*
action) die_trash();
310 if (flagreceipt || flagmaster)
318 if (!flagmaster && str_start(
action,
"probe-")) {
322 if (*
action++ !=
'.') die_trash();
324 if (i !=
COOKIE) die_trash();
327 if (*
action++ !=
'-') die_trash();
331 if (!stralloc_cats(&line,
"@"))
die_nomem();
336 cookie(hash,key.s,key.len,strnum,line.s,
"P");
344 if (!stralloc_cats(&line,
"/lockbounce"))
die_nomem();
349 if (!flagmaster && str_start(
action,
"warn-")) {
353 if (*
action++ !=
'.') die_trash();
355 if (i !=
COOKIE) die_trash();
358 if (*
action++ !=
'-') die_trash();
362 if (!stralloc_cats(&line,
"@"))
die_nomem();
367 cookie(hash,key.s,key.len,strnum,line.s,
"W");
376 if (*
action++ !=
'-') die_badaddr();
387 }
else if (flagreceipt) {
402 }
else if (flagreceipt || flagmaster)
409 if (!stralloc_cats(&line,
"@"))
die_nomem();
429 if (!
match) die_trash();
431 if (line.len <= 1)
break;
444 if (str_diffn(
paragraph.s,
"Hi. This is the",15)) die_trash();
461 if (i < 3) die_trash();
464 if (byte_chr(line.s,line.len,
'\0') == line.len) {
467 if ((i = str_rchr(line.s,
'@')) >= 5) {
469 scan_ulong(line.s + i - 5,&
listno);
472 logmsg(
WHO,0,WARN,B(
"bounce ",line.s + i - 5));
int issub()
Returns (char *) to match if userhost is in the subscriber database dbname, 0 otherwise....
int quote2(stralloc *sa, const char *s)
Error messages. If you translate these, I would urge you to keep the English version as well....
#define ERR_BAD_RETURN_ADDRESS
int lockfile(const char *)
const char * loginfo(const char *dir, unsigned long msgnum, unsigned long, unsigned long subs, int done)
void closesql(void)
close connection to SQL server, if open
int subscribe(const char *dir, const char *username, int flagadd, const char *from, const char *event, int flagmysql, int forcehash, const char *table_override)
void cookie(char *hash, const char *key, unsigned int keylen, const char *date, const char *addr, const char *action)
const char * checktag(const char *dir, unsigned long num, unsigned long listno, const char *action, const char *seed, const char *hash)
void doit(const char *addr, unsigned long msgnum, unsigned long when, const stralloc *bounce)
void dowit(char *addr, unsigned long when, stralloc *bounce)
const char * logmsg(const char *dir, unsigned long num, unsigned long listno, unsigned long subs, int done)