]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
listcontrol: cleanup omit files on reject
authorBaptiste Daroussin <bapt@FreeBSD.org>
Fri, 14 Apr 2023 08:57:36 +0000 (10:57 +0200)
committerBaptiste Daroussin <bapt@FreeBSD.org>
Fri, 14 Apr 2023 09:00:35 +0000 (11:00 +0200)
When rejecting a mail in moderation on a mailing list with "notmetoo"
activated, there .omit files were leftovers, now we clean them up

ChangeLog
src/listcontrol.c

index 7bce8b4ae272930723c240b93e0301b2d337d0e9..9a4c0b22ed94ddbe6d58f3664c84841b8d6584db 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,8 @@
  o mlmmj-send: -l 6 has been removed
  o mlmmj-send: accept file descriptor number as -s argument
  o mlmmj-send: accept file descriptor number as -m argument
+ o cleanup .omit files leftover if moderated emails are rejected and notmetoo
+   is set.
 1.4.0-a2
  o Fix a crash with forged probe emails
  o mlmmj-send does not need anymore absolute path
index 61e3b02865cd3a90776efbd0475c7fdd615fbd07..8cf9fe7b0cdfd321ad78f45612e700a9549ed9cc 100644 (file)
@@ -496,7 +496,6 @@ int listcontrol(strlist *fromemails, struct ml *ml,
                }
                log_oper(ml->fd, OPLOGFNAME, "%s rejected %s",
                        tll_front(*fromemails), param);
-               free(param);
                if (unlinkat(ml->fd, moderatefilename, 0) != 0) {
                        log_error(LOG_ARGS, "Could not unlink %s",
                                        moderatefilename);
@@ -504,6 +503,10 @@ int listcontrol(strlist *fromemails, struct ml *ml,
                        exit(EXIT_FAILURE);
                }
                free(moderatefilename);
+               xasprintf(&moderatefilename, "moderation/%s.omit", param);
+               unlinkat(ml->fd, moderatefilename, 0);
+               free(moderatefilename);
+               free(param);
                break;
 
        /* listname+permit-COOKIE@domain.tld */