]>
git.ipfire.org Git - thirdparty/mlmmj.git/log
mmj [Thu, 3 Jun 2004 10:45:33 +0000 (20:45 +1000)]
FILE* is now fd
mmj [Thu, 3 Jun 2004 06:36:20 +0000 (16:36 +1000)]
Make listcontrol get the mailname for mlmmj-bounce
mmj [Thu, 3 Jun 2004 06:34:36 +0000 (16:34 +1000)]
3 things:
· Check that bouncefile is not a symlink (TODO)
· When everything went ok, return EXIT_SUCCES not EXIT_FAILURE
· If there's a bouncemail, save it as bfilename.lastmsg
And in more readable form:
--- mlmmj-bounce.c 26 May 2004 23:25:57 -0000 1.7
+++ mlmmj-bounce.c 3 Jun 2004 06:30:39 -0000
@@ -37,16 +37,16 @@
int main(int argc, char **argv)
{
- int opt;
+ int opt, fd;
char *listdir = NULL, *address = NULL, *number = NULL;
- char *bfilename, *a, *buf;
+ char *mailname = NULL, *savename, *bfilename, *a, *buf;
size_t len;
- int fd;
time_t t;
+ struct stat st;
log_set_name(argv[0]);
- while ((opt = getopt(argc, argv, "hVL:a:n:")) != -1) {
+ while ((opt = getopt(argc, argv, "hVL:a:n:m:")) != -1) {
switch(opt) {
case 'L':
listdir = optarg;
@@ -54,6 +54,9 @@
case 'a':
address = optarg;
break;
+ case 'm':
+ mailname = optarg;
+ break;
case 'n':
number = optarg;
break;
@@ -109,7 +112,14 @@
exit(EXIT_SUCCESS); /* Not subbed, so exit silently */
}
- /* TODO make sure the file we open below is not a symlink */
+ if(lstat(bfilename, &st) == 0) {
+ if((st.st_mode & S_IFLNK) == S_IFLNK) {
+ log_error(LOG_ARGS, "%s is a symbolic link",
+ bfilename);
+ exit(EXIT_FAILURE);
+ }
+ }
+
if ((fd = open(bfilename, O_WRONLY|O_APPEND|O_CREAT,
S_IRUSR|S_IWUSR)) < 0) {
log_error(LOG_ARGS, "Could not open '%s'", bfilename);
@@ -136,5 +146,11 @@
writen(fd, buf, strlen(buf));
close(fd);
- return EXIT_FAILURE;
+ if(mailname) {
+ savename = concatstr(2, bfilename, ".lastmsg");
+ rename(mailname, savename);
+ free(savename);
+ }
+
+ return EXIT_SUCCESS;
}
mmj [Wed, 2 Jun 2004 22:57:45 +0000 (08:57 +1000)]
mlmmj-recieve deFILEified
mmj [Wed, 2 Jun 2004 22:47:20 +0000 (08:47 +1000)]
dumpfd2fd
mortenp [Wed, 2 Jun 2004 21:57:30 +0000 (07:57 +1000)]
"Resolving" the conflict by committing my version anyway (it has a nice comment). That guy is fast.
mmj [Wed, 2 Jun 2004 21:52:48 +0000 (07:52 +1000)]
Simply close socket if error in transmission
mmj [Wed, 2 Jun 2004 21:50:40 +0000 (07:50 +1000)]
mygetline EINTR handling and errno = 0
mortenp [Wed, 2 Jun 2004 21:34:32 +0000 (07:34 +1000)]
fixed fgets() loop
mmj [Wed, 2 Jun 2004 19:27:20 +0000 (05:27 +1000)]
--- src/mlmmj-send.c 2 Jun 2004 19:10:11 -0000 1.31
+++ src/mlmmj-send.c 2 Jun 2004 19:19:48 -0000
@@ -35,8 +35,6 @@
#include "log_error.h"
#include "mygetline.h"
-static int conncount = 0; /* Connection count */
-
char *bounce_from_adr(const char *recipient, const char *listadr,
const char *mailfilename)
{
@@ -345,15 +343,6 @@
return 0;
}
-void sig_child(int sig)
-{
- pid_t pid;
- int stat;
-
- while((pid = waitpid(-1, &stat, WNOHANG) > 0))
- conncount--;
-}
-
static void print_help(const char *prg)
{
printf("Usage: %s [-L /path/to/list || -l listctrl] -m /path/to/mail "
@@ -380,7 +369,7 @@
{
size_t len = 0;
int sockfd = 0, opt, mindex;
- int deletewhensent = 1, *newsockfd, sendres, archive = 1;
+ int deletewhensent = 1, sendres, archive = 1;
char *listaddr, *mailfilename = NULL, *subfilename = NULL;
char *replyto = NULL, *bounceaddr = NULL, *to_addr = NULL;
char *relayhost = NULL, *archivefilename = NULL, *tmpstr;
@@ -389,8 +378,6 @@
DIR *subddir;
FILE *subfile = NULL, *mailfile = NULL, *tmpfile;
struct dirent *dp;
- pid_t childpid;
- struct sigaction sigact;
log_set_name(argv[0]);
@@ -564,11 +551,6 @@
}
free(subddirname);
- sigact.sa_handler = sig_child;
- sigemptyset(&sigact.sa_mask);
- sigact.sa_flags = SA_NOCLDSTOP;
- sigaction(SIGCHLD, &sigact, 0);
-
while((dp = readdir(subddir)) != NULL) {
if(!strcmp(dp->d_name, "."))
continue;
@@ -585,41 +567,19 @@
fprintf(stderr, "found subfile '%s'\n", subfilename);
free(subfilename);
- while((conncount >= MAX_CONNECTIONS))
- usleep(WAITSLEEP);
-
- childpid = fork();
- if(childpid < 0)
- log_error(LOG_ARGS, "Could not fork.");
- /* TODO: we have to keep track of unsent
- * files */
-
- conncount++;
-
- if(childpid == 0) {
- newsockfd = malloc(sizeof(int));
- initsmtp(newsockfd, relayhost);
- send_mail_many(*newsockfd, NULL, NULL,
- mailfile, subfile, listaddr,
- archivefilename, listdir,
- mlmmjbounce);
- endsmtp(newsockfd);
- free(newsockfd);
- fclose(subfile);
- exit(EXIT_SUCCESS);
- } else
- fclose(subfile);
+ initsmtp(&sockfd, relayhost);
+ send_mail_many(sockfd, NULL, NULL, mailfile, subfile,
+ listaddr, archivefilename, listdir,
+ mlmmjbounce);
+ endsmtp(&sockfd);
+ fclose(subfile);
}
closedir(subddir);
break;
}
- while(conncount > 0)
- usleep(WAITSLEEP);
-
if(archive) {
rename(mailfilename, archivefilename);
-
free(archivefilename);
} else if(deletewhensent)
unlink(mailfilename);
mmj [Wed, 2 Jun 2004 19:26:35 +0000 (05:26 +1000)]
No need for several connections tuning for mlmmj-send
mmj [Wed, 2 Jun 2004 19:26:19 +0000 (05:26 +1000)]
Changelog update
mmj [Wed, 2 Jun 2004 19:16:11 +0000 (05:16 +1000)]
ChangeLog update
mmj [Wed, 2 Jun 2004 19:10:11 +0000 (05:10 +1000)]
mlmmj-maintd now resends the ones that failed. Add listctrl switch to
do aid with it in mlmmj-send.
mortenp [Wed, 2 Jun 2004 15:26:25 +0000 (01:26 +1000)]
usleep(WAITSLEEP) while waiting for child processes to die
mortenp [Wed, 2 Jun 2004 12:34:07 +0000 (22:34 +1000)]
Fixed interrupted fgets() in write_mailbody_from_file()
mmj [Wed, 2 Jun 2004 06:26:57 +0000 (16:26 +1000)]
Set MAX_CONNECTIONS to 1
mmj [Wed, 2 Jun 2004 05:24:59 +0000 (15:24 +1000)]
Also remove leftover .{mailfrom,reciptto,reply-to} files without the
corresponding mail.
mmj [Tue, 1 Jun 2004 22:57:48 +0000 (08:57 +1000)]
Fix daemonizing
mmj [Tue, 1 Jun 2004 22:49:58 +0000 (08:49 +1000)]
mlmmj-maintd testet, and works
mmj [Tue, 1 Jun 2004 22:12:46 +0000 (08:12 +1000)]
mlmmj-maintd work (still in progress)
mmj [Tue, 1 Jun 2004 22:03:06 +0000 (08:03 +1000)]
append to subscribers file and not archive before last mlmmj-send is done.
mortenp [Tue, 1 Jun 2004 20:10:14 +0000 (06:10 +1000)]
Fixed leak of subfile in mlmmj-send
mmj [Tue, 1 Jun 2004 18:48:39 +0000 (04:48 +1000)]
Better do it like this. Not pretty thought, but I doubt it can be...
mmj [Mon, 31 May 2004 18:59:28 +0000 (04:59 +1000)]
Further work on mlmmj-maintd.
NEEDS TESTING!
mmj [Mon, 31 May 2004 18:58:43 +0000 (04:58 +1000)]
get Cc: header as well
mmj [Sat, 29 May 2004 16:57:59 +0000 (02:57 +1000)]
File for telling people the emailaddress have to be in To: or Cc:
mmj [Sat, 29 May 2004 14:41:36 +0000 (00:41 +1000)]
Make sure it compiles before releasing it :-)
mmj [Sat, 29 May 2004 14:40:40 +0000 (00:40 +1000)]
Move footer and customheader to control/. I've been meaning to do this
for a long time, that's where they belong.
mmj [Sat, 29 May 2004 14:40:21 +0000 (00:40 +1000)]
Update for 0.5.2
mmj [Sat, 29 May 2004 14:30:20 +0000 (00:30 +1000)]
it's +bounces-help not -bounces+help
mmj [Sat, 29 May 2004 14:27:53 +0000 (00:27 +1000)]
Further stuff in mlmmj-maintd
mmj [Sat, 29 May 2004 13:53:55 +0000 (23:53 +1000)]
Bad wording rectified
mmj [Sat, 29 May 2004 13:53:16 +0000 (23:53 +1000)]
Use listdir/moderation for the mails up for moderation and use
moderation/queue as temporary queue for the mails to the moderators.
Send the From: info to listcontrol.
Adapt to the fact that we now get info from all headers matching token.
Remove basename use, since mybasename does not modify variable.
mmj [Sat, 29 May 2004 13:48:09 +0000 (23:48 +1000)]
Create queue/discard directory
mmj [Sat, 29 May 2004 13:47:57 +0000 (23:47 +1000)]
Update
mmj [Sat, 29 May 2004 13:46:10 +0000 (23:46 +1000)]
Use the nice new mydirname and fix a bug with the archive variable.
mmj [Sat, 29 May 2004 13:42:14 +0000 (23:42 +1000)]
Small bugfix. Don't allocate sizeof(char **) * count but
sizeof(char *) * count when allocating room for a new entry in a char **
mmj [Sat, 29 May 2004 13:40:37 +0000 (23:40 +1000)]
It's not -L 1 but -l 1 for sending single mails
mmj [Sat, 29 May 2004 13:39:39 +0000 (23:39 +1000)]
Listcontrol shouldn't open the mailfile to retrieve info we've already
retrieved in mlmmj-process. Instead we parse it on to listcontrol from
mlmmj-process.
mmj [Sat, 29 May 2004 13:36:19 +0000 (23:36 +1000)]
When retrieving header info, make sure to get all headers since we might have
e.g. several To: headers.
mmj [Sat, 29 May 2004 10:44:21 +0000 (20:44 +1000)]
Make this change to mailhdr, since we can have e.g. several To:
headers.
struct mailhdr {
const char *token;
- char *value;
+ int valuecount;
+ char **values;
};
mortenp [Thu, 27 May 2004 13:13:48 +0000 (23:13 +1000)]
added comment about the fix i committed along with the mydirname()/mybasename() patch
mortenp [Thu, 27 May 2004 13:04:29 +0000 (23:04 +1000)]
added mydirname() and mybasename() which doesn't mess with their argument, and
returns newly allocated strings
mmj [Thu, 27 May 2004 07:16:50 +0000 (17:16 +1000)]
Add -a switch for archive [yes|no]
mmj [Thu, 27 May 2004 05:44:01 +0000 (15:44 +1000)]
Use strncpy instead of memcpy
Add some free()'s
Remove some cruft
mmj [Wed, 26 May 2004 23:34:41 +0000 (09:34 +1000)]
Update to reflect recent changes
mmj [Wed, 26 May 2004 23:34:04 +0000 (09:34 +1000)]
Header file changes
mmj [Wed, 26 May 2004 23:31:31 +0000 (09:31 +1000)]
Make mlmmj-send capable of handling a bounce from the relayhost and invoke
mlmmj-bounce to handle it like any other bounce.
This is (hopefully) the last SMTP functionality we have to implement.
mmj [Wed, 26 May 2004 23:29:48 +0000 (09:29 +1000)]
-#ifdef MLMMJ_DEBUG
+#if 0
mmj [Wed, 26 May 2004 23:29:09 +0000 (09:29 +1000)]
Make checkwait_smtpreply return the string that it gets from the mailserver
in case of error. That way we can check if the relayhost is bouncing local
addresses before accepting it.
mmj [Wed, 26 May 2004 23:27:32 +0000 (09:27 +1000)]
add: int is_subbed(const char *listdir, const char *address) for use
in mlmmj-bounce
mmj [Wed, 26 May 2004 23:25:57 +0000 (09:25 +1000)]
Handle sub/unsub confirm mail bounces, and use subscribers.d/ not
subscribers.
mmj [Mon, 24 May 2004 18:34:41 +0000 (04:34 +1000)]
Mr. Boole is easy to get the wrong way. Fix so it actually works.
mmj [Sun, 23 May 2004 22:07:35 +0000 (08:07 +1000)]
Dump needed data when failing in mlmmj-send.
Add mlmmj-maintd, the mlmmj maintenance daemon
mmj [Sun, 23 May 2004 22:06:58 +0000 (08:06 +1000)]
mlmmj-maintd header file. Note the tunables are in mlmmj.h
mmj [Sun, 23 May 2004 22:06:37 +0000 (08:06 +1000)]
Add entry about mlmmj-maintd
mmj [Sat, 22 May 2004 14:36:20 +0000 (00:36 +1000)]
Also dump MAIL FROM:, RCPT TO: and Reply To: variables in the case of an
error.
Make it known by the filename that's it's a moderaterequest. That way it's
a lot easier for the maintenance process to know how to react.
mmj [Sat, 22 May 2004 13:57:12 +0000 (23:57 +1000)]
Clean up and extend help everywhere.
Remove unused code from mlmmj-bounce.
mmj [Sat, 22 May 2004 13:56:44 +0000 (23:56 +1000)]
Makefile goes into .cvsignore and update ChangeLog
mortenp [Sat, 22 May 2004 10:47:18 +0000 (20:47 +1000)]
small fix for over-sized hostnames in hostnamestr()
mmj [Fri, 21 May 2004 08:46:00 +0000 (18:46 +1000)]
Send our hostname in HELO and change the mlmmj-send output from
Connected: ok
HELO: ok
MAIL FROM: ok
RCPT TO: ok
DATA: ok 35x
Mail queued: ok
Closed connection
To:
220 panther.mmj.dk ESMTP
250 panther.mmj.dk
250 Ok
250 Ok
354 End data with <CR><LF>.<CR><LF>
250 Ok: queued as
A8DA4F2FA4
221 Bye
mmj [Fri, 21 May 2004 08:43:58 +0000 (18:43 +1000)]
char *hostnamestr(void);
mmj [Fri, 21 May 2004 08:43:42 +0000 (18:43 +1000)]
ChangeLog and VERSION update
mmj [Wed, 19 May 2004 23:23:30 +0000 (09:23 +1000)]
Create and mention listdir/requeue
mmj [Wed, 19 May 2004 23:19:02 +0000 (09:19 +1000)]
Add requeueing
mmj [Wed, 19 May 2004 23:18:50 +0000 (09:18 +1000)]
Send listdir along
mmj [Wed, 19 May 2004 23:18:36 +0000 (09:18 +1000)]
ChangeLog has a requeuing mechanism entry and TODO has gotten smaller :)
mmj [Wed, 19 May 2004 23:15:46 +0000 (09:15 +1000)]
0.5.1 README
mmj [Wed, 19 May 2004 23:15:23 +0000 (09:15 +1000)]
.cvsignore updates
mortenp [Wed, 19 May 2004 13:23:17 +0000 (23:23 +1000)]
explained closedlist
mmj [Wed, 19 May 2004 13:04:41 +0000 (23:04 +1000)]
+0.5.1
+ o Add a file TUNABLES which documents the ways to tune mlmmj lists.
+ o Add support for Subject: prefix
mmj [Wed, 19 May 2004 10:43:12 +0000 (20:43 +1000)]
if(infile == NULL) return NULL;
mmj [Wed, 19 May 2004 09:28:37 +0000 (19:28 +1000)]
File for generating bounce probes.
mmj [Tue, 18 May 2004 17:17:12 +0000 (03:17 +1000)]
A better TODO
mortenp [Tue, 18 May 2004 17:02:20 +0000 (03:02 +1000)]
added comment about why the rename() call is safe
mortenp [Tue, 18 May 2004 15:25:36 +0000 (01:25 +1000)]
Added WAITTIME (time to sleep before checking if we should spawn another mlmmj-send process) option in mlmmj.h
mortenp [Tue, 18 May 2004 14:40:17 +0000 (00:40 +1000)]
added comment about my fix
mortenp [Tue, 18 May 2004 14:37:01 +0000 (00:37 +1000)]
bail out if we can not open subscribers.d/
mortenp [Mon, 17 May 2004 22:02:34 +0000 (08:02 +1000)]
mlmmj-{,un}sub have been brought up to speed in a coordinated effort
mortenp [Mon, 17 May 2004 21:34:07 +0000 (07:34 +1000)]
removal of crufty crappy Makefile.in
mortenp [Wed, 12 May 2004 12:06:52 +0000 (22:06 +1000)]
fixed spawn count
mmj [Tue, 11 May 2004 23:36:35 +0000 (09:36 +1000)]
mlmmj-make-ml.sh now creates subscribers.d as well
mmj [Tue, 11 May 2004 23:08:04 +0000 (09:08 +1000)]
mlmmj-send now forks multiple connections per subscriber.d/file
mortenp [Tue, 11 May 2004 20:24:56 +0000 (06:24 +1000)]
added check for slash in list control string
mortenp [Tue, 11 May 2004 19:52:00 +0000 (05:52 +1000)]
added comment about listcontrol() cleanup
mortenp [Tue, 11 May 2004 19:50:28 +0000 (05:50 +1000)]
changed to be a big switch instead of a lot of if-else-if
mortenp [Tue, 11 May 2004 19:49:32 +0000 (05:49 +1000)]
removed (unused) BINDIR
added MY_ASSERT macro
mortenp [Tue, 11 May 2004 15:50:04 +0000 (01:50 +1000)]
changed incindexfile() - removed incflag, changed error return to be 0, and it now saves last used index in the file
mmj [Mon, 10 May 2004 12:22:21 +0000 (22:22 +1000)]
Assorted fixes
mmj [Sun, 9 May 2004 11:48:05 +0000 (21:48 +1000)]
fix from Christoph Thiel
mmj [Sat, 1 May 2004 09:54:58 +0000 (19:54 +1000)]
Bouncehandling, and massive cleanups around.
mmj [Fri, 30 Apr 2004 09:02:13 +0000 (19:02 +1000)]
Bad bad mmj. Always make sure it compiles before checkin.
mmj [Fri, 30 Apr 2004 08:58:08 +0000 (18:58 +1000)]
This is new function to quickly stat a control of the list. Example:
int moderatedlist = statctrl(listdir, "moderated);
Then it'll return true/false according to whether a file
listdir/control/moderated exists.
Add statctrl call to listcontrol for closedlist. The other functions I've
touched are only cleaning a bit.
mmj [Fri, 30 Apr 2004 08:57:33 +0000 (18:57 +1000)]
This is new function to quickly stat a control of the list. Example:
int moderatedlist = statctrl(listdir, "moderated);
Then it'll return true/false according to whether a file
listdir/control/moderated exists.
mmj [Fri, 30 Apr 2004 08:56:35 +0000 (18:56 +1000)]
Add the new directories to the README. It's listdir/control, listdir/moderation
and listdir/moderation/queue
mortenp [Fri, 30 Apr 2004 07:20:01 +0000 (17:20 +1000)]
added -F (no fork) option
mortenp [Wed, 28 Apr 2004 12:12:16 +0000 (22:12 +1000)]
prepare 0.3.4 release
mortenp [Wed, 28 Apr 2004 11:59:54 +0000 (21:59 +1000)]
added comment about dot-fix
mortenp [Wed, 28 Apr 2004 11:58:00 +0000 (21:58 +1000)]
fixed smtp handling of lines which start with a dot