From: Baptiste Daroussin Date: Thu, 9 Dec 2021 07:56:40 +0000 (+0100) Subject: send_help: do not execute mlmmj-send X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac0bff293ab28f6c485c80e3bebab6f047b0cc10;p=thirdparty%2Fmlmmj.git send_help: do not execute mlmmj-send --- diff --git a/include/send_help.h b/include/send_help.h index 8585481e..15ecd60b 100644 --- a/include/send_help.h +++ b/include/send_help.h @@ -1,4 +1,6 @@ /* Copyright (C) 2004 Mads Martin Joergensen + * Copyright (C) 2021 Baptiste Daroussin + * * * $Id$ * @@ -27,6 +29,6 @@ #include "mlmmj.h" void send_help(struct mlmmj_list *list, const char *queuefilename, - const char *emailaddr, const char *mlmmjsend); + const char *emailaddr); #endif diff --git a/src/Makefile.am b/src/Makefile.am index d675f88a..5c5bdaf1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -28,7 +28,9 @@ mlmmj_process_SOURCES = mlmmj.c mlmmj-process.c find_email_adr.c \ do_all_the_voodoo_here.c mygetline.c gethdrline.c \ log_error.c controls.c dumpfd2fd.c \ subscriberfuncs.c memory.c log_oper.c \ - send_list.c readn.c unistr.c + send_list.c readn.c unistr.c \ + send_mails.c checkwait_smtpreply.c \ + mail-functions.c init_sockfd.c mlmmj_sub_SOURCES = mlmmj.c mlmmj-sub.c mylocking.c \ chomp.c random-int.c strgen.c \ diff --git a/src/listcontrol.c b/src/listcontrol.c index 1db72ada..1f85adda 100644 --- a/src/listcontrol.c +++ b/src/listcontrol.c @@ -229,8 +229,7 @@ int listcontrol(struct email_container *fromemails, struct mlmmj_list *list, fromemails->emaillist[0], NULL, false); MY_ASSERT(queuefilename); close_text(txt); - send_help(list, queuefilename, - fromemails->emaillist[0], mlmmjsend); + send_help(list, queuefilename, fromemails->emaillist[0]); return -1; } log_oper(list->dir, OPLOGFNAME, "mlmmj-sub: request for digest" @@ -277,8 +276,7 @@ int listcontrol(struct email_container *fromemails, struct mlmmj_list *list, fromemails->emaillist[0], NULL, false); MY_ASSERT(queuefilename); close_text(txt); - send_help(list, queuefilename, - fromemails->emaillist[0], mlmmjsend); + send_help(list, queuefilename, fromemails->emaillist[0]); return -1; } log_oper(list->dir, OPLOGFNAME, "mlmmj-sub: request for nomail" @@ -325,8 +323,7 @@ int listcontrol(struct email_container *fromemails, struct mlmmj_list *list, fromemails->emaillist[0], NULL, false); MY_ASSERT(queuefilename); close_text(txt); - send_help(list, queuefilename, - fromemails->emaillist[0], mlmmjsend); + send_help(list, queuefilename, fromemails->emaillist[0]); return -1; } log_oper(list->dir, OPLOGFNAME, "mlmmj-sub: request for both" @@ -802,8 +799,7 @@ permit: "$listowner$", fromemails->emaillist[0], NULL, false); MY_ASSERT(queuefilename); close_text(txt); - send_help(list, queuefilename, - fromemails->emaillist[0], mlmmjsend); + send_help(list, queuefilename, fromemails->emaillist[0]); break; /* listname+faq@domain.tld */ @@ -824,8 +820,7 @@ permit: "$listowner$", fromemails->emaillist[0], NULL, false); MY_ASSERT(queuefilename); close_text(txt); - send_help(list, queuefilename, - fromemails->emaillist[0], mlmmjsend); + send_help(list, queuefilename, fromemails->emaillist[0]); break; /* listname+get-INDEX@domain.tld */ diff --git a/src/send_help.c b/src/send_help.c index dc65c896..ac009ac9 100644 --- a/src/send_help.c +++ b/src/send_help.c @@ -1,6 +1,6 @@ -/* Copyright (C) 2003 Mads Martin Joergensen - * - * $Id$ +/* + * Copyright (C) 2003 Mads Martin Joergensen + * Copyright (C) 2021 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -24,37 +24,27 @@ #include #include #include -#include #include -#include -#include #include "mlmmj.h" #include "send_help.h" -#include "strgen.h" -#include "find_email_adr.h" -#include "log_error.h" -#include "chomp.h" -#include "wrappers.h" -#include "mygetline.h" -#include "prepstdreply.h" #include "memory.h" +#include "send_mails.h" void send_help(struct mlmmj_list *list, const char *queuefilename, - const char *emailaddr, const char *mlmmjsend) + const char *emailaddr) { + struct mail_headers mh; char *fromaddr; + int queuefd; myasprintf(&fromaddr, "%s%sbounces-help@%s", list->name, list->delim, list->fqdn); - - execlp(mlmmjsend, mlmmjsend, - "-l", "1", - "-L", list->dir, - "-T", emailaddr, - "-F", fromaddr, - "-m", queuefilename, (char *)NULL); - - log_error(LOG_ARGS, "execlp() of '%s' failed", mlmmjsend); + memset(&mh, 0, sizeof(mh)); + mh.to = emailaddr; + mh.from = fromaddr; + queuefd = openat(list->queuefd, queuefilename, O_RDONLY); + if (send_single_mail(list, &mh, queuefd, queuefilename)) + exit(EXIT_SUCCESS); exit(EXIT_FAILURE); }