rpms/mlmmj/devel mlmmj-1.2.5.moderation-race.diff, NONE, 1.1 mlmmj.spec, 1.2, 1.3

Michael G. Fleming (mfleming) fedora-extras-commits at redhat.com
Fri May 6 05:42:40 UTC 2005


Author: mfleming

Update of /cvs/extras/rpms/mlmmj/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv20430

Modified Files:
	mlmmj.spec 
Added Files:
	mlmmj-1.2.5.moderation-race.diff 
Log Message:
Patch added to fix moderation race

mlmmj-1.2.5.moderation-race.diff:

--- NEW FILE mlmmj-1.2.5.moderation-race.diff ---
diff -urN mlmmj-1.2.5.pristine/ChangeLog mlmmj-1.2.5/ChangeLog
--- mlmmj-1.2.5.pristine/ChangeLog	2005-04-26 19:36:16.000000000 +1000
+++ mlmmj-1.2.5/ChangeLog	2005-05-06 15:28:42.000000000 +1000
@@ -1,3 +1,5 @@
+ o When sending moderated mails, rename them so that they wont be moderated
+   again while sending
 1.2.5
  o Make listname+list send the list of regular subscribers to the owner who
    requested it.
diff -urN mlmmj-1.2.5.pristine/src/listcontrol.c mlmmj-1.2.5/src/listcontrol.c
--- mlmmj-1.2.5.pristine/src/listcontrol.c	2005-04-26 20:04:18.000000000 +1000
+++ mlmmj-1.2.5/src/listcontrol.c	2005-05-06 15:28:42.000000000 +1000
@@ -102,7 +102,7 @@
 {
 	char *atsign, *recipdelimsign, *bouncenr, *tmpstr;
 	char *controlstr, *param, *conffilename, *moderatefilename;
-	char *c, *archivefilename;
+	char *c, *archivefilename, *sendfilename;
 	const char *subswitch;
 	size_t len;
 	struct stat stbuf;
@@ -483,16 +483,25 @@
 		/* TODO Add accept/reject parameter to moderate */
 		unlink(mailname);
 		moderatefilename = concatstr(3, listdir, "/moderation/", param);
+		sendfilename = concatstr(2, moderatefilename, ".sending");
 		myfree(param);
+
 		if(stat(moderatefilename, &stbuf) < 0) {
 			myfree(moderatefilename);
 			exit(EXIT_SUCCESS); /* just exit, no mail to moderate */
 		}
+		/* Rename it to avoid mail being sent twice */
+		if(rename(moderatefilename, sendfilename) < 0) {
+			log_error(LOG_ARGS, "Could not rename to .sending");
+			exit(EXIT_FAILURE);
+		}
+
 		log_oper(listdir, OPLOGFNAME, "%s moderated %s",
 				fromemails->emaillist[0], moderatefilename);
+		myfree(moderatefilename);
 		execlp(mlmmjsend, mlmmjsend,
 				"-L", listdir,
-				"-m", moderatefilename, (char *)NULL);
+				"-m", sendfilename, (char *)NULL);
 		log_error(LOG_ARGS, "execlp() of '%s' failed",
 					mlmmjsend);
 		exit(EXIT_FAILURE);


Index: mlmmj.spec
===================================================================
RCS file: /cvs/extras/rpms/mlmmj/devel/mlmmj.spec,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- mlmmj.spec	5 May 2005 23:36:26 -0000	1.2
+++ mlmmj.spec	6 May 2005 05:42:37 -0000	1.3
@@ -3,10 +3,11 @@
 Summary: Mailserver-independent ezmlm-like mailing list manager
 Name: mlmmj
 Version: 1.2.5
-Release: 2
+Release: 3
 License: MIT
 Group: Applications/Internet
 Source: http://mlmmj.mmj.dk/dist/mlmmj-1.2.5.tar.gz
+Patch0: mlmmj-1.2.5.moderation-race.diff
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Requires: smtpdaemon
 URL: http://mlmmj.mmj.dk/
@@ -21,6 +22,8 @@
 
 %setup
 
+%patch -p1 -b .modrace
+
 %build
 %configure
 make %{?_smp_mflags}
@@ -43,6 +46,10 @@
 %{_mandir}/man1/mlmmj-*
 
 %changelog
+* Fri May 6 2005 Michael Fleming <mfleming+rpm at enlartenment.com> 1.2.5-3
+- Upstream patch included fixing a potential race condition on
+  moderation.
+  
 * Fri May 6 2005 Michael Fleming <mfleming+rpm at enlartenment.com> 1.2.5-2
 - Description updated
 - Install macros returned to sane defaults




More information about the fedora-extras-commits mailing list