From: Jean-Marc Pigeon (Delson) Date: Sat, 10 Aug 2024 00:38:23 +0000 (-0400) Subject: Code seems clean, need to do memory leak detection X-Git-Tag: tag-0.4 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=ef285f1d14d129d39c38c057ca51b94e81b58758;p=jmp%2Fmailleur Code seems clean, need to do memory leak detection --- diff --git a/lib/devsoc.c b/lib/devsoc.c index 5c230d7..573eff5 100644 --- a/lib/devsoc.c +++ b/lib/devsoc.c @@ -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 (;countcarin=0; @@ -77,7 +77,6 @@ for (;countcarin==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); diff --git a/lib/gestcp.c b/lib/gestcp.c index bcd7cb5..65d692b 100644 --- a/lib/gestcp.c +++ b/lib/gestcp.c @@ -156,7 +156,6 @@ if (contact!=(CONTYP *)0) { } #undef FMT #undef OPEP -(void) printf("JMP signon sent='%d'",sent); return sent; } /* diff --git a/lib/lvleml.c b/lib/lvleml.c index 14c86ef..cea9470 100644 --- a/lib/lvleml.c +++ b/lib/lvleml.c @@ -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 diff --git a/lib/subrou.c b/lib/subrou.c index fece781..67ce4d4 100644 --- a/lib/subrou.c +++ b/lib/subrou.c @@ -20,7 +20,7 @@ //version definition #define VERSION "0.3" -#define RELEASE "41" +#define RELEASE "42" //Public variables PUBLIC int debug=0; //debug level diff --git a/lib/unitls.c b/lib/unitls.c index bf9d9b6..e1742fd 100644 --- a/lib/unitls.c +++ b/lib/unitls.c @@ -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 :