From: Jean-Marc Pigeon (Delson) Date: Fri, 4 Jul 2025 10:34:13 +0000 (-0400) Subject: Better way to display ehlo message X-Git-Tag: tag-0.12~32 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=a4d4fb01be9b21e0c1dcc05f8cbc36a7c58d8c0c;p=jmp%2Fmailleur Better way to display ehlo message --- diff --git a/lib/lvleml.c b/lib/lvleml.c index cb06f43..3b52770 100644 --- a/lib/lvleml.c +++ b/lib/lvleml.c @@ -1250,12 +1250,16 @@ return done; static _Bool doehlo(CONTYP *contact,char *parameter) { -static char *ehlostr[]= { - "-STARTTLS", - "-8BITMIME", - "-ENHANCEDSTATUSCODES", - " AUTH CRAM-MD5 DIGEST-MD5", - (char *)0 +static struct { + int display; //0 ->always, 1-->plain 2-->crypted + char *str; //the message to display + }ehlo[]={ + {1,"STARTTLS"}, + {2,"AUTH PLAIN LOGIN CRAM-MD5 DIGEST-MD5"}, + {0,"SIZE "MXMSIZE}, + {0,"8BITMIME"}, + {0,"ENHANCEDSTATUSCODES"}, + {0,(char *)0} }; #define OPEP "lvleml.c:doehlo" @@ -1281,11 +1285,27 @@ while (proceed==true) { break; case 1 : //thereis an FQDN (void) linkready(contact,true); - (void) transmit(contact,false,"%d-SIZE %ld",CMDOK,MXMSIZE); if (soc_iscrypted(contact->socptr)==true) strstart++; - for (int i=strstart;ehlostr[i]!=(char *)0;i++) { - (void) transmit(contact,false,"%d%s",CMDOK,ehlostr[i]); + for (int i=strstart;ehlo[i].str!=(char *)0;i++) { + char space; + + space='-'; + if (ehlo[i+1].str==(char *)0) + space=' '; + switch (ehlo[i].display) { + case 0 : //always display + break; + case 1 : //display on plain only + if (soc_iscrypted(contact->socptr)==true) + continue; + break; + case 2 : //display on crypted only + if (soc_iscrypted(contact->socptr)==false) + continue; + break; + } + (void) transmit(contact,false,"%d%c%s",CMDOK,space,ehlo[i].str); } (void) transmit(contact,true,""); done=true; diff --git a/lib/unieml.h b/lib/unieml.h index 3e89e3a..b5a7fb4 100644 --- a/lib/unieml.h +++ b/lib/unieml.h @@ -13,7 +13,7 @@ #define HFROM "From: " //Then email header header from #define HTITLE "Subject: " //Then email subject entry -#define MXMSIZE 52428800 //52 Megabytes +#define MXMSIZE "52428800" //52 Megabytes #define CRLF "\r\n" //EOL within SMTP protocol #define SIGNON 220 //signon information #define QUITOK 221 //status on quit