]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Adjusting code to allow use of cram-md5 and disgest-md5 on plain link
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Mon, 7 Jul 2025 09:45:55 +0000 (05:45 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Mon, 7 Jul 2025 09:45:55 +0000 (05:45 -0400)
lib/lvleml.c

index d2921becac0274ae0f3f29be11cec4453ad7ed40..da40fb602258df8cef86fd9a13b97b1451b628f8 100644 (file)
@@ -438,7 +438,7 @@ while (proceed==true) {
         phase=999;      //no need to go further
       }
       break;
-    case 5      :  {    //comparing challange answer
+    case 5      :  {    //comparing challenge answer
       char *local;
       char *hexa;
 
@@ -447,7 +447,7 @@ while (proceed==true) {
       //(void) rou_alert(0,"%s anwr=<%s>",OPEP,answer);
       //(void) rou_alert(0,"%s hexa=<%s>",OPEP,hexa);
       if (strcmp(hexa,answer)!=0)
-        (void) strncpy(passwd,"$1(ukn as cram_d5)",sizeof(passwd)-1);
+        (void) strncpy(passwd,"$1(ukn as cram_md5)",sizeof(passwd)-1);
       (void) rou_asprintf(&decoded,"%s%s%s%s",IOBNULL,name,IOBNULL,passwd);
       hexa=rou_freestr(hexa);
       local=rou_freestr(local);
@@ -586,7 +586,9 @@ while (proceed==true) {
         break;
         }
       if (strcmp(HA0,resp->response)!=0) {
-        phase=999;      //user NOT autheticated
+        //user authentication failed
+        curpass=rou_freestr(curpass);
+        (void) rou_asprintf(&curpass,"$1(ukn as digest_md5)");
         }
       HA0=rou_freestr(HA0);
       }
@@ -821,10 +823,16 @@ while (proceed==true) {
     case 3      :       //getting "username password" accorind login type
       switch (code) {
         case 0          :       //AUTH PLAIN
-          decoded=get_auth_plain(contact,delay,local);
+          if (soc_iscrypted(contact->socptr)==true) 
+            decoded=get_auth_plain(contact,delay,local);
+          else
+            (void) transmit(contact,true,"%d 5.7.3 Unsafe PLAIN auth mode",FAILED);
           break;
         case 1          :       //AUTH LOGIN
-          decoded=get_auth_login(contact,delay);
+          if (soc_iscrypted(contact->socptr)==true) 
+            decoded=get_auth_login(contact,delay);
+          else
+            (void) transmit(contact,true,"%d 5.7.3 Unsafe LOGIN auth mode",FAILED);
           break;
         case 2          :       //AUTH CRAM-MD5
           decoded=get_auth_cram_md5(contact,delay);
@@ -1294,6 +1302,7 @@ static struct   {
       char *str;        //the message to display
       }ehlo[]={
         {1,"STARTTLS"},
+        {1,"AUTH CRAMD-MD5 DIGEST-MD5"},
         {2,"AUTH PLAIN LOGIN CRAM-MD5 DIGEST-MD5"},
         {0,"SIZE "MXMSIZE},
         {0,"8BITMIME"},