From: Jean-Marc Pigeon (Delson) Date: Sun, 8 Jun 2025 23:59:09 +0000 (-0400) Subject: Able to submit a originator to remote serrver X-Git-Tag: tag-0.8~49 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=c7451bb19f82f4819fef4de1c220fc11fe738df7;p=jmp%2Fmailleur Able to submit a originator to remote serrver --- diff --git a/Makefile b/Makefile index 6e39a49..7885091 100644 --- a/Makefile +++ b/Makefile @@ -217,17 +217,20 @@ go465 : xxx : @ clear - @ openssl s_client \ - -msg \ + openssl s_client \ -key certs/localhost-key.pem \ - -cert certs/localhost-cert.pem \ + -cert_chain certs/localhost-chain-cert.pem \ -CAfile certs/root-safe_CA.pem \ + -crlf \ -starttls smtp \ - -connect courriel.colba.net:25 + -connect $(TESTSRV):$(TESTPORT) +# -status +# -crlf +# -msg +# -debug # -showcerts # -tls1_2 -# -connect smtp1.example.com:587 # -connect mailprod1.safe.ca:25 # -connect $(TESTSRV):$(TESTPORT) # -connect smtp.google.com:25 @@ -237,15 +240,11 @@ xxx : tlsref: @ clear @ openssl s_client \ - -status \ -msg \ - -debug \ -CAfile certs/root-safe_CA.pem \ -cert certs/localhost-cert.pem \ -key certs/localhost-key.pem \ - -connect smtp.google.com:25 \ - -starttls \ - smtp + -connect smtp.google.com:25 #-------------------------------------------------------------------- #starting email receiver diff --git a/lib/devsoc.c b/lib/devsoc.c index 6fb79ec..fcc840f 100644 --- a/lib/devsoc.c +++ b/lib/devsoc.c @@ -1011,7 +1011,6 @@ if ((soc!=(SOCTYP *)0)&&(isconnected(soc)==true)) { break; case 1 : //polling early return (data or event) //checking if link still available - //(void) rou_alert(0,"%s Polling early (error=<%s>)",OPEP,strerror(errno)); if (tls_write(soc->tls,(char *)0,0)<0) { (void) rou_alert(0,"%s, TLS link disconnect detected",OPEP); status=0; diff --git a/lib/gestcp.c b/lib/gestcp.c index 0c47474..7427ec5 100644 --- a/lib/gestcp.c +++ b/lib/gestcp.c @@ -125,7 +125,7 @@ return sent; PUBLIC int tcp_get_smtp_reply(RMTTYP *rmt,int wait) { -#define OPEP "gestcp.c:cp_get_smtp_reply," +#define OPEP "gestcp.c:tcp_get_smtp_reply," int code; int maxlines; @@ -139,11 +139,9 @@ while (maxlines>0) { int sofar; line=(char *)0; - (void) rou_alert(0,"%s JMPDBG waiting for answer",OPEP); if (tcp_getline(rmt->socptr,wait,&line)<0) { char cmt[100]; - (void) rou_alert(0,"%s JMPDBG timeout",OPEP); (void) snprintf(cmt,sizeof(cmt),"%d Timeout waiting '%d' sec for MX <%s>", ERRPROC,wait,rmt->curmx->mxname); line=strdup(cmt); diff --git a/lib/lvleml.c b/lib/lvleml.c index 8bbcd02..c5a83a9 100644 --- a/lib/lvleml.c +++ b/lib/lvleml.c @@ -717,12 +717,16 @@ while (proceed==true) { rspcode=tcp_smtp_command(rmt,"STARTTLS",rmt->orgdomain); switch (rspcode) { case SIGNON : //link is now encrypted - int bigre; - (void) usleep(100000); done=soc_starttls(rmt->socptr,false); - (void) rou_alert(0,"%s JMPDBG should start tls done='%d'",OPEP,done); - bigre=tcp_get_smtp_reply(rmt,WAITRMT); - (void) rou_alert(0,"%s JMPDBG tls done='%d'",OPEP,bigre); + switch (done) { + case true : + (void) log_fprintlog(rmt->logptr,false,"crypted link now set"); + break; + case false : + (void) log_fprintlog(rmt->logptr,false,"Unable to set crypted link"); + break; + } + phase=999; //link is now established break; default : //Trouble (void) rou_alert(0,"%s Unable to establish crypted link with <%s>", @@ -815,10 +819,10 @@ while (proceed==true) { } break; case 3 : //send greetings - if (greetings_rmt(rmt)==false) + if ((done=greetings_rmt(rmt))==false) phase=999; //greeting not successful! break; - case 4 : //establishing secured link + case 4 : //send greetings break; default : //SAFE Guard proceed=false; @@ -906,11 +910,23 @@ while (proceed==true) { phase=999; //No need to go further } break; - case 5 : //sending recipient list + case 5 : //sending originator + int rspcode; + + rspcode=tcp_smtp_command(&rmt,"MAIL FROM: <%s>",(*tosend)->mailfrom); + switch (rspcode) { + default : //unexpected answer + (void) rou_alert(0,"%s JMPDBG unexpected response code='%d'", + OPEP,rspcode); + phase+=2; //not sending data + break; + } + break; + case 6 : //sending recipient list break; - case 6 : //send email data + case 7 : //send email data break; - case 7 : //cleaning recipient list + case 8 : //cleaning recipient list (void) free(tosend); tosend=(TRATYP **)0; phase=0; //Lets see if we have other recipient