}
static bool
-unsub_bouncers(int dfd, const char *mlmmjunsub, const char *listdir, int logfd)
+unsub_bouncers(int dfd, int logfd)
{
DIR *bouncedir;
char *probefile, *address, *a, *firstbounce;
}
*a = '@';
- exec_and_wait(mlmmjunsub, "-L", listdir, "-b", "-a", address,
- NULL);
+ if (!do_unsubscribe(dfd, address, SUB_ALL)) {
+ log(" - Some errors during unsubscription of %s\n",
+ address);
+ ret = false;
+ continue;
+ }
unlinkat(bfd, dp->d_name, 0);
xasprintf(&a, "%s.lastmsg", dp->d_name);
unlinkat(bfd, a, 0);
}
void do_maintenance(int listfd, const char *listdir, const char *mlmmjsend,
- const char *mlmmjbounce, const char *mlmmjunsub)
+ const char *mlmmjbounce)
{
char *random, *logname;
char timenow[64];
"traces, see %s", MAINTD_LOGFILE);
log("unsub_bouncers\n");
- if (!unsub_bouncers(listfd, mlmmjunsub, listdir, logfd))
+ if (!unsub_bouncers(listfd, logfd))
log_err("An error occured while unsubscribing bouncing emails, "
"see %s", MAINTD_LOGFILE);
if(listdir) {
log_set_namef("%s(%s)", argv[0], listdir);
int fd = open(listdir, O_DIRECTORY);
- do_maintenance(fd, listdir, mlmmjsend, mlmmjbounce,
- mlmmjunsub);
+ do_maintenance(fd, listdir, mlmmjsend, mlmmjbounce);
goto mainsleep;
}
char *l;
xasprintf(&l, "%s/%s", dirlists, dp->d_name);
log_set_namef("%s(%s)", argv[0], l);
- do_maintenance(fd, l, mlmmjsend, mlmmjbounce,
- mlmmjunsub);
+ do_maintenance(fd, l, mlmmjsend, mlmmjbounce);
free(l);
close(fd);
}
atf_check -s exit:1 test -f list/subscribers.d/p
atf_check -s exit:1 test -f list/digesters.d/p
atf_check -s exit:1 test -f list/nomailsubs.d/p
+
+ echo "a:1234 # plop" > list/bounce/plop=meh
+ echo "plop@meh" > list/digesters.d/p
+ rm -rf list/nomailsubs.d
+ atf_check -s exit:0 -e match:"An error occured while unsubscribing bouncing emails, see mlmmj-maintd.lastrun.log" $mlmmjmaintd -L list -F
+ atf_check -s exit:0 test -f list/bounce/plop=meh
+ atf_check -s exit:1 test -f list/digesters.d/p
+ output="Starting maintenance run at
+
+clean_moderation
+clean_discarded
+clean_subconf
+clean_unsubconf
+resend_queue
+resend_requeue
+clean_nolongerbouncing
+unsub_bouncers
+ - Some errors during unsubscription of plop@meh
+probe_bouncers
+run_digests
+ - No readable index file: no digest
+"
+ atf_check -o "inline:$output" sed -e "s/at .*/at/" list/mlmmj-maintd.lastrun.log
}