]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Extracting the blacklister list is working fine
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Sun, 13 Jul 2025 13:21:06 +0000 (09:21 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Sun, 13 Jul 2025 13:21:06 +0000 (09:21 -0400)
Makefile
app/scarmt.c
conf/mailleur.conf
conf/mailleur.conf.dvl

index e1519b70847d8ab851e147ada37129dcf2352b25..ddb31a797210a7e1200236186a2e16ee791d7c76 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -187,6 +187,7 @@ tstspf      :  clean debug
 newtest        :  deltest
           @ mkdir -p $(TESTDIR)/var/run
           @ mkdir -p $(TESTDIR)/$(SBINDIR)
+          @ mkdir -p $(TESTDIR)/etc/$(APPNAME)
           @ mkdir -p $(TESTDIR)/usr/share/$(APPNAME)
           @ mkdir -p $(TESTDIR)/var/spool/$(APPNAME)/queue
           @ mkdir -p $(TESTDIR)/var/spool/$(APPNAME)/mails
@@ -194,6 +195,9 @@ newtest     :  deltest
           @ cp -a                                      \
                bin/*                                   \
                $(TESTDIR)/$(SBINDIR)
+          @ cp -a                                      \
+               conf/*                                  \
+               $(TESTDIR)/etc/$(APPNAME)
           @ cp -a                                      \
                sql                                     \
                $(TESTDIR)/usr/share/$(APPNAME)/
index 5aa3ad59fca63eb3c82fd00b9d5a566787527ace..f419d06396718d32d9c6b9b04410417a33f0deb9 100644 (file)
@@ -9,7 +9,9 @@
 /*                                                     */
 /********************************************************/
 #include        <dirent.h>
+#include        <errno.h>
 #include        <stdlib.h>
+#include        <string.h>
 #include        <syslog.h>
 #include        <unistd.h>
 
@@ -35,14 +37,16 @@ static char **load_dnsbls()
 {
 #define OPEP    "scarmt.c:load_dnsbls,"
 
-const char *blcklist="XBLACKLIST";
+const char *blcklist="BLACKLISTER";
 
 char **dnsbls;
+FILE *blkfile;
 const char *filename;
 int phase;
 _Bool proceed;
 
 dnsbls=(char **)0;
+blkfile=(FILE *)0;
 phase=0;
 proceed=true;
 while (proceed==true) {
@@ -54,6 +58,44 @@ while (proceed==true) {
         phase=999;      //no need to go further
         } 
       break;
+    case 1      :       //opening the file
+      if (filename!=(char *)0) {        //always
+        char *fullpath;
+
+        fullpath=rou_apppath(filename);
+        if ((blkfile=fopen(fullpath,"r"))==(FILE *)0) {
+          (void) rou_alert(0,"%s Unable to open file <%s> (error=<%s>)",
+                            OPEP,fullpath,strerror(errno));
+          phase=999;    //trouble trouble
+          }
+        fullpath=rou_freestr(fullpath);
+        }
+      break;
+    case 2      :       //scaning file
+      if (blkfile!=(FILE *)0) {         //always
+        char line[200];
+
+        while (fgets(line,sizeof(line)-1,blkfile)!=(char *)0) {
+          char *ptr;
+          int taille;
+
+          if ((ptr=strchr(line,'#'))!=(char *)0) 
+            *ptr='\000';
+          taille=strlen(line);
+          while (taille>0) {
+            taille--;
+            ptr=line+taille;
+            if ((*ptr!=' ')&&(*ptr!='\t'))
+              break;
+            *ptr='\000'; 
+            }
+          if (strlen(line)>0) {
+            dnsbls=(char **)rou_addlist((void **)dnsbls,(void *)strdup(line)); 
+            }
+          }
+        (void) fclose(blkfile);
+        }
+      break;
     default     :       //SAFE Guard
       proceed=false;
       break;
index c5e6a333d7575f86d0b9a1463351e439a0a51e1b..73a179a4d98667b72959d47119d5df970b8bf365 100644 (file)
@@ -51,4 +51,6 @@ DB_LANG="UTF-8"
 #Dovecot storage directory
 DOV_MAILDIR="/var/spool/mailleur/mails"
 #------------------------------------------------
-BLACKLIST=/etc/mailleur/blacklister.conf
+#The list of public blacklist serveur
+BLACKLISTER=/etc/mailleur/blacklister.conf
+#------------------------------------------------
index 8363d408844cbf2a0305665375bff8e15a7dc494..bdd0ffb30a6c554b0973490b5251ce0315019e4d 100644 (file)
@@ -55,4 +55,6 @@ DOV_MAILDIR="/var/spool/mailleur/mails"
 #------------------------------------------------
 SMTPPORTS="|127.127.10.25|1025|5,smtps|127.127.10.26|1465|3,smtp|127.127.10.26|1587|2"
 #------------------------------------------------
-BLACKLIST=/home/jmp/safe-mailleur/mailleur/conf/blacklister.conf
+#The list of public blacklist serveur
+BLACKLISTER=/etc/mailleur/blacklister.conf
+#------------------------------------------------