From: mmj Date: Tue, 1 Jun 2004 22:12:46 +0000 (+1000) Subject: mlmmj-maintd work (still in progress) X-Git-Tag: RELEASE_1_0_0~189 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3379127c968ff990062d319db6fae20db3dbb1dc;p=thirdparty%2Fmlmmj.git mlmmj-maintd work (still in progress) --- diff --git a/src/Makefile.am b/src/Makefile.am index 0ac97f9a..2b0c1275 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -41,4 +41,4 @@ mlmmj_bounce_SOURCES = mlmmj-bounce.c print-version.c log_error.c \ subscriberfuncs.c strgen.c random-int.c writen.c mlmmj_maintd_SOURCES = mlmmj-maintd.c print-version.c log_error.c mygetline.c \ - strgen.c random-int.c + strgen.c random-int.c chomp.c diff --git a/src/mlmmj-maintd.c b/src/mlmmj-maintd.c index 0cc610de..99c24948 100644 --- a/src/mlmmj-maintd.c +++ b/src/mlmmj-maintd.c @@ -18,6 +18,7 @@ #include "mlmmj-maintd.h" #include "mlmmj.h" #include "strgen.h" +#include "chomp.h" #include "log_error.h" #include "mygetline.h" @@ -115,10 +116,8 @@ int resend_queue(const char *listdir, const char *mlmmjsend) char *discardedname = NULL; char *dirname = concatstr(2, listdir, "/queue/"); FILE *ffrom, *fto, *f; - size_t len; pid_t pid; struct stat st; - time_t t; int discarded = 0; if(chdir(dirname) < 0) { @@ -133,7 +132,7 @@ int resend_queue(const char *listdir, const char *mlmmjsend) } while((dp = readdir(queuedir)) != NULL) { - if(strchr(dp->d_name, ".")) + if(strchr(dp->d_name, '.')) continue; if(stat(dp->d_name, &st) < 0) { log_error(LOG_ARGS, "Could not stat(%s)",dp->d_name); @@ -157,6 +156,7 @@ int resend_queue(const char *listdir, const char *mlmmjsend) } else { log_error(LOG_ARGS, "Could not stat(%s)", dp->d_name); + } } toname = concatstr(2, mailname, ".reciptto"); @@ -168,6 +168,9 @@ int resend_queue(const char *listdir, const char *mlmmjsend) discarded = discardmail(mailname, discardedname, 3600); + } else { + log_error(LOG_ARGS, "Could not stat(%s)", + dp->d_name); } } @@ -192,10 +195,12 @@ int resend_queue(const char *listdir, const char *mlmmjsend) } from = myfgetline(ffrom); + chomp(from); fclose(ffrom); unlink(fromname); free(fromname); to = myfgetline(fto); + chomp(to); fclose(fto); unlink(toname); free(toname); @@ -205,6 +210,7 @@ int resend_queue(const char *listdir, const char *mlmmjsend) repto = NULL; } else { repto = myfgetline(f); + chomp(repto); fclose(f); unlink(reptoname); free(reptoname); @@ -213,7 +219,10 @@ int resend_queue(const char *listdir, const char *mlmmjsend) pid = fork(); if(pid == 0) { - if(repto) + if(repto) { + printf("%s -l %s -m %s -F %s -T %s -R %s -a\n", + mlmmjsend, "1", mailname, from, + to, repto); execlp(mlmmjsend, mlmmjsend, "-l", "1", "-m", mailname, @@ -221,14 +230,18 @@ int resend_queue(const char *listdir, const char *mlmmjsend) "-T", to, "-R", repto, "-a", 0); - else + } else { + printf("%s -l %s -m %s -F %s -T %s -a\n", + mlmmjsend, "1", mailname, from, to); execlp(mlmmjsend, mlmmjsend, "-l", "1", "-m", mailname, "-F", from, "-T", to, "-a", 0); + } } + } return 0; }