]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Improving MD5 authentication
authorJean-Marc Pigeon <jmp@safe.c>
Wed, 26 Nov 2025 17:00:17 +0000 (12:00 -0500)
committerJean-Marc Pigeon <jmp@safe.c>
Wed, 26 Nov 2025 17:00:17 +0000 (12:00 -0500)
lib/lvleml.c

index 08bf4416e2e3920e4fc0f361e566acbacae9a35e..6bc2fa4bb2d0de27afff3e0b509de10620ee1eed 100644 (file)
@@ -791,14 +791,7 @@ proceed=true;
 while (proceed==true) {
   (void) rou_dbglive(9,OPEP,"phase='%d'",OPEP,phase);
   switch (phase) {
-    case 0      :               //are we encrypted and on the right port
-      if (soc_iscrypted(contact->socptr)==false) {
-        static char *cmt="no authentication allowed on clear chanel";
-        (void) eml_status(contact,FAILED,NULL," 5.7.0 %s",cmt);
-        (void) setterminator(contact,cmt);
-        contact->credit-=1;     //"Bad boy"
-        phase=999;              //No need to go further 
-        }
+    case 0      :               //empty phase
       break;
     case 1      :       //check buffer
       if ((buffer==(char *)0)||(strlen(buffer)==0)) {
@@ -835,25 +828,37 @@ while (proceed==true) {
         case 0          :       //AUTH PLAIN
           if (soc_iscrypted(contact->socptr)==true) 
             (void) get_auth_plain(contact,local,&rmtpass);
-          else
-            (void) eml_transmit(contact,true,"%d 5.7.3 Unsafe PLAIN auth mode",
-                                              FAILED);
+          else {
+            static char *cmt="Unsafe PLAIN auth mode";
+
+            contact->credit-=2;
+            (void) eml_status(contact,FAILED,NULL," 5.7.3 %s",cmt);
+            (void) setterminator(contact,cmt);
+            }
           break;
         case 1          :       //AUTH LOGIN
           if (soc_iscrypted(contact->socptr)==true) 
             (void) get_auth_login(contact,&rmtpass);
-          else
-            (void) eml_transmit(contact,true,"%d 5.7.4 Unsafe LOGIN auth mode",
-                                              FAILED);
+          else {
+            static char *cmt="Unsafe LOGIN auth mode";
+
+            contact->credit-=2;
+            (void) eml_status(contact,FAILED,NULL," 5.7.3 %s",cmt);
+            (void) setterminator(contact,cmt);
+            }
           break;
         case 2          :       //AUTH DIGEST-MD5
           (void) get_auth_digest_md5(contact,&rmtpass);
           break;
-        default         :       //not yet implemented
-          (void) rou_alert(0,"%s auth type <%d> not yet implemented (Bug!)",
+        default         :  {    //not yet implemented
+          static char *cmt="Unexpected auth mode";
+
+          (void) rou_alert(0,"%s auth type <%d> not yet implemented (Bug?!)",
                               OPEP,code);
-          (void) eml_transmit(contact,true,"%d 5.7.5 Unexpected auth mode",FAILED);
+          (void) eml_status(contact,FAILED,NULL," 5.7.5 %s",cmt);
+          (void) setterminator(contact,cmt);
           phase=999;
+          }
           break;
         }
       break;