Náhrada za sendmail
Marian Jančár
mjanx123 na milada.troja.mff.cuni.cz
Sobota Leden 15 18:27:00 CET 2000
"Jiří Mlíka" wrote:
>
> Dobrý den
>
> Poraďte mi prosím náhradu za sendmail. Něco lehce konfigurovatelného.
> Potřebuji to použít na domácí síti. Chtěl bych aby mi to dělalo frontu mailů
> odesílaných do internetu, kterou bych při připojení mohl poslat dál.
> Zkoušel jsem OfflineMailer, ale ten mi dělal divné věci, nefungovala
> lokální pošta na mašině ani v síti. Všechno se snažil posílat ven.
>
> Jiří Mlíka
Právě jsem vyřešil problém s offlinemailerem a zasílám patch oproti
verzi 0.45. Chyba byla v parsování těch printf-like konfiguračních
stringů. Taky jsem přidal pár includů, aby byl kompilátor zticha.
diff -urNd mailer-0.45/Makefile mailer-0.45.my/Makefile
--- mailer-0.45/Makefile Mon Oct 11 20:21:43 1999
+++ mailer-0.45.my/Makefile Sat Jan 15 17:42:08 2000
@@ -10,7 +10,7 @@
CC=gcc
# linker configuration
-LDFLAGS=
+LDFLAGS=-s
LD=gcc
# strip
diff -urNd mailer-0.45/getconf/getconf.c mailer-0.45.my/getconf/getconf.c
--- mailer-0.45/getconf/getconf.c Fri Sep 24 21:37:49 1999
+++ mailer-0.45.my/getconf/getconf.c Sat Jan 15 16:32:18 2000
@@ -27,6 +27,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
+#include <string.h>
#include <errno.h>
#include "getconf.h"
diff -urNd mailer-0.45/lib.c mailer-0.45.my/lib.c
--- mailer-0.45/lib.c Sun Oct 10 18:11:20 1999
+++ mailer-0.45.my/lib.c Sat Jan 15 16:35:22 2000
@@ -39,7 +39,7 @@
*/
char *xgetline(char *s, int size, FILE *stream)
{
- register c;
+ register int c;
register char *cs;
cs=s;
diff -urNd mailer-0.45/parser.c mailer-0.45.my/parser.c
--- mailer-0.45/parser.c Mon Oct 11 20:58:47 1999
+++ mailer-0.45.my/parser.c Sat Jan 15 17:27:12 2000
@@ -38,7 +38,11 @@
*/
static void stradd(char *s, const char *add)
{
- snprintf(s,MAX_LINE_LEN+1,"%s%s",s,add);
+ char *tmp;
+
+ tmp = strdup(s);
+ snprintf(s,MAX_LINE_LEN+1,"%s%s",tmp,add);
+ free(tmp);
}
/***
@@ -47,7 +51,11 @@
*/
static void strcadd(char *s, char add)
{
- snprintf(s,MAX_LINE_LEN+1,"%s%c",s,add);
+ char *tmp;
+
+ tmp = strdup(s);
+ snprintf(s,MAX_LINE_LEN+1,"%s%c",tmp,add);
+ free(tmp);
}
static char *nodename=NULL;
@@ -185,8 +193,8 @@
need_active=FALSE;
get_username=FALSE;
get_domainname=FALSE;
-
- switch (*++p) {
+ p++;
+ switch (*p) {
case 'i':
stradd(s,mail->message_id);
break;
diff -urNd mailer-0.45/queue.c mailer-0.45.my/queue.c
--- mailer-0.45/queue.c Mon Oct 11 20:46:28 1999
+++ mailer-0.45.my/queue.c Sat Jan 15 16:46:13 2000
@@ -20,6 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
+#include <string.h>
#include <unistd.h>
#include <dirent.h>
@@ -37,7 +38,8 @@
* mail_select
* Selection routine for scandir().
*/
-static int mail_select(struct dirent *d)
+//static int mail_select(struct dirent *d)
+static int mail_select(const struct dirent *d)
{
if ((strstr(d->d_name,"mail.")==d->d_name)
&& (*(d->d_name+strlen(d->d_name)-1)!='~')) {
@@ -65,7 +67,7 @@
l=strlen(conf.queue_path)+32;
filename=stralloc(l);
- n=scandir(dir,&namelist,mail_select,NULL);
+ n=scandir(dir, &namelist, mail_select, NULL);
while (n>0) {
if (handler!=NULL) {
id=strchr(namelist[n-1]->d_name,'.')+1;
diff -urNd mailer-0.45/sndmail.c mailer-0.45.my/sndmail.c
--- mailer-0.45/sndmail.c Sun Oct 17 00:40:34 1999
+++ mailer-0.45.my/sndmail.c Sat Jan 15 16:34:16 2000
@@ -20,6 +20,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/types.h>
+#include <sys/socket.h>
#include <unistd.h>
#include <pwd.h>
--
Marian Jancar <mjanx123 na milada.troja.mff.cuni.cz>
Další informace o konferenci Linux