]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Better way to display ehlo message
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Fri, 4 Jul 2025 10:34:13 +0000 (06:34 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Fri, 4 Jul 2025 10:34:13 +0000 (06:34 -0400)
lib/lvleml.c
lib/unieml.h

index cb06f43ff915ad071634b432b5bba72cc423944b..3b52770cd1ed811c8b9ff4502a04ff29b3e7b937 100644 (file)
@@ -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;
index 3e89e3a6c915e3a3ec23133cfc755864ae563587..b5a7fb4e8816f67896a3385769be5293e7ec8087 100644 (file)
@@ -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