From: Jean-Marc Pigeon (Delson) Date: Sun, 27 Jul 2025 00:03:37 +0000 (-0400) Subject: Better handling of contact termend X-Git-Tag: tag-0.14~1 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=45f9a315a19b28bdce7f9fe7ccde20e654359f10;p=jmp%2Fmailleur Better handling of contact termend --- diff --git a/lib/lvleml.c b/lib/lvleml.c index 7afbce7..6ddd639 100644 --- a/lib/lvleml.c +++ b/lib/lvleml.c @@ -33,6 +33,24 @@ static const char *cry="(crypted link is now set in '%s' mode, security level='%d')"; +/* +^L +*/ +/********************************************************/ +/* */ +/* Procedure to update the termination condition */ +/* within contact. */ +/* current session. */ +/* */ +/********************************************************/ +static void setterminator(CONTYP *contact,const char *condition) + +{ +if (contact!=(CONTYP *)0) { + contact->termend=rou_freestr(contact->termend); + contact->termend=strdup(condition); + } +} /* ^L */ @@ -2403,8 +2421,7 @@ while (proceed==true) { status=-3; break; } - contact->termend=rou_freestr(contact->termend); - contact->termend=strdup(str); + (void) setterminator(contact,str); //(void) rou_alert(0,"%s exit status='%d'",OPEP,status); break; //no need to go further @@ -2427,8 +2444,7 @@ while (proceed==true) { break; case c_quit : //QUIT SMTP protocol contact->credit++; //clean disconnect - contact->termend=rou_freestr(contact->termend); - contact->termend=strdup("QUIT received"); + (void) setterminator(contact,"QUIT received"); (void) transmit(contact,true,"%d 2.0.0 Bye, closing connection CNT=%s", QUITOK,contact->mainsesid); status=1; //every thing fine @@ -2468,6 +2484,7 @@ while (proceed==true) { } break; case false : //unable to establish link + (void) setterminator(contact,"starttls not successful"); (void) transmit(contact,true,"%d 5.3.3 command starttls not successful", CMDBAD); status=-1;