]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Able to scan emlrcvr parameters (prto:ipnum:port:iteration)
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Tue, 11 Mar 2025 13:54:46 +0000 (09:54 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Tue, 11 Mar 2025 13:54:46 +0000 (09:54 -0400)
lib/modrec.c

index 5ed2c044263899b4a2c50892a7c5200f11625104..43a805777eae7d8450c8cd04dc15ffc773027ef5 100644 (file)
@@ -45,20 +45,51 @@ static  _Bool modopen;          //boolean module open/close
 static int prepbinding(SOCPTR ***bindings,int argc,char *argv[])
 
 {
+#define OPEP    "moderec.c:prepbinding"
+
 *bindings=(SOCPTR **)0;
 for (int i=0;i<argc;i++) {
   int iteration;
   PROTYP proto;
   char *ipnum;
   char *port;
+  char *ptr;
 
   iteration=1;
   proto=pro_smtp; 
   ipnum=DFLTIP;
   port=SMTPORT;
+  ptr=argv[i];
+  (void) rou_alert(0,"JMPDBG argv[%d]=<%s>",i,ptr);
+  for (int j=0;j<3;j++) {
+    char *sofar;
+
+    if ((sofar=strchr(ptr,':'))==(char *)0) 
+      break;
+    *sofar='\000';
+    sofar++;
+    switch (j) {
+      case 0    :
+        break;
+      case 1    :
+        ipnum=ptr;
+        break;
+      case 2    :
+        if (strlen(ptr)>0) 
+          port=ptr;
+        if (strlen(sofar)>0) 
+          iteration=atoi(sofar);
+        break;
+      default   :
+        (void) rou_alert(0,"%s, Code fault, '%d' unexpected value",OPEP,j);
+        break;
+      }
+    ptr=sofar;
+    }
   *bindings=soc_mkbindinf(*bindings,proto,ipnum,port,iteration);
   }
 return rou_nbrlist(*bindings);
+#undef  OPEP
 }
 /*
 \f
@@ -269,9 +300,9 @@ while (proceed==true) {
         (void) rou_alert(0,"%s, No listening IP found (config?)",OPEP);
         phase=999;
         }
+      childs=(pid_t *)calloc(nbrbind,sizeof(pid_t));
       break;
     case 1      :       //Opening ALL channels
-      childs=(pid_t *)calloc(nbrbind,sizeof(pid_t));
       for (int i=0;i<nbrbind;i++) {
         (void) prc_nozombie();
         if (childs[i]==(pid_t)0)