From 3033e51e0b99a27e8ffa7df0fb3e0fdd85ab253c Mon Sep 17 00:00:00 2001 From: "Jean-Marc Pigeon (Delson)" Date: Fri, 20 Jun 2025 17:25:25 -0400 Subject: [PATCH] Able to transmit to mailref1 --- app/feeder.c | 4 ++-- lib/gestcp.c | 24 +++++++++++++----------- lib/gestcp.h | 2 +- lib/lvleml.c | 4 ++-- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/app/feeder.c b/app/feeder.c index 6293e10..4b19c4a 100644 --- a/app/feeder.c +++ b/app/feeder.c @@ -99,8 +99,8 @@ static int sendout(SOCPTR *socptr,char *line) { int taille; -taille=tcp_write(socptr,line); -taille+=tcp_write(socptr,CRLF); +taille=tcp_Swrite(socptr,line); +taille+=tcp_Swrite(socptr,CRLF); return taille; } /* diff --git a/lib/gestcp.c b/lib/gestcp.c index 5359c18..79d540c 100644 --- a/lib/gestcp.c +++ b/lib/gestcp.c @@ -122,7 +122,7 @@ return got; /* return the number of char sent on channel. */ /* */ /********************************************************/ -PUBLIC int tcp_write(SOCPTR *socptr,char *buffer) +PUBLIC int tcp_Swrite(SOCPTR *socptr,char *buffer) { int sent; @@ -134,6 +134,7 @@ if (socptr!=(SOCPTR *)0) { taille=strlen(buffer); if (taille>0) sent=soc_writebuffer(socptr,buffer,taille); + (void) rou_alert(0,"JMPDBG Swrite=<%s>",buffer); } return sent; } @@ -209,7 +210,7 @@ va_start(args,fmt); va_end(args); (void) log_fprintlog(rmt->logptr,false,strloc); (void) strcat(strloc,CRLF); -(void) tcp_write(rmt->socptr,strloc); +(void) tcp_Swrite(rmt->socptr,strloc); return tcp_get_smtp_reply(rmt,WAITRMT,resp); } /* @@ -251,29 +252,30 @@ while (proceed==true) { char data[300]; sent=0; - while (fgets(data,sizeof(data),qfile)!=(char *)0) { - do { //cleaning line + while (fgets(data,sizeof(data)-4,qfile)!=(char *)0) { + do { register int taille; register char *ptr; taille=strlen(data)-1; if (taille<0) break; - ptr=data+taille; + ptr=data+taille; if ((*ptr!='\n')&&(*ptr!='\r')) - break; + break; //Line too long! *ptr='\000'; } while (strlen(data)>0); - if ((strlen(data)>0)&&(data[0]=='.')) //dot escape - (void) memmove(data+1,data,strlen(data)); - (void) rou_alert(0,"%s sending< - sent+=tcp_write(rmt->socptr,data); + //dot escape + if ((strlen(data)>0)&&(data[0]=='.')) + (void) memmove(data,data+1,strlen(data+1)); + (void) strcat(data,CRLF); + sent+=tcp_Swrite(rmt->socptr,data); } break; } case 2 : //end of transmission - sent+=tcp_write(rmt->socptr,ENDDATA); + sent+=tcp_Swrite(rmt->socptr,ENDDATA); break; case 3 : //closing datafile qfile=eml_closeqfile(qfile); diff --git a/lib/gestcp.h b/lib/gestcp.h index 734a60c..dc8b78d 100644 --- a/lib/gestcp.h +++ b/lib/gestcp.h @@ -31,7 +31,7 @@ PUBLIC char *tcp_addline(char *buffer,char *line); extern int tcp_getline(SOCPTR *socptr,u_int secwait,char **lineptr); //Transmit formated data to the contact channel -extern int tcp_write(SOCPTR *socptr,char *buffer); +extern int tcp_Swrite(SOCPTR *socptr,char *buffer); //wait and answer from remote and return the reply code extern int tcp_get_smtp_reply(RMTTYP *rmt,int wait,char ***resp); diff --git a/lib/lvleml.c b/lib/lvleml.c index c513945..40e1380 100644 --- a/lib/lvleml.c +++ b/lib/lvleml.c @@ -138,7 +138,7 @@ if (rou_vasprintf(&line,fmt,args)>0) { contact->transout=tcp_addline(contact->transout,line); } if (flush==true) { - (void) tcp_write(contact->socptr,contact->transout); + (void) tcp_Swrite(contact->socptr,contact->transout); contact->transout=rou_freestr(contact->transout); } line=rou_freestr(line); @@ -1172,7 +1172,7 @@ while (proceed==true) { phase=999; //No need to wait form response code break; case 2 : //send the text termination - rspcode= tcp_get_smtp_reply(rmt,WAITRMT,&resp); + rspcode=tcp_get_smtp_reply(rmt,WAITRMT,&resp); break; case 3 : //sending session data const char *fmt; -- 2.47.3