]> git.ipfire.org Git - thirdparty/mlmmj.git/log
thirdparty/mlmmj.git
2 weeks agomake: fixes to clean target 101/head
Uffe Jakobsen [Mon, 18 May 2026 09:32:02 +0000 (11:32 +0200)] 
make: fixes to clean target

2 weeks agoFix compile warnings 100/head
Uffe Jakobsen [Sun, 17 May 2026 22:24:45 +0000 (00:24 +0200)] 
Fix compile warnings

ArchLinux: gcc version 16.1.1 20260430 (GCC)

mlmmj.c: In function ‘bouncemail’:
mlmmj.c:450:21: warning: unused variable ‘st’ [-Wunused-variable]
  450 |         struct stat st;
      |                     ^~

In file included from mlmmj.c:23:
mlmmj.c: In function ‘atfu_find_in_list_body’:
/tmp/mlmmj-devel.git/include/vec.h:93:15: warning: value computed is not used [-Wunused-value]
   93 |         (v)->d[--(v)->len]
      |         ~~~~~~^~~~~~~~~~~~
mlmmj.c:3611:9: note: in expansion of macro ‘vec_pop’
 3611 |         vec_pop(&bla);
      |         ^~~~~~~

ArchLinux: clang version 22.1.5

mlmmj-process.c:829:19: warning: variable 'txt' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
  829 |                             } else if (modonlypost) {
      |                                        ^~~~~~~~~~~
mlmmj-process.c:833:18: note: uninitialized use occurs here
  833 |                             MY_ASSERT(txt);
      |                                       ^~~
mlmmj-process.c:829:15: note: remove the 'if' if its condition is always true
  829 |                             } else if (modonlypost) {
      |                                    ^~~~~~~~~~~~~~~~
mlmmj-process.c:287:11: note: initialize the variable 'txt' to silence this warning
  287 |         text *txt;
      |                  ^
      |                   = NULL

3 weeks agoAdd editorconfig to project
Uffe Jakobsen [Fri, 15 May 2026 19:09:35 +0000 (21:09 +0200)] 
Add editorconfig to project

3 weeks agofix: tests: clean up cannot remove dir 97/head
Uffe Jakobsen [Fri, 15 May 2026 21:30:01 +0000 (23:30 +0200)] 
fix: tests: clean up cannot remove dir

3 weeks agofakesmtpd: do not leave zombies
Baptiste Daroussin [Sun, 10 May 2026 12:53:03 +0000 (14:53 +0200)] 
fakesmtpd: do not leave zombies

fixes: #95

4 weeks agoAdd MIME type detection/rejection to mlmmj-receive
Baptiste Daroussin [Sat, 9 May 2026 12:09:25 +0000 (14:09 +0200)] 
Add MIME type detection/rejection to mlmmj-receive

When control/mimedeny exists, parse MIME headers and body to detect
unwanted MIME types in both top-level and multipart sub-parts.  Adds
an X-ThisMailContainsUnwantedMimeParts header (Y/N) without stripping
any content.

New functions: read_headers(), write_headers(),
update_unwanted_mime_header(), parse_body(), process_mail().

If control/mimedeny is absent, behavior is unchanged (dumpfd2fd).

Fixes from contrib/receivestrip/:
- use-after-free in header reading (free after vec_push)
- boundary detection missing "--" prefix in MIME body

Tests: mimedeny_simple, mimedeny_none, mimedeny_nocontenttype,
mimedeny_multipart

4 weeks agofix: remove double semicolon in subscribe_type()
Baptiste Daroussin [Fri, 8 May 2026 06:38:12 +0000 (08:38 +0200)] 
fix: remove double semicolon in subscribe_type()

4 weeks agofix: remove trailing semicolon from gen_addr_cookie macro
Baptiste Daroussin [Fri, 8 May 2026 06:37:47 +0000 (08:37 +0200)] 
fix: remove trailing semicolon from gen_addr_cookie macro

6 weeks ago2.0.2 RELEASE_2_0_1
Baptiste Daroussin [Thu, 23 Apr 2026 11:55:04 +0000 (13:55 +0200)] 
2.0.2

6 weeks agofix toolchain override
Baptiste Daroussin [Thu, 23 Apr 2026 11:52:45 +0000 (13:52 +0200)] 
fix toolchain override

6 weeks agoRelease 2.0.1
Baptiste Daroussin [Thu, 23 Apr 2026 11:42:19 +0000 (13:42 +0200)] 
Release 2.0.1

6 weeks agoDo not install static only libraries
Baptiste Daroussin [Thu, 23 Apr 2026 11:41:47 +0000 (13:41 +0200)] 
Do not install static only libraries

6 weeks agofix configugre with --mandir option
Baptiste Daroussin [Thu, 23 Apr 2026 11:39:05 +0000 (13:39 +0200)] 
fix configugre with --mandir option

6 weeks agobuild: fix warnings RELEASE_2_0_0
Baptiste Daroussin [Thu, 23 Apr 2026 08:41:28 +0000 (10:41 +0200)] 
build: fix warnings

6 weeks agoFix CI after removal of autotools
Baptiste Daroussin [Thu, 23 Apr 2026 07:46:34 +0000 (09:46 +0200)] 
Fix CI after removal of autotools

6 weeks agoRelease 2.0.0
Baptiste Daroussin [Thu, 23 Apr 2026 07:40:57 +0000 (09:40 +0200)] 
Release 2.0.0

6 weeks agobuild: bbuild system
Baptiste Daroussin [Thu, 23 Apr 2026 07:16:40 +0000 (09:16 +0200)] 
build: bbuild system

6 weeks agoAdd the ability to run make distcheck
Baptiste Daroussin [Wed, 22 Apr 2026 11:27:14 +0000 (13:27 +0200)] 
Add the ability to run make distcheck

6 weeks agofix tests
Baptiste Daroussin [Wed, 22 Apr 2026 11:02:58 +0000 (13:02 +0200)] 
fix tests

7 weeks agoTUNABLES: clarify the documentation for subonlypost and modonlypost
Baptiste Daroussin [Fri, 17 Apr 2026 09:33:09 +0000 (11:33 +0200)] 
TUNABLES: clarify the documentation for subonlypost and modonlypost

Fixes: #93
7 weeks agosubrelease: if there are moderator defined, then deactivate subrelease
Baptiste Daroussin [Fri, 17 Apr 2026 07:44:52 +0000 (09:44 +0200)] 
subrelease: if there are moderator defined, then deactivate subrelease

8 weeks agomove the installation back to bin
Baptiste Daroussin [Tue, 7 Apr 2026 20:03:46 +0000 (22:03 +0200)] 
move the installation back to bin

2 months agoresend_queue: do not leak a fd
Baptiste Daroussin [Mon, 30 Mar 2026 20:23:44 +0000 (22:23 +0200)] 
resend_queue: do not leak a fd

Instead reset temporarily the CLOEXEC flag and reset it later

2 months agoresend_queue: pass the archive directory via fd to mlmmj-send
Baptiste Daroussin [Mon, 30 Mar 2026 17:47:09 +0000 (19:47 +0200)] 
resend_queue: pass the archive directory via fd to mlmmj-send

duplicate the filedescriptor which archive_open explicitly mark as
O_CLOEXEC.

2 months agoarchive_open: remove ctrlfd argument
Baptiste Daroussin [Mon, 30 Mar 2026 17:42:35 +0000 (19:42 +0200)] 
archive_open: remove ctrlfd argument

It was intended to be used in the future but I change my mind on its
usage

2 months agoarchive_migrate: stop polluting the logs
Baptiste Daroussin [Mon, 30 Mar 2026 17:38:37 +0000 (19:38 +0200)] 
archive_migrate: stop polluting the logs

2 months agoPrepare release 2.0.0
Baptiste Daroussin [Sun, 29 Mar 2026 08:07:42 +0000 (10:07 +0200)] 
Prepare release 2.0.0

2 months agodocumentation: update with latest features
Baptiste Daroussin [Sun, 29 Mar 2026 08:01:58 +0000 (10:01 +0200)] 
documentation: update with latest features

2 months agoadd optional YYYY/MM archive partitioning via control/archivepartition
Baptiste Daroussin [Sun, 29 Mar 2026 06:21:04 +0000 (08:21 +0200)] 
add optional YYYY/MM archive partitioning via control/archivepartition

Large mailing lists accumulate thousands of files in a single archive/
directory, degrading filesystem performance. When control/archivepartition
exists, new archives are written to archive/YYYY/MM/N and mlmmj-maintd
automatically migrates existing flat archives based on file mtime.
Reading always tries flat layout first then falls back to scanning
subdirectories, so archives work regardless of layout.

2 months agogenerate RFC 2919/2369 List-* and Precedence headers natively
Baptiste Daroussin [Sun, 29 Mar 2026 05:55:55 +0000 (07:55 +0200)] 
generate RFC 2919/2369 List-* and Precedence headers natively

Mailing list messages without List-Id/Precedence headers cause vacation
autoreplies to trigger bounces leading to unsubscriptions, prevent mail
clients like Delta Chat from detecting list messages, and hurt
deliverability with major providers.

Generate List-Id, List-Post, List-Help, List-Subscribe, List-Unsubscribe,
and Precedence headers by default in do_all_the_voodoo_here(). List-Owner
is included only when control/owner exists. All headers can be disabled
via control/nolistheaders.

2 months agomlmmj-make-ml: use full email address for default owner
Baptiste Daroussin [Sun, 29 Mar 2026 02:52:18 +0000 (04:52 +0200)] 
mlmmj-make-ml: use full email address for default owner

The default owner "postmaster" lacks a domain part, causing
mlmmj-send to reject it with "No @ in address". Use the FQDN
already collected earlier in the script to build a proper
postmaster@FQDN default.

Closes #36

2 months agosend_mail: add X-Forwarded-To and X-Signed-Recipient headers
Baptiste Daroussin [Sun, 29 Mar 2026 02:38:25 +0000 (04:38 +0200)] 
send_mail: add X-Forwarded-To and X-Signed-Recipient headers

Add per-recipient headers to improve deliverability and support DARA
(draft ARC replay-resistant authentication):

- X-Forwarded-To: helps Gmail recognize legitimate forwarding
- X-Signed-Recipient: used in ARC signatures to prove the message
  was intended for a specific recipient

Both are enabled independently via control files (xforwardedto and dara).
Like addtohdr, these are incompatible with VERP since they require
per-recipient header injection.

Closes #34

2 months agosubscription: follow reply-to on susbcription
Baptiste Daroussin [Sat, 28 Mar 2026 21:55:02 +0000 (22:55 +0100)] 
subscription: follow reply-to on susbcription

2 months agotreat exit 127 ass error
Baptiste Daroussin [Sat, 28 Mar 2026 20:46:55 +0000 (21:46 +0100)] 
treat exit 127 ass error

posix_spawnp(3) may report exec() failures via the
child's exit status (127) instead of the return value

2 months agosyslog: only support system with syslog
Baptiste Daroussin [Fri, 27 Mar 2026 20:31:41 +0000 (21:31 +0100)] 
syslog: only support system with syslog

2 months agofix build
Baptiste Daroussin [Fri, 27 Mar 2026 20:15:01 +0000 (21:15 +0100)] 
fix build

2 months agoadd forgotten configure scrip
Baptiste Daroussin [Fri, 27 Mar 2026 20:11:31 +0000 (21:11 +0100)] 
add forgotten configure scrip

2 months agobuild system, convert to autosetup + custom mk framework
Baptiste Daroussin [Fri, 27 Mar 2026 12:54:19 +0000 (13:54 +0100)] 
build system, convert to autosetup + custom mk framework

2 months agoReplace foot's tllist.h with my own vec.h
Baptiste Daroussin [Fri, 27 Mar 2026 09:36:26 +0000 (10:36 +0100)] 
Replace foot's tllist.h with my own vec.h

I wrote for FreeBSD's pkg manager, no functionnal change expected

2 months agoplug memory leak
Baptiste Daroussin [Fri, 27 Mar 2026 07:44:47 +0000 (08:44 +0100)] 
plug memory leak

2 months agoUTF8: prevent out of bound reading
Baptiste Daroussin [Fri, 27 Mar 2026 07:40:26 +0000 (08:40 +0100)] 
UTF8: prevent out of bound reading

2 months agoplug memory leak and fix naming collision
Baptiste Daroussin [Fri, 27 Mar 2026 07:36:50 +0000 (08:36 +0100)] 
plug memory leak and fix naming collision

2 months agoFix fd leak
Baptiste Daroussin [Fri, 27 Mar 2026 07:17:11 +0000 (08:17 +0100)] 
Fix fd leak

2 months agofix TOCTOU by using O_NOFOLLOW which also simplifies code
Baptiste Daroussin [Fri, 27 Mar 2026 07:13:01 +0000 (08:13 +0100)] 
fix TOCTOU by using O_NOFOLLOW which also simplifies code

2 months agolimite line length to maximum 64k
Baptiste Daroussin [Fri, 27 Mar 2026 06:58:52 +0000 (07:58 +0100)] 
limite line length to maximum 64k

2 months agosetgid: test for failures
Baptiste Daroussin [Fri, 27 Mar 2026 06:51:25 +0000 (07:51 +0100)] 
setgid: test for failures

2 months agoadd forgotten setgid
Baptiste Daroussin [Fri, 27 Mar 2026 06:50:08 +0000 (07:50 +0100)] 
add forgotten setgid

2 months agoharden email validations
Baptiste Daroussin [Fri, 27 Mar 2026 06:34:13 +0000 (07:34 +0100)] 
harden email validations

2 months agomail: prevent header injections
Baptiste Daroussin [Fri, 27 Mar 2026 05:59:27 +0000 (06:59 +0100)] 
mail: prevent header injections

while theorically impossible as prefiltered by
MTA, I am aware of usages of mlmmj where inputs
are not through MTA, so better be safe than sorry

2 months agofix bad error message
Baptiste Daroussin [Fri, 27 Mar 2026 05:41:30 +0000 (06:41 +0100)] 
fix bad error message

2 months agoprevent a crash in case of broken connection
Baptiste Daroussin [Thu, 26 Mar 2026 21:32:59 +0000 (22:32 +0100)] 
prevent a crash in case of broken connection

2 months agoensure fd is initialized
Baptiste Daroussin [Thu, 26 Mar 2026 21:31:58 +0000 (22:31 +0100)] 
ensure fd is initialized

2 months agorandom: improve on platforms without arc4random
Baptiste Daroussin [Thu, 26 Mar 2026 21:30:27 +0000 (22:30 +0100)] 
random: improve on platforms without arc4random

2 months agocleanup: remove debug and fix EINTR logic
Baptiste Daroussin [Thu, 26 Mar 2026 21:27:23 +0000 (22:27 +0100)] 
cleanup: remove debug and fix EINTR logic

2 months agoexec_and_wait: multiple fixes
Baptiste Daroussin [Thu, 26 Mar 2026 20:34:03 +0000 (21:34 +0100)] 
exec_and_wait: multiple fixes

Fix EINTR loop
Return -1 if the process did not exit normally.

2 months agosubrelease: the order of the test was not deterministic
Baptiste Daroussin [Sat, 14 Mar 2026 22:48:35 +0000 (23:48 +0100)] 
subrelease: the order of the test was not deterministic

Replace with simple matches

2 months agosubrelease: fix tests RELEASE_1_8_0
Baptiste Daroussin [Sat, 14 Mar 2026 22:41:23 +0000 (23:41 +0100)] 
subrelease: fix tests

2 months agoRelease 1.8.0
Baptiste Daroussin [Sat, 14 Mar 2026 22:34:11 +0000 (23:34 +0100)] 
Release 1.8.0

2 months agoselfmoderate: backout better served by subrelease
Baptiste Daroussin [Sat, 14 Mar 2026 22:13:46 +0000 (23:13 +0100)] 
selfmoderate: backout better served by subrelease

2 months agosubrelease: finish the implementation started in 2012
Baptiste Daroussin [Sat, 14 Mar 2026 21:35:04 +0000 (22:35 +0100)] 
subrelease: finish the implementation started in 2012

2 months agoFactorize code a little
Baptiste Daroussin [Wed, 11 Mar 2026 10:10:37 +0000 (11:10 +0100)] 
Factorize code a little

2 months agoUse buffered I/O where possible
Baptiste Daroussin [Tue, 10 Mar 2026 21:50:38 +0000 (22:50 +0100)] 
Use buffered I/O where possible

2 months agovoodoo: use buffered I/O
Baptiste Daroussin [Tue, 10 Mar 2026 21:23:43 +0000 (22:23 +0100)] 
voodoo: use buffered I/O

2 months agogethdrline: use xstring
Baptiste Daroussin [Tue, 10 Mar 2026 21:17:15 +0000 (22:17 +0100)] 
gethdrline: use xstring

2 months agoremove useless fsync
Baptiste Daroussin [Tue, 10 Mar 2026 21:15:01 +0000 (22:15 +0100)] 
remove useless fsync

2 months agorewind_thread_list: imrpove
Baptiste Daroussin [Tue, 10 Mar 2026 21:07:32 +0000 (22:07 +0100)] 
rewind_thread_list: imrpove

Add test and rework the code:
- only read mail headers
- improvement memory management
- cleanup code
- make the code testable

2 months agoprocess_headers_fd: use buffered I/O
Baptiste Daroussin [Tue, 10 Mar 2026 20:55:56 +0000 (21:55 +0100)] 
process_headers_fd: use buffered I/O

2 months agofakesmtp: make it more robust
Baptiste Daroussin [Tue, 10 Mar 2026 13:01:37 +0000 (14:01 +0100)] 
fakesmtp: make it more robust

Instead of statically bind a port, dynamically bind one and report which
one was open.

Better handle killing the process when kyua receives sigterm or sigkill

2 months agovoodoo: add more unit tests
Baptiste Daroussin [Tue, 10 Mar 2026 09:56:10 +0000 (10:56 +0100)] 
voodoo: add more unit tests

2 months agoscan_headers: add unit tests
Baptiste Daroussin [Tue, 10 Mar 2026 09:44:58 +0000 (10:44 +0100)] 
scan_headers: add unit tests

2 months agosubstitute: add unit tests
Baptiste Daroussin [Tue, 10 Mar 2026 09:05:58 +0000 (10:05 +0100)] 
substitute: add unit tests

2 months agovoodoo: add tests for header manipulations
Baptiste Daroussin [Tue, 10 Mar 2026 08:59:20 +0000 (09:59 +0100)] 
voodoo: add tests for header manipulations

2 months agodumpfd2fd: cover with more tests
Baptiste Daroussin [Tue, 10 Mar 2026 08:50:37 +0000 (09:50 +0100)] 
dumpfd2fd: cover with more tests

2 months agowrite_mailbody: improve testing
Baptiste Daroussin [Tue, 10 Mar 2026 08:29:39 +0000 (09:29 +0100)] 
write_mailbody: improve testing

2 months agoreadlf: improve completness of the test
Baptiste Daroussin [Tue, 10 Mar 2026 08:24:52 +0000 (09:24 +0100)] 
readlf: improve completness of the test

2 months agounistr: add unit tests
Baptiste Daroussin [Tue, 10 Mar 2026 08:18:35 +0000 (09:18 +0100)] 
unistr: add unit tests

2 months agosubscription: add more tests about subscriptions functions
Baptiste Daroussin [Tue, 10 Mar 2026 08:09:37 +0000 (09:09 +0100)] 
subscription: add more tests about subscriptions functions

2 months agocheckwait_smtpreply add unit tests
Baptiste Daroussin [Tue, 10 Mar 2026 07:19:16 +0000 (08:19 +0100)] 
checkwait_smtpreply add unit tests

2 months agomlmmj-process: factorize
Baptiste Daroussin [Tue, 10 Mar 2026 06:50:36 +0000 (07:50 +0100)] 
mlmmj-process: factorize

2 months agosend_digest: code cleanup
Baptiste Daroussin [Tue, 10 Mar 2026 06:48:09 +0000 (07:48 +0100)] 
send_digest: code cleanup

no functional change intended

2 months agoproperky close smtp in case of ehlo failure
Baptiste Daroussin [Tue, 10 Mar 2026 06:31:18 +0000 (07:31 +0100)] 
properky close smtp in case of ehlo failure

2 months agosend_mail improve error handling
Baptiste Daroussin [Mon, 9 Mar 2026 21:38:28 +0000 (22:38 +0100)] 
send_mail improve error handling

2 months agosend_mail: test openat error
Baptiste Daroussin [Mon, 9 Mar 2026 21:35:16 +0000 (22:35 +0100)] 
send_mail: test openat error

2 months agoUse buffered I/O
Baptiste Daroussin [Mon, 9 Mar 2026 21:26:53 +0000 (22:26 +0100)] 
Use buffered I/O

2 months agofix thread grouping in digest
Baptiste Daroussin [Mon, 9 Mar 2026 21:22:08 +0000 (22:22 +0100)] 
fix thread grouping in digest

2 months agofix send_digest garbage
Baptiste Daroussin [Mon, 9 Mar 2026 21:18:02 +0000 (22:18 +0100)] 
fix send_digest garbage

3 months agoUpdate exim4 configuration hints 88/head
Wulf Coulmann [Fri, 6 Mar 2026 08:40:23 +0000 (09:40 +0100)] 
Update exim4 configuration hints
  - add debug output to router and transport
  - lookup changes according exim4 >= 4.94 taind behaver (Errors like "Tainted filename for search")
  - add router condition for setups with more than one domain (you need uniq local_parts over all your lists, but we do not want to match the transport on local_part@wrong.domain)

hint
  - VERP config is not changed/updated, may not work

3 months agomlmmj-process: clean up queue file on second do_all_the_voodoo_here failure 86/head
Michael S. Tsirkin [Sun, 8 Feb 2026 22:24:33 +0000 (17:24 -0500)] 
mlmmj-process: clean up queue file on second do_all_the_voodoo_here failure

The owner-forwarding path re-opens donemailname with O_TRUNC and calls
do_all_the_voodoo_here a second time. If this call fails, the truncated
queue file is left behind. Add unlink(donemailname) and free(donemailname)
to match the cleanup already done at the first call site.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3 months agotests: add test for owner path queue file cleanup
Michael S. Tsirkin [Sat, 17 Jan 2026 13:01:09 +0000 (08:01 -0500)] 
tests: add test for owner path queue file cleanup

Test that the queue file is cleaned up when do_all_the_voodoo_here
fails in the owner-forwarding path (second voodoo call).

Uses ulimit -n to limit file descriptors. With a tight limit, the
first voodoo succeeds but the second fails on dup().

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
3 months agoRelease 1.7.1 RELEASE_1_7_1
Baptiste Daroussin [Fri, 13 Feb 2026 14:10:35 +0000 (15:10 +0100)] 
Release 1.7.1

3 months agomlmmj-process: guard fclose on failed fopen
Michael S. Tsirkin [Tue, 10 Feb 2026 11:37:45 +0000 (06:37 -0500)] 
mlmmj-process: guard fclose on failed fopen

Avoid undefined behavior when queue file opens fail in moderation
notification paths.

3 months agoprepstdreply: fix resource leaks in error paths
Michael S. Tsirkin [Mon, 12 Jan 2026 15:37:43 +0000 (10:37 -0500)] 
prepstdreply: fix resource leaks in error paths

Use close_text() instead of free() when cleaning up txt in error paths.
The txt parameter is a fully initialized text structure from open_text(),
so it needs proper cleanup via close_text() to free all internal resources.

Also add missing close_text() call when prepstdreply_to() fails.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
3 months agodo_all_the_voodoo_here: fix memory leaks and NULL dereference
Michael S. Tsirkin [Mon, 12 Jan 2026 15:37:34 +0000 (10:37 -0500)] 
do_all_the_voodoo_here: fix memory leaks and NULL dereference

Fix two pre-existing issues:

1. Memory leak: unfolded variable from tll_pop_front() was never freed
   in the header processing loop. Add free(unfolded) at loop end and
   before continue statements.

2. NULL dereference: posteraddr can be NULL if From: header is missing
   or malformed. Pass empty string to process_headers_fd() when NULL
   to avoid undefined behavior in xasprintf().

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
3 months agosend_help: fix FILE* leak in send_help_noexit
Michael S. Tsirkin [Fri, 9 Jan 2026 10:24:34 +0000 (05:24 -0500)] 
send_help: fix FILE* leak in send_help_noexit

Add missing fclose(mail.fp) after send_single_mail(). The file is
opened with fopen() but never closed before returning.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
3 months agosubscriberfuncs: fix FILE* leak in generate_subconfirm
Michael S. Tsirkin [Fri, 9 Jan 2026 10:24:27 +0000 (05:24 -0500)] 
subscriberfuncs: fix FILE* leak in generate_subconfirm

Add missing fclose(mail.fp) after send_single_mail(). The file is
opened with fopen() but never closed before exit().

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
3 months agodo_all_the_voodoo_here: fix FILE* leaks in error paths
Michael S. Tsirkin [Fri, 9 Jan 2026 10:01:42 +0000 (05:01 -0500)] 
do_all_the_voodoo_here: fix FILE* leaks in error paths

Four error paths return without closing the FILE* f:
- process_headers_fd() failure in MIME header case
- process_headers_fd() failure in !hdrsadded case
- dprintf() failure when writing header terminator
- dumpfd2fd() failure when dumping mail body

Add fclose(f) before each return -1.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
3 months agolistcontrol: fix resource leaks in CTRL_GET error path
Michael S. Tsirkin [Fri, 9 Jan 2026 10:01:32 +0000 (05:01 -0500)] 
listcontrol: fix resource leaks in CTRL_GET error path

When send_single_mail() fails, the code returns without freeing
bounceaddr, archivefilename, or closing mail.fp. Also add cleanup on
the success path which is missing the same resources.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
3 months agofix missing fdopen() NULL checks across multiple files
Michael S. Tsirkin [Thu, 8 Jan 2026 12:48:45 +0000 (07:48 -0500)] 
fix missing fdopen() NULL checks across multiple files

If fdopen() fails (e.g., due to memory pressure), passing NULL to
subsequent stdio operations (getline, fclose, scan_headers, etc.)
causes undefined behavior, typically segmentation faults.

Add NULL checks after fdopen() calls in multiple files:

subscriberfuncs.c:
- find_subscriber(): return false on fdopen failure
- autosubscribe_sender(): return early on fdopen failure

mlmmj-send.c:
- send_mail_many_fd(): return -1 on fdopen failure
- main(): exit with failure on fdopen failure

mlmmj-process.c:
- is_moderator(): exit with failure on fdopen failure

listcontrol.c:
- listcontrol(): return -1 on fdopen failure, freeing resources

prepstdreply.c:
- init_file_lines_fd(): return NULL on fdopen failure
- get_msgid_line(): return id on fdopen failure (graceful degradation)
- open_text_fd(): return NULL on fdopen failure

do_all_the_voodoo_here.c:
- do_all_the_voodoo_here(): return -1 on fdopen or dup failure

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
3 months agomlmmj: fix resource leaks in dsnparseaddr()
Michael S. Tsirkin [Thu, 8 Jan 2026 12:41:26 +0000 (07:41 -0500)] 
mlmmj: fix resource leaks in dsnparseaddr()

The dsnparseaddr() function has three resource leaks:

1. The file handle 'f' is never closed after parsing the DSN mail
2. The 'boundary' string is allocated but never freed
3. The 'emails' list is populated but never freed on exit

Free all three resources before all return paths.

Fixes: a1f1fbc8 ("mlmmj-bounce: make sure mlmmj-bounce is never called directly")
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
3 months agomlmmj: fix multiple resource leaks in send_probe()
Michael S. Tsirkin [Thu, 8 Jan 2026 12:40:30 +0000 (07:40 -0500)] 
mlmmj: fix multiple resource leaks in send_probe()

The send_probe() function has several resource leaks:

1. bfd (bounce directory file descriptor) is opened but never closed
2. fd (probe file descriptor) is opened but never closed on success
3. mail.fp is not closed on send_single_mail() failure path
4. queuefilename is allocated by prepstdreply() but never freed
5. myaddr and from are not freed on send_single_mail() failure path

Clean up all resources properly on both success and failure
paths.

Fixes: 958d3143 ("probes: fix a regression causing the probes not to sent the bounce numbers")
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>