]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Code seems clean, need to do memory leak detection tag-0.4
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Sat, 10 Aug 2024 00:38:23 +0000 (20:38 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Sat, 10 Aug 2024 00:38:23 +0000 (20:38 -0400)
lib/devsoc.c
lib/gestcp.c
lib/lvleml.c
lib/subrou.c
lib/unitls.c

index 5c230d7832df5c4a09f01617b4b56520ee7fe84a..573eff57f9afac10bbe4430044b0fc70e42be9a7 100644 (file)
@@ -68,7 +68,7 @@ static void socpurge(SOCTYP *soc,const char *peerip)
 int max;
 int count;
 
-max=1000;       //purgin for one seconde max;
+max=1000;       //purging for 1 seconde max;
 count=0;
 for (;count<max;count++) {
   soc->carin=0;
@@ -77,7 +77,6 @@ for (;count<max;count++) {
   (void) soc_receive(soc);
   if (soc->carin==0)    //got no character
     break;
-  (void) rou_alert(0,"JMPDBG reading soc count='%d' carin='%d'",count,soc->carin);
   }
 if (count>=max) //one second max!
   (void) rou_alert(0,"%s purge is too long with peer [%s]",OPEP,peerip);
index bcd7cb526dce2e656b2811e54c0e0999c25831eb..65d692b78d0a43fcd4a45ea284c5a5cdd486f59c 100644 (file)
@@ -156,7 +156,6 @@ if (contact!=(CONTYP *)0) {
   }
 #undef  FMT
 #undef  OPEP
-(void) printf("JMP signon sent='%d'",sent);
 return sent;
 }
 /*
index 14c86ef25bc7da9edb1b19b24e50993fb1a6c7c9..cea9470c5bd44183559f075442c3d567b2aa6f94 100644 (file)
@@ -49,8 +49,8 @@ static _Bool doehlo(CONTYP *contact,char *line)
 
 {
 static char *ehlostr[]= {
-        "-8BITMIME",
         "-STARTTLS",
+        "-8BITMIME",
         "-ENHANCEDSTATUSCODES",
         "-AUTH PLAIN LOGIN",
         " HELP",
@@ -62,10 +62,13 @@ static char *ehlostr[]= {
 
 _Bool done;
 char *fqdn;
+int strstart;
 int phase;
 _Bool proceed;
 
 done=false;
+fqdn=(char *)0;
+strstart=0;
 phase=0;
 proceed=true;
 while (proceed==true) {
@@ -87,7 +90,9 @@ while (proceed==true) {
       (void) transmit(contact,"%d-%s ready, your IP=[%s]",
                               CMDOK,contact->locname,contact->peerip);
       (void) transmit(contact,"%d-SIZE %ld",CMDOK,MXMSIZE);
-      for (int i=0;ehlostr[i]!=(char *)0;i++) {
+      if (contact->tlsok==true)
+        strstart++;
+      for (int i=strstart;ehlostr[i]!=(char *)0;i++) {
         (void) transmit(contact,"%d%s",CMDOK,ehlostr[i]);
         }
       done=true;
@@ -132,7 +137,6 @@ while (proceed==true) {
   status=tcp_getline(contact,&attend,&line);
   if (status<=0)        //timeout or trouble?
     break;              //no need to go further
-  (void) printf("JMPDBG getline got <%s>\n",line);
   switch (eml_getcode(line)) {
     case c_ehlo         :       //EHLO SMTP protocol
       proceed=doehlo(contact,line);
@@ -144,6 +148,7 @@ while (proceed==true) {
     case c_starttls     :       //EHLO start encryptel link
       switch (soc_starttls(contact->socptr,contact->peerip)) {
         case true       :       //link now in TLS crypted mode
+          contact->tlsok=true;
           (void) tcp_signon(contact);
           break;
         case false      :       //unable to establish link
index fece781bc5cedefe1213dd868a505e3d5853796e..67ce4d462628179c5495e5fc4b377f999bbed54e 100644 (file)
@@ -20,7 +20,7 @@
 
 //version definition 
 #define VERSION "0.3"
-#define RELEASE "41"
+#define RELEASE "42"
 
 //Public variables
 PUBLIC  int debug=0;            //debug level
index bf9d9b696cdbc74f9d8309eddbf7dbae4f2ffd1b..e1742fd046f0959c44e04a3ed401efcf03a1cfc5 100644 (file)
@@ -79,7 +79,6 @@ if (sslerror<=0) {
       if (tls->ssl==(SSL *)0)    //in case of trouble
         (void) rou_core_dump("%s Unexpected NULL SSL (Bug?)",OPEP);
       code=SSL_get_error(tls->ssl,sslerror);
-      (void) rou_alert(0,"JMPDBG err code='%d'",code);
       switch (code) {
         case SSL_ERROR_ZERO_RETURN      :
           detail="zero return";
@@ -376,7 +375,6 @@ if (server==true)
 phase=0;
 proceed=true;
 while (proceed==true) {
-  (void) printf("JMPDBG opentls phase='%d' handle=%d\n",phase,handle);
   switch (phase) {
     case 0      :       //prepare the structure first;
       tls=(TLSTYP *)calloc(1,sizeof(TLSTYP));
@@ -489,20 +487,17 @@ if (tls!=(TLSTYP *)0) {
   int sofar;
 
   proceed=true;
-  (void) printf("JMPDBG sending <%s>\n",buffer);
   while (proceed==true) {
     int status;
 
     status=0;
     proceed=false;
     sofar=SSL_write(tls->ssl,buffer,tosend);
-    (void) printf("JMPDBG sent sofar='%d'\n",sofar);
     switch (sofar) {
       case -1     :       //trouble to write
         switch (status=SSL_get_error(tls->ssl,-1)) {
           case SSL_ERROR_WANT_READ        :     //
           case SSL_ERROR_WANT_WRITE       :     //"Wanted" error
-            (void) printf("JMPDBG SSL_get_error='%d'\n",status);
             (void) usleep(1000);
             proceed=true;
             break;
@@ -562,13 +557,11 @@ if (tls!=(TLSTYP *)0) {
 
   status=0;
   got=SSL_read(tls->ssl,buffer,maxread);
-  (void) printf("JMPDBG read got='%d'\n",got);
   switch (got) {
     case -1     :       //trouble to write
       switch (status=SSL_get_error(tls->ssl,-1)) {
         case SSL_ERROR_WANT_READ        :     //"wanted" error
         case SSL_ERROR_WANT_WRITE       :     //
-          (void) printf("JMPDBG SSL_get_error='%d'\n",status);
           (void) usleep(1000);
           break;
         default                         :