]> SAFE projects GIT repository - jmp/mailleur/commitdiff
The binding/local IP concept seems to be sound
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Sat, 21 Jun 2025 18:55:18 +0000 (14:55 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Sat, 21 Jun 2025 18:55:18 +0000 (14:55 -0400)
conf/mailleur.conf.dvl
lib/modrec.c

index 7e674d0be5b2ce762ef27c589ca59bd80701dc6d..d5d7b7dab4d9cbedd26f4160d5517c7a87956e93 100644 (file)
@@ -14,7 +14,7 @@ DFLTDOMAIN="example.com""
 #:ipnum:::             -> smtp:ipnum:25:2
 #::,smtps::465:2       -> smtp:0.0.0.0:25:2 + smtps::465:2
 #::                    -> smtp:0.0.0.0:25:2
-SMTPPORTS="::1025"
+#SMTPPORTS="::1025"
 #SMTPPORTS=":127.127.10.25:1025:,smtps:127.127.10.25:1026:1"
 #SMTPPORTS=":127.127.10.25:1025:"
 #SMTPPORTS="smtps:127.127.10.25:1065:1"
index 2be48bea1df17e47b1fca362dc5e7c7a210707fd..e4354f711fadadf0034cbd6f35981dc53ec080e6 100644 (file)
@@ -45,6 +45,7 @@ static int prepbinding(SOCPTR ***bindings,int argc,char *argv[])
 
 {
 #define OPEP    "moderec.c:prepbinding"
+#define DIP     "0.0.0.0"
 
 *bindings=(SOCPTR **)0;
 for (int i=0;i<argc;i++) {
@@ -59,7 +60,7 @@ for (int i=0;i<argc;i++) {
   ptr=config;
   iteration=1;
   proto=pro_smtp; 
-  ipnum=DFLTIP;
+  ipnum=DIP;
   port=SMTPORT;
   (void) rou_alert(0,"JMPDBG argv[%d]=<%s>",i,argv[i]);
   for (int j=0;j<3;j++) {
@@ -78,7 +79,8 @@ for (int i=0;i<argc;i++) {
           }
         break;
       case 1    :
-        ipnum=ptr;
+        if (strlen(ptr)>0)
+          ipnum=ptr;
         break;
       case 2    :
         if (strlen(ptr)>0) 
@@ -96,6 +98,7 @@ for (int i=0;i<argc;i++) {
   }
 return rou_nbrlist(*bindings);
 
+#undef  DIP
 #undef  OPEP
 }
 /*
@@ -317,6 +320,7 @@ PUBLIC void rec_handlesmtp(int argc,char *argv[])
 #define RELAX   5       //Relax time between process checking
 
 pid_t *childs;
+char *locargv[2];
 int nbrbind;
 _Bool allbusy;
 SOCPTR **bindings;
@@ -324,6 +328,14 @@ int phase;
 _Bool proceed;
 
 childs=(pid_t)0;
+(void) memset(locargv,'\000',sizeof(locargv));
+locargv[0]=getenv("SMTPPORTS");
+if (locargv[0]==(char *)0) 
+  locargv[0]="smtp:0.0.0.0:1025:2"; //default configuration
+if (argc==0) {
+   argc=1;
+   argv=locargv;
+   }
 nbrbind=0;
 allbusy=false;
 bindings=(SOCPTR **)0;