From: Jean-Marc Pigeon (Delson) Date: Fri, 20 Jun 2025 05:28:34 +0000 (-0400) Subject: feed00 and feed01 working fine X-Git-Tag: tag-0.9~70 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=8d32ce853a40b3202109fd2f33b465e18839016f;p=jmp%2Fmailleur feed00 and feed01 working fine --- diff --git a/app/feeder.c b/app/feeder.c index 625a693..20aa44f 100644 --- a/app/feeder.c +++ b/app/feeder.c @@ -91,6 +91,23 @@ static void report(int numline,char *line,char *trouble) */ /************************************************/ /* */ +/* Send transmission out */ +/* */ +/************************************************/ +static int sendout(SOCPTR *socptr,char *line) + +{ +int taille; + +taille=tcp_write(socptr,line); +taille+=tcp_write(socptr,CRLF); +return taille; +} +/* +^L +*/ +/************************************************/ +/* */ /* procedure to set feed scan in comment */ /* mode. */ /* */ @@ -144,7 +161,7 @@ while (proceed==true) { //(void) rou_alert(0,"%s JMPDBG phase='%d'",OPEP,phase); switch (phase) { case 0 : //Transmit "DATA" to remote - if (tcp_write(fd->socptr,action)!=(strlen(action)+2)) + if (sendout(fd->socptr,action)!=(strlen(action)+2)) phase=999; //Unable to send STARTTLS sequence break; case 1 : //Get DATA command status @@ -178,13 +195,13 @@ while (proceed==true) { if (data[2]=='.') { (void) memmove(data+3,data+2,strlen(data+2)); } - (void) tcp_write(fd->socptr,data+2); + (void) sendout(fd->socptr,data+2); break; case 'C' : //data marker switch (data[2]) { case '.' : //end of data marker if (numdata>1) //could be empty data - (void) tcp_write(fd->socptr,"."); + (void) sendout(fd->socptr,"."); completed=true; break; case 'T' : //timer data @@ -193,7 +210,7 @@ while (proceed==true) { isnow=time((time_t *)0); (void) snprintf(ed,sizeof(ed),"Date: %s",rou_ascsysstamp(isnow)); - (void) tcp_write(fd->socptr,ed); + (void) sendout(fd->socptr,ed); break; default : //unexpected data marker (void) rou_alert(0,"%s Unexpected data marker <%s> (Bug?)", @@ -232,6 +249,7 @@ return status; static _Bool gomodetls(SOCPTR *socptr) { +#define OPEP "feeder.c:gomodetls," _Bool status; char *got; @@ -245,9 +263,10 @@ action="starttls"; phase=0; proceed=true; while (proceed==true) { + //(void) rou_alert(0,"%s JMPDBG phase='%d' status='%d'",OPEP,phase,status); switch (phase) { case 0 : //Sending START TLS command - if (tcp_write(socptr,action)!=(strlen(action)+2)) + if (sendout(socptr,action)!=(strlen(action)+2)) phase=999; //Unable to send STARTTLS sequence break; case 1 : //Get STARTTLS command status @@ -279,6 +298,8 @@ while (proceed==true) { phase++; } return status; + +#undef OPEP } /* ^L @@ -550,8 +571,7 @@ while (proceed==true) { status=doincoming(fd->socptr,*numline,line); break; case 'S' : //sending data - (void) tcp_write(fd->socptr,line); - (void) tcp_write(fd->socptr,CRLF); + (void) sendout(fd->socptr,line); break; case 'T' : //Get the test titre status=strncpy(testname,line,sizeof(testname)); diff --git a/data-feed/feed01.tst b/data-feed/feed01.tst index 641be08..4e617f8 100644 --- a/data-feed/feed01.tst +++ b/data-feed/feed01.tst @@ -2,17 +2,28 @@ T:(feed01) Sending a a simple mail to remote server R:220 mailleur.example.com, ESMTP (cleartext) mailleur... #==================================================== -S:HELO example.com +S:EHLO example.com #R:250-mailleur.example.com, link (cleartext) ready, your IP/FQDN=[127.127.0.2/feed2.example.com] -R:250 mailleur.example.com, link (cleartext) ready,... +R:250-mailleur.example.com, link (cleartext) ready,... +R:250-SIZE 52428800 +R:250-STARTTLS +R:250-8BITMIME +R:250-ENHANCEDSTATUSCODES +R:250 AUTH PLAIN LOGIN C:GOTLS -R:250 Link now encryp... +C:WAIT 1 +S:EHLO example.com +R:250-mailleur.example.com, link (crypted) ready,... +R:250-SIZE 52428800 +R:250-8BITMIME +R:250-ENHANCEDSTATUSCODES +R:250 AUTH PLAIN LOGIN S:MAIL FROM: R:250 2.1.3 postmaster@example.com.. sender ok S:RCPT TO: -R:250 2.6.4 Address accepted +R:250 2.6.4 Address accepted S:RCPT TO: -R:250 2.6.4 Address accepted +R:250 2.6.4 Address accepted #------------------------------------------------------------------------- #-sending data C:DATA 354 3.5.0 End data with . @@ -34,6 +45,8 @@ D:end D:ligne court| C:. #------------------------------------------------------------------------- -R:250 3.5.3 Message accepted for delivery (Session... +R:250-3.5.3 Session ID=<... +R:250-3.5.3 data stream received:... +R:250 3.5.3 Message accepted for delivery S:QUIT R:221 2.0.0 Bye, closing connection... diff --git a/lib/lvleml.c b/lib/lvleml.c index e157774..5b0227c 100644 --- a/lib/lvleml.c +++ b/lib/lvleml.c @@ -138,7 +138,6 @@ if (rou_vasprintf(&line,fmt,args)>0) { contact->transout=tcp_addline(contact->transout,line); } if (flush==true) { - (void) rou_alert(0,"JMPDBG trans=<%s>",contact->transout); (void) tcp_write(contact->socptr,contact->transout); contact->transout=rou_freestr(contact->transout); } @@ -543,10 +542,12 @@ while (proceed==true) { total+=1023; total/=1024; //KBytes delta=rou_getdifftime(&start); - fmt="%d 3.5.3 Message accepted for delivery (Session ID=<%s>)"; + fmt="%d-3.5.3 Session ID=<%s>"; + (void) transmit(contact,false,fmt,CMDOK,contact->cursesid); + fmt="%d-3.5.3 data stream received: %d Kbytes within %d.%03d seconds)"; + (void) transmit(contact,false,fmt,CMDOK,total,delta/1000,delta%1000); + fmt="%d 3.5.3 Message accepted for delivery"; (void) transmit(contact,true,fmt,CMDOK,contact->cursesid); - fmt="(DATA stream received: %d Kbytes within %d.%03d seconds)"; - (void) log_fprintlog(contact->logptr,false,fmt,total,delta/1000,delta%1000); done=true; proceed=false; //task done break;