From 45f9a315a19b28bdce7f9fe7ccde20e654359f10 Mon Sep 17 00:00:00 2001 From: "Jean-Marc Pigeon (Delson)" Date: Sat, 26 Jul 2025 20:03:37 -0400 Subject: [PATCH] Better handling of contact termend --- lib/lvleml.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) 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; -- 2.47.3